summaryrefslogtreecommitdiff
path: root/gtk2_ardour/strip_silence_dialog.cc
diff options
context:
space:
mode:
authorNikolaus Gullotta <nik@harrisonconsoles.com>2019-08-30 12:40:28 -0500
committerNikolaus Gullotta <nik@harrisonconsoles.com>2019-08-30 12:40:28 -0500
commitd5988b232c63ed35d20101ee8917c4e2a0596603 (patch)
treec58a5cdad03b560e742f9bf2870d3fa006b8957b /gtk2_ardour/strip_silence_dialog.cc
parentdab29eb8ade18259cf501d155cec012b85f22c9b (diff)
Add settings retention to StripSilenceDialog
StripSilenceDialog will now retain its threshold, minimum length, and fade length values from run to run. This is done via Session::add_extra_xml() and recalled during the construction of StripSilenceDialog via Session::extra_xml()
Diffstat (limited to 'gtk2_ardour/strip_silence_dialog.cc')
-rw-r--r--gtk2_ardour/strip_silence_dialog.cc32
1 files changed, 29 insertions, 3 deletions
diff --git a/gtk2_ardour/strip_silence_dialog.cc b/gtk2_ardour/strip_silence_dialog.cc
index 50115af6d5..6aeec29cd9 100644
--- a/gtk2_ardour/strip_silence_dialog.cc
+++ b/gtk2_ardour/strip_silence_dialog.cc
@@ -51,6 +51,9 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
, _destroying (false)
, analysis_progress_cur (0)
, analysis_progress_max (0)
+ , _threshold_value (-60)
+ , _minimum_length_value (1000)
+ , _fade_length_value (64)
{
set_session (s);
@@ -63,6 +66,14 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
Gtk::Table* table = Gtk::manage (new Gtk::Table (3, 3));
table->set_spacings (6);
+ //get the last used settings for this
+ XMLNode* node = _session->extra_xml(X_("StripSilence"));
+ if (node) {
+ node->get_property(X_("threshold"), _threshold_value);
+ node->get_property(X_("min-length"), _minimum_length_value);
+ node->get_property(X_("fade-length"), _fade_length_value);
+ }
+
int n = 0;
table->attach (*Gtk::manage (new Gtk::Label (_("Threshold"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL);
@@ -73,7 +84,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
_threshold.set_digits (1);
_threshold.set_increments (1, 10);
_threshold.set_range (-120, 0);
- _threshold.set_value (-60);
+ _threshold.set_value (_threshold_value);
_threshold.set_activates_default ();
table->attach (*Gtk::manage (new Gtk::Label (_("Minimum length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL);
@@ -82,7 +93,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
_minimum_length->set_session (s);
_minimum_length->set_mode (AudioClock::Samples);
- _minimum_length->set (1000, true);
+ _minimum_length->set (_minimum_length_value, true);
table->attach (*Gtk::manage (new Gtk::Label (_("Fade length"), 1, 0.5)), 0, 1, n, n + 1, Gtk::FILL);
table->attach (*_fade_length, 1, 2, n, n + 1, Gtk::FILL);
@@ -90,7 +101,7 @@ StripSilenceDialog::StripSilenceDialog (Session* s, list<RegionView*> const & v)
_fade_length->set_session (s);
_fade_length->set_mode (AudioClock::Samples);
- _fade_length->set (64, true);
+ _fade_length->set (_fade_length_value, true);
hbox->pack_start (*table);
@@ -339,3 +350,18 @@ StripSilenceDialog::update_progress_gui (float p)
{
_progress_bar.set_fraction (p);
}
+
+XMLNode&
+StripSilenceDialog::get_state ()
+{
+ XMLNode* node = new XMLNode(X_("StripSilence"));
+ node->set_property(X_("threshold"), threshold());
+ node->set_property(X_("min-length"), minimum_length());
+ node->set_property(X_("fade-length"), fade_length());
+ return *node;
+}
+
+void
+StripSilenceDialog::set_state (const XMLNode &)
+{
+} \ No newline at end of file