View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0004828 | ardour | features | public | 2012-04-07 10:17 | 2020-04-19 20:16 |
| Reporter | royvegard | Assigned To | cth103 | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | closed | Resolution | fixed | ||
| Target Version | 3.0 | ||||
| Summary | 0004828: [PATCH] Option to adjust MIDI controller threshold | ||||
| Description | This patch add an option to adjust the MIDI controller threshold. The adjustment is available in the Control Protocol Option dialog for the Generic MIDI Control surface. The threshold setting is only applicable to control surfaces that don't have motorised faders. The threshold value should be set as low as possible to prevent jumps when you change banks/scenes on your MIDI controller. At the same time it should be set as high as possible to prevent the MIDI controller from "loosing" its controlled value when moving faders quickly. I'm guessing that the ideal threshold value depends on both the aggressiveness of the user and on the MIDI controller hardware. | ||||
| Tags | control, faders, Midi, surfaces | ||||
|
2012-04-07 10:26
|
4828.patch (4,386 bytes)
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index bff4646..c7ee0f3 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -56,6 +56,7 @@ using namespace std;
GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
: ControlProtocol (s, _("Generic MIDI"), midi_ui_context())
, _motorised (false)
+ , _threshold (10)
, gui (0)
{
_input_port = MIDI::Manager::instance()->midi_input_port ();
@@ -628,6 +629,13 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
} else {
_motorised = false;
}
+
+ if ((prop = (*citer)->property ("threshold")) != 0) {
+ _threshold = atoi (prop->value ());
+ } else {
+ _threshold = 10;
+ }
+
}
if ((*citer)->name() == "Binding") {
@@ -992,3 +1000,9 @@ GenericMidiControlProtocol::set_motorised (bool m)
{
_motorised = m;
}
+
+void
+GenericMidiControlProtocol::set_threshold (int t)
+{
+ _threshold = t;
+}
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
index a868089..7248c83 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
@@ -87,6 +87,12 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
return _motorised;
}
+ void set_threshold (int);
+
+ int threshold () const {
+ return _threshold;
+ }
+
private:
MIDI::Port* _input_port;
MIDI::Port* _output_port;
@@ -136,6 +142,7 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
values jumping around when things are not in sync.
*/
bool _motorised;
+ int _threshold;
mutable void *gui;
void build_gui ();
diff --git a/libs/surfaces/generic_midi/gmcp_gui.cc b/libs/surfaces/generic_midi/gmcp_gui.cc
index 807e4bb..da4dd8c 100644
--- a/libs/surfaces/generic_midi/gmcp_gui.cc
+++ b/libs/surfaces/generic_midi/gmcp_gui.cc
@@ -46,10 +46,13 @@ private:
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;
@@ -86,6 +89,8 @@ 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_spinner (threshold_adjustment)
{
vector<string> popdowns;
popdowns.push_back (_("Reset All"));
@@ -140,6 +145,17 @@ GMCPGUI::GMCPGUI (GenericMidiControlProtocol& p)
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);
}
@@ -166,6 +182,7 @@ GMCPGUI::binding_changed ()
if (str == x->name) {
cp.load_bindings (x->path);
motorised_button.set_active (cp.motorised ());
+ threshold_adjustment.set_value (cp.threshold ());
break;
}
}
@@ -177,3 +194,10 @@ GMCPGUI::motorised_changed ()
{
cp.set_motorised (motorised_button.get_active ());
}
+
+void
+GMCPGUI::threshold_changed ()
+{
+ int new_threshold = threshold_adjustment.get_value();
+ cp.set_threshold (new_threshold);
+}
diff --git a/libs/surfaces/generic_midi/midicontrollable.cc b/libs/surfaces/generic_midi/midicontrollable.cc
index ec586d3..50662ab 100644
--- a/libs/surfaces/generic_midi/midicontrollable.cc
+++ b/libs/surfaces/generic_midi/midicontrollable.cc
@@ -220,7 +220,7 @@ MIDIControllable::midi_sense_controller (Parser &, EventTwoBytes *msg)
float max_value = max(last_controllable_value, new_value);
float min_value = min(last_controllable_value, new_value);
float range = max_value - min_value;
- float threshold = 10;
+ float threshold = (float) _surface->threshold ();
bool const in_sync = (
range < threshold &&
|
|
|
Applied to SVN 12716. Thanks! |
|
|
Issue has been closed automatically, by Trigger Close Plugin. Feel free to re-open with additional information if you think the issue is not resolved. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2012-04-07 10:17 | royvegard | New Issue | |
| 2012-04-07 10:26 | royvegard | File Added: 4828.patch | |
| 2012-04-07 10:27 | royvegard | Tag Attached: control | |
| 2012-04-07 10:27 | royvegard | Tag Attached: faders | |
| 2012-04-07 10:27 | royvegard | Tag Attached: Midi | |
| 2012-04-07 10:27 | royvegard | Tag Attached: surfaces | |
| 2012-04-09 23:45 | cth103 | cost | => 0.00 |
| 2012-04-09 23:45 | cth103 | Target Version | => 3.0 beta4 |
| 2012-04-09 23:45 | cth103 | Summary | Option to adjust MIDI controller threshold => [PATCH] Option to adjust MIDI controller threshold |
| 2012-05-23 15:08 | cth103 | Target Version | 3.0 beta4 => 3.0 |
| 2012-06-13 21:53 | cth103 | Note Added: 0013515 | |
| 2012-06-13 21:53 | cth103 | Status | new => resolved |
| 2012-06-13 21:53 | cth103 | Resolution | open => fixed |
| 2012-06-13 21:53 | cth103 | Assigned To | => cth103 |
| 2020-04-19 20:16 | system | Note Added: 0023036 | |
| 2020-04-19 20:16 | system | Status | resolved => closed |