summaryrefslogtreecommitdiff
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
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()
-rw-r--r--gtk2_ardour/editor_ops.cc1
-rw-r--r--gtk2_ardour/strip_silence_dialog.cc32
-rw-r--r--gtk2_ardour/strip_silence_dialog.h9
3 files changed, 39 insertions, 3 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 99e7d1133a..0b9c7a33de 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -5522,6 +5522,7 @@ Editor::strip_region_silence ()
StripSilence s (*_session, silences, d.fade_length());
apply_filter (s, _("strip silence"), &d);
+ _session->add_extra_xml(d.get_state());
}
}
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
diff --git a/gtk2_ardour/strip_silence_dialog.h b/gtk2_ardour/strip_silence_dialog.h
index 51bec028f5..bc90ce321e 100644
--- a/gtk2_ardour/strip_silence_dialog.h
+++ b/gtk2_ardour/strip_silence_dialog.h
@@ -22,6 +22,8 @@
#include <gtkmm/spinbutton.h>
#include <glibmm/threads.h>
+#include <pbd/xml++.h>
+
#include "ardour/types.h"
#include "ardour_dialog.h"
#include "progress_reporter.h"
@@ -55,6 +57,9 @@ public:
Gtk::Dialog::on_response (response_id);
}
+ XMLNode& get_state ();
+ void set_state (const XMLNode &);
+
private:
void create_waves ();
void canvas_allocation (Gtk::Allocation &);
@@ -100,4 +105,8 @@ private:
bool idle_update_progress(); ///< GUI-thread progress updates of background silence computation
int analysis_progress_cur;
int analysis_progress_max;
+
+ int _threshold_value;
+ ARDOUR::samplecnt_t _minimum_length_value;
+ ARDOUR::samplecnt_t _fade_length_value;
};