13
0

strip silence: wait for analysis to complete

"apply"ing strip-silence while analysis is still running will at best
only process regions that have already been analyzed and at worst crash.
This commit is contained in:
Robin Gareus 2015-10-16 00:13:02 +02:00
parent 5ad63bd3f8
commit dead81d284

View File

@ -106,6 +106,9 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
update_silence_rects (); update_silence_rects ();
update_threshold_line (); update_threshold_line ();
_progress_bar.set_text (_("Analyzing"));
apply_button->set_sensitive (false);
/* Create a thread which runs while the dialogue is open to compute the silence regions */ /* Create a thread which runs while the dialogue is open to compute the silence regions */
Completed.connect (_completed_connection, invalidator(*this), boost::bind (&StripSilenceDialog::update, this), gui_context ()); Completed.connect (_completed_connection, invalidator(*this), boost::bind (&StripSilenceDialog::update, this), gui_context ());
_thread_should_finish = false; _thread_should_finish = false;
@ -145,6 +148,8 @@ StripSilenceDialog::drop_rects ()
// called by parent when starting to progess (dialog::run returned), // called by parent when starting to progess (dialog::run returned),
// but before the dialog is destoyed. // but before the dialog is destoyed.
_interthread_info.cancel = true;
for (list<ViewInterval>::iterator v = views.begin(); v != views.end(); ++v) { for (list<ViewInterval>::iterator v = views.begin(); v != views.end(); ++v) {
v->view->drop_silent_frames (); v->view->drop_silent_frames ();
} }
@ -180,6 +185,8 @@ StripSilenceDialog::update ()
{ {
update_threshold_line (); update_threshold_line ();
update_silence_rects (); update_silence_rects ();
_progress_bar.set_text ("");
apply_button->set_sensitive(true);
} }
void void
@ -253,6 +260,9 @@ StripSilenceDialog::restart_thread ()
return; return;
} }
_progress_bar.set_text (_("Analyzing"));
apply_button->set_sensitive (false);
/* Cancel any current run */ /* Cancel any current run */
_interthread_info.cancel = true; _interthread_info.cancel = true;