class EditorSnapshots;
class EditorSummary;
class RegionLayeringOrderEditor;
+class ProgressReporter;
/* <CMT Additions> */
class ImageFrameView;
/* audio filters */
- void apply_filter (ARDOUR::Filter&, std::string cmd);
+ void apply_filter (ARDOUR::Filter&, std::string cmd, ProgressReporter* progress = 0);
Command* apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, MidiRegionView& mrv);
void apply_midi_note_edit_op (ARDOUR::MidiOperator& op);
if (r == Gtk::RESPONSE_OK) {
StripSilence s (*_session, d.threshold (), d.minimum_length (), d.fade_length ());
- apply_filter (s, _("strip silence"));
+ apply_filter (s, _("strip silence"), &d);
}
}
}
void
-Editor::apply_filter (Filter& filter, string command)
+Editor::apply_filter (Filter& filter, string command, ProgressReporter* progress)
{
RegionSelection rs;
track_canvas->get_window()->set_cursor (*wait_cursor);
gdk_flush ();
+ int n = 0;
+ int const N = rs.size ();
+
for (RegionSelection::iterator r = rs.begin(); r != rs.end(); ) {
RegionSelection::iterator tmp = r;
++tmp;
if (arv) {
boost::shared_ptr<Playlist> playlist = arv->region()->playlist();
- if (arv->audio_region()->apply (filter) == 0) {
+ if (progress) {
+ progress->descend (1.0 / N);
+ }
+
+ if (arv->audio_region()->apply (filter, progress) == 0) {
playlist->clear_changes ();
-
+
if (filter.results.empty ()) {
/* no regions returned; remove the old one */
} else {
goto out;
}
+
+ if (progress) {
+ progress->ascend ();
+ progress->set_progress (float (n + 1) / N);
+ }
}
r = tmp;
+ ++n;
}
commit_reversible_command ();
/** Construct Strip silence dialog box */
StripSilenceDialog::StripSilenceDialog (Session* s, list<boost::shared_ptr<ARDOUR::AudioRegion> > const & regions)
: ArdourDialog (_("Strip Silence"))
+ , ProgressReporter ()
, _minimum_length (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false)
, _fade_length (X_("silence duration"), true, "SilenceDurationClock", true, false, true, false)
, _wave_width (640)
get_vbox()->pack_start (*_canvas, true, true);
+ get_vbox()->pack_start (_progress_bar, true, true);
+
show_all ();
_threshold.get_adjustment()->signal_value_changed().connect (sigc::mem_fun (*this, &StripSilenceDialog::threshold_changed));
delete *i;
}
}
+
+void
+StripSilenceDialog::update_progress_gui (float p)
+{
+ _progress_bar.set_fraction (p);
+}
#include "ardour/types.h"
#include "ardour_dialog.h"
#include "canvas.h"
+#include "progress_reporter.h"
namespace ARDOUR {
class AudioRegion;
}
/// Dialog box to set options for the `strip silence' filter
-class StripSilenceDialog : public ArdourDialog
+class StripSilenceDialog : public ArdourDialog, public ProgressReporter
{
public:
StripSilenceDialog (ARDOUR::Session*, std::list<boost::shared_ptr<ARDOUR::AudioRegion> > const &);
void resize_silence_rects ();
void update_threshold_line ();
void threshold_changed ();
+ void update_progress_gui (float);
Gtk::SpinButton _threshold;
AudioClock _minimum_length;
Gtk::Label _segment_count_label;
Gtk::Label _shortest_silence_label;
Gtk::Label _shortest_audible_label;
+ Gtk::ProgressBar _progress_bar;
typedef std::list<std::pair<ARDOUR::frameoffset_t,ARDOUR::framecnt_t> > SilenceResult;
struct Wave {
'port_matrix_labels.cc',
'port_matrix_row_labels.cc',
'processor_box.cc',
+ 'progress_reporter.cc',
'prompter.cc',
'public_editor.cc',
'quantize_dialog.cc',
class Region;
class Session;
+class Progress;
class Filter {
public:
virtual ~Filter() {}
- virtual int run (boost::shared_ptr<ARDOUR::Region>) = 0;
+ virtual int run (boost::shared_ptr<ARDOUR::Region>, Progress* progress = 0) = 0;
std::vector<boost::shared_ptr<ARDOUR::Region> > results;
protected:
MidiStretch (ARDOUR::Session&, TimeFXRequest&);
~MidiStretch ();
- int run (boost::shared_ptr<ARDOUR::Region>);
+ int run (boost::shared_ptr<ARDOUR::Region>, Progress* progress = 0);
private:
TimeFXRequest& _request;
RBEffect (ARDOUR::Session&, TimeFXRequest&);
~RBEffect ();
- int run (boost::shared_ptr<ARDOUR::Region>);
+ int run (boost::shared_ptr<ARDOUR::Region>, Progress* progress = 0);
private:
TimeFXRequest& tsr;
class Playlist;
class Filter;
class ExportSpecification;
+class Progress;
enum RegionEditState {
EditChangesNothing = 0,
void set_locked (bool yn);
void set_position_locked (bool yn);
- int apply (Filter&);
+ int apply (Filter &, Progress* progress = 0);
virtual uint64_t read_data_count() const { return _read_data_count; }
Reverse (ARDOUR::Session&);
~Reverse ();
- int run (boost::shared_ptr<ARDOUR::Region>);
+ int run (boost::shared_ptr<ARDOUR::Region>, Progress *);
};
} /* namespace */
public:
StripSilence (Session &, double, nframes_t, nframes_t);
- int run (boost::shared_ptr<ARDOUR::Region>);
+ int run (boost::shared_ptr<ARDOUR::Region>, Progress* progress = 0);
private:
double _threshold; ///< silence threshold, in dBFS
}
int
-MidiStretch::run (boost::shared_ptr<Region> r)
+MidiStretch::run (boost::shared_ptr<Region> r, Progress* progress)
{
SourceList nsrcs;
char suffix[32];
}
int
-RBEffect::run (boost::shared_ptr<Region> r)
+RBEffect::run (boost::shared_ptr<Region> r, Progress* progress)
{
boost::shared_ptr<AudioRegion> region = boost::dynamic_pointer_cast<AudioRegion> (r);
}
int
-Region::apply (Filter& filter)
+Region::apply (Filter& filter, Progress* progress)
{
- return filter.run (shared_from_this());
+ return filter.run (shared_from_this(), progress);
}
}
int
-Reverse::run (boost::shared_ptr<Region> r)
+Reverse::run (boost::shared_ptr<Region> r, Progress* progress)
{
SourceList nsrcs;
SourceList::iterator si;
#include "ardour/region_factory.h"
#include "ardour/session.h"
#include "ardour/dB.h"
+#include "ardour/progress.h"
using namespace ARDOUR;
}
int
-StripSilence::run (boost::shared_ptr<Region> r)
+StripSilence::run (boost::shared_ptr<Region> r, Progress* progress)
{
results.clear ();
in_silence = false;
}
+ int n = 0;
+ int const N = silence.size ();
+
while (s != silence.end()) {
framecnt_t interval_duration;
++s;
end = s->first;
in_silence = !in_silence;
+
+ if (progress) {
+ progress->set_progress (float (n) / N);
+ }
+ ++n;
}
return 0;
'port_set.cc',
'process_thread.cc',
'processor.cc',
+ 'progress.cc',
'quantize.cc',
'rc_configuration.cc',
'recent_sessions.cc',