Ardour  9.0-pre0-582-g084a23a80d
strip_silence_dialog.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
3  * Copyright (C) 2009-2011 David Robillard <d@drobilla.net>
4  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
5  * Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  */
21 
22 #include <glibmm/threads.h>
23 #include <gtkmm/progressbar.h>
24 #include <gtkmm/spinbutton.h>
25 #include <glibmm/threads.h>
26 
27 #include <pbd/xml++.h>
28 
30 #include "ardour/types.h"
31 #include "ardour_dialog.h"
32 #include "progress_reporter.h"
33 
34 namespace ARDOUR {
35  class Session;
36 }
37 
38 class AudioClock;
39 class RegionView;
40 
43 {
44 public:
45  StripSilenceDialog (ARDOUR::Session*, std::list<RegionView*> const &);
47 
48  double threshold () const {
49  return _threshold.get_value ();
50  }
51 
52  void drop_rects ();
53 
55 
58 
59  void on_response (int response_id) {
60  Gtk::Dialog::on_response (response_id);
61  }
62 
63  XMLNode& get_state () const;
64  void set_state (const XMLNode &);
65 
66 private:
67  void create_waves ();
71  void update ();
75  void update_progress_gui (float);
76  void restart_thread ();
77  void finished(int);
78 
83 
86 
87  struct ViewInterval {
90 
91  ViewInterval (RegionView* rv) : view (rv) {}
92  };
93 
94  std::list<ViewInterval> views;
95 
97 
98  pthread_t _thread;
99  static void * _detection_thread_work (void *);
101  Glib::Threads::Mutex _lock;
102  Glib::Threads::Cond _run_cond;
107 
108  sigc::connection progress_idle_connection;
112 
116 };
virtual void on_response(int response_id)
This is a default handler for the signal signal_response().
double get_value() const
Dialog box to set options for the ‘strip silence’ filter.
PBD::Signal< void()> Completed
emitted when a silence detection has completed
void set_state(const XMLNode &)
void canvas_allocation(Gtk::Allocation &)
bool _thread_should_finish
true if the thread should terminate
std::list< ViewInterval > views
ARDOUR::samplecnt_t minimum_length() const
ARDOUR::InterThreadInfo _interthread_info
AudioClock * _minimum_length
void * detection_thread_work()
void silences(ARDOUR::AudioIntervalMap &)
Gtk::Button * apply_button
ARDOUR::samplecnt_t _fade_length_value
StripSilenceDialog(ARDOUR::Session *, std::list< RegionView * > const &)
sigc::connection progress_idle_connection
void on_response(int response_id)
This is a default handler for the signal signal_response().
bool idle_update_progress()
GUI-thread progress updates of background silence computation.
Glib::Threads::Mutex _lock
lock held while the thread is doing work
Gtk::SpinButton _threshold
pthread_t _thread
thread to compute silence in the background
static void * _detection_thread_work(void *)
Gtk::ProgressBar _progress_bar
void update_threshold_line()
Glib::Threads::Cond _run_cond
condition to wake the thread
PBD::ScopedConnection _completed_connection
void update_progress_gui(float)
double threshold() const
Gtk::Button * cancel_button
XMLNode & get_state() const
void resize_silence_rects()
void update_stats(ARDOUR::AudioIntervalResult const &)
ARDOUR::samplecnt_t fade_length() const
void update_silence_rects()
ARDOUR::samplecnt_t _minimum_length_value
Definition: xml++.h:114
std::list< std::pair< sampleoffset_t, sampleoffset_t > > AudioIntervalResult
Temporal::samplecnt_t samplecnt_t
std::map< std::shared_ptr< ARDOUR::Region >, AudioIntervalResult > AudioIntervalMap
ARDOUR::AudioIntervalResult intervals