GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
: ControlProtocol (s, _("Generic MIDI"))
, _motorised (false)
+ , _threshold (10)
, gui (0)
{
_input_port = MIDI::Manager::instance()->midi_input_port ();
} else {
_motorised = false;
}
+
+ if ((prop = (*citer)->property ("threshold")) != 0) {
+ _threshold = atoi (prop->value ());
+ } else {
+ _threshold = 10;
+ }
+
}
if ((*citer)->name() == "Binding") {
{
_motorised = m;
}
+
+void
+GenericMidiControlProtocol::set_threshold (int t)
+{
+ _threshold = t;
+}
Gtk::Adjustment bank_adjustment;
Gtk::SpinButton bank_spinner;
Gtk::CheckButton motorised_button;
+ Gtk::Adjustment threshold_adjustment;
+ Gtk::SpinButton threshold_spinner;
void binding_changed ();
void bank_changed ();
void motorised_changed ();
+ void threshold_changed ();
};
using namespace PBD;
, bank_adjustment (1, 1, 100, 1, 10)
, bank_spinner (bank_adjustment)
, motorised_button ("Motorised")
+ , threshold_adjustment (1, 1, 127, 1, 10)
+ , threshold_spinner (threshold_adjustment)
{
vector<string> popdowns;
popdowns.push_back (_("Reset All"));
motorised_button.show ();
+ threshold_adjustment.signal_value_changed().connect (sigc::mem_fun (*this, &GMCPGUI::threshold_changed));
+
+ label = manage (new Label (_("Threshold:")));
+ label->set_alignment (0, 0.5);
+ table->attach (*label, 0, 1, n, n + 1);
+ table->attach (threshold_spinner, 1, 2, n, n + 1);
+ ++n;
+
+ threshold_spinner.show ();
+ label->show ();
+
pack_start (*table, false, false);
+
+ binding_changed ();
}
GMCPGUI::~GMCPGUI ()
if (str == x->name) {
cp.load_bindings (x->path);
motorised_button.set_active (cp.motorised ());
+ threshold_adjustment.set_value (cp.threshold ());
break;
}
}
{
cp.set_motorised (motorised_button.get_active ());
}
+
+void
+GMCPGUI::threshold_changed ()
+{
+ cp.set_threshold (threshold_adjustment.get_value());
+}