ardour
strip_silence_dialog.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2009 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 
18 */
19 
20 #include <gtkmm/spinbutton.h>
21 #include <glibmm/threads.h>
22 
23 #include "ardour/types.h"
24 #include "ardour_dialog.h"
25 #include "progress_reporter.h"
26 
27 namespace ARDOUR {
28  class Session;
29 }
30 
31 class AudioClock;
32 class RegionView;
33 
36 {
37 public:
38  StripSilenceDialog (ARDOUR::Session*, std::list<RegionView*> const &);
40 
41  double threshold () const {
42  return _threshold.get_value ();
43  }
44 
45  void drop_rects ();
46 
48 
51 
52 private:
53  void create_waves ();
54  void peaks_ready ();
55  void canvas_allocation (Gtk::Allocation &);
56  void update_silence_rects ();
57  void resize_silence_rects ();
58  void update ();
59  void update_threshold_line ();
61  void threshold_changed ();
62  void update_progress_gui (float);
63  void restart_thread ();
64 
65  Gtk::SpinButton _threshold;
68  Gtk::ProgressBar _progress_bar;
69 
70  struct ViewInterval {
73 
74  ViewInterval (RegionView* rv) : view (rv) {}
75  };
76 
77  std::list<ViewInterval> views;
78 
80 
82 
83  pthread_t _thread;
84  static void * _detection_thread_work (void *);
85  void * detection_thread_work ();
86  Glib::Threads::Mutex _lock;
87  Glib::Threads::Cond _run_cond;
89  PBD::Signal0<void> Completed;
92 };
PBD::Signal0< void > Completed
emitted when a silence detection has completed
ARDOUR::InterThreadInfo _interthread_info
double threshold() const
void canvas_allocation(Gtk::Allocation &)
std::list< std::pair< frameoffset_t, frameoffset_t > > AudioIntervalResult
Definition: types.h:83
Dialog box to set options for the `strip silence' filter.
StripSilenceDialog(ARDOUR::Session *, std::list< RegionView * > const &)
ARDOUR::framecnt_t fade_length() const
std::map< boost::shared_ptr< ARDOUR::Region >, AudioIntervalResult > AudioIntervalMap
Definition: types.h:85
std::list< ViewInterval > views
int64_t framecnt_t
Definition: types.h:76
PBD::ScopedConnection * _peaks_ready_connection
Definition: amp.h:29
Glib::Threads::Cond _run_cond
condition to wake the thread
ARDOUR::AudioIntervalResult intervals
PBD::ScopedConnection _completed_connection
AudioClock * _minimum_length
pthread_t _thread
thread to compute silence in the background
void resize_silence_rects()
bool _thread_should_finish
true if the thread should terminate
Gtk::ProgressBar _progress_bar
Glib::Threads::Mutex _lock
lock held while the thread is doing work
ARDOUR::framecnt_t minimum_length() const
void silences(ARDOUR::AudioIntervalMap &)
void update_stats(ARDOUR::AudioIntervalResult const &)
Gtk::SpinButton _threshold
static void * _detection_thread_work(void *)