summaryrefslogtreecommitdiff
path: root/gtk2_ardour/strip_silence_dialog.h
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-11-22 17:15:32 +0000
committerCarl Hetherington <carl@carlh.net>2010-11-22 17:15:32 +0000
commitbf411d3730526af0bb984f6bb3dd4035d6070bc4 (patch)
treef6da2de3ac13de90bfdfe09797b5fbfb233aa2b6 /gtk2_ardour/strip_silence_dialog.h
parentd000c7e79d80db424547a54f3104a305d82efb54 (diff)
Simplify strip silence dialogue threading, hopefully fixing #3560 in the process.
git-svn-id: svn://localhost/ardour2/branches/3.0@8068 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/strip_silence_dialog.h')
-rw-r--r--gtk2_ardour/strip_silence_dialog.h51
1 files changed, 23 insertions, 28 deletions
diff --git a/gtk2_ardour/strip_silence_dialog.h b/gtk2_ardour/strip_silence_dialog.h
index 3b800eb115..c9b31578b9 100644
--- a/gtk2_ardour/strip_silence_dialog.h
+++ b/gtk2_ardour/strip_silence_dialog.h
@@ -43,17 +43,21 @@ public:
nframes_t minimum_length () const;
nframes_t fade_length () const;
- static void stop_thread ();
private:
+ typedef std::list<std::pair<ARDOUR::frameoffset_t,ARDOUR::framecnt_t> > SilenceResult;
+
void create_waves ();
void peaks_ready ();
void canvas_allocation (Gtk::Allocation &);
void update_silence_rects ();
void resize_silence_rects ();
+ void update ();
void update_threshold_line ();
+ void update_stats (SilenceResult const &);
void threshold_changed ();
void update_progress_gui (float);
+ void restart_thread ();
Gtk::SpinButton _threshold;
AudioClock _minimum_length;
@@ -62,32 +66,23 @@ private:
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 {
- boost::shared_ptr<ARDOUR::AudioRegion> region;
- ArdourCanvas::WaveView* view;
- std::list<ArdourCanvas::SimpleRect*> silence_rects;
- ArdourCanvas::SimpleLine* threshold_line;
- double samples_per_unit;
- SilenceResult silence;
-
- Wave (ArdourCanvas::Group *, boost::shared_ptr<ARDOUR::AudioRegion>);
- ~Wave ();
+ boost::shared_ptr<ARDOUR::AudioRegion> region;
+ ArdourCanvas::WaveView* view;
+ std::list<ArdourCanvas::SimpleRect*> silence_rects;
+ ArdourCanvas::SimpleLine* threshold_line;
+ double samples_per_unit;
+ SilenceResult silence;
+
+ Wave (ArdourCanvas::Group *, boost::shared_ptr<ARDOUR::AudioRegion>);
+ ~Wave ();
};
ArdourCanvas::Canvas* _canvas;
std::list<Wave*> _waves;
int _wave_width;
int _wave_height;
- bool restart_queued;
-
- static ARDOUR::InterThreadInfo itt;
- static bool thread_should_exit;
- static Glib::Cond *thread_run;
- static Glib::Cond *thread_waiting;
- static Glib::StaticMutex run_lock;
- static StripSilenceDialog* current;
ARDOUR::framecnt_t max_audible;
ARDOUR::framecnt_t min_audible;
@@ -95,14 +90,14 @@ private:
ARDOUR::framecnt_t min_silence;
PBD::ScopedConnection* _peaks_ready_connection;
-
- static bool _detection_done (void*);
- static void* _detection_thread_work (void*);
-
- bool detection_done ();
- void* detection_thread_work ();
- bool start_silence_detection ();
- void maybe_start_silence_detection ();
- void update_stats (const SilenceResult&);
+ pthread_t _thread; ///< thread to compute silence in the background
+ static void * _detection_thread_work (void *);
+ void * detection_thread_work ();
+ Glib::Mutex _lock; ///< lock held while the thread is doing work
+ Glib::Cond _run_cond; ///< condition to wake the thread
+ bool _thread_should_finish; ///< true if the thread should terminate
+ PBD::Signal0<void> Completed; ///< emitted when a silence detection has completed
+ PBD::ScopedConnection _completed_connection;
+ ARDOUR::InterThreadInfo _interthread_info;
};