From 298da236198a89557c13fcc71500d4a445a0f436 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 10 Jun 2013 12:37:09 -0400 Subject: [PATCH] save and restore Generic MIDI threshold/smoothing value --- .../generic_midi/generic_midi_control_protocol.cc | 10 ++++++++++ libs/surfaces/generic_midi/gmcp_gui.cc | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index b524e2f2a0..6da0192a8f 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -472,6 +472,8 @@ GenericMidiControlProtocol::get_state () node->add_property (X_("feedback"), do_feedback ? "1" : "0"); snprintf (buf, sizeof (buf), "%" PRIu64, _feedback_interval); node->add_property (X_("feedback_interval"), buf); + snprintf (buf, sizeof (buf), "%d", _threshold); + node->add_property (X_("threshold"), buf); if (!_current_binding.empty()) { node->add_property ("binding", _current_binding); @@ -518,6 +520,14 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version) _feedback_interval = 10000; } + if ((prop = node.property ("threshold")) != 0) { + if (sscanf (prop->value().c_str(), "%d", &_threshold) != 1) { + _threshold = 10; + } + } else { + _threshold = 10; + } + boost::shared_ptr c; { diff --git a/libs/surfaces/generic_midi/gmcp_gui.cc b/libs/surfaces/generic_midi/gmcp_gui.cc index e56ea62424..6c1ee1ba3d 100644 --- a/libs/surfaces/generic_midi/gmcp_gui.cc +++ b/libs/surfaces/generic_midi/gmcp_gui.cc @@ -90,7 +90,7 @@ GMCPGUI::GMCPGUI (GenericMidiControlProtocol& p) , bank_adjustment (1, 1, 100, 1, 10) , bank_spinner (bank_adjustment) , motorised_button ("Motorised") - , threshold_adjustment (1, 1, 127, 1, 10) + , threshold_adjustment (p.threshold(), 1, 127, 1, 10) , threshold_spinner (threshold_adjustment) { vector popdowns;