View Issue Details

IDProjectCategoryView StatusLast Update
0006693ardourbugspublic2016-01-09 15:45
Reportertpalagyi Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
PlatformLinuxOSUbuntuOS Version15.10
Product Version4.X git (version in description) 
Summary0006693: Can not use transport controls of M-Audio Axiom 25 mkII
DescriptionFrom git, version: Ardour 4.4.332 "Discreet Music" (built from revision 4.4-332-gb842495) Intel 64 bit

Assigning transport control buttons of M-Audio Axiom 25 mkii to play/stop etc. buttons of Ardour does not work.
Steps To Reproduce- Ctrl + Middle button click on Play button in Ardour
   -> "operate controller now" widget appears
- Press play button on Midi keyboard
   -> It seems Ardour registered the key as the above mentioned widget disappears
- Push play button on Midi keyboard
   -> Nothing happens

Same behaviour for all transport control buttons on the Midi controller.
Registering fader or encoders seems working, but their behaviour is strange, sometimes they refuse working if they are moved too fast.
           
Additional InformationInvestigation showed that transport control button registration indeed succeeded, but when button was pressed on controller the code in
libs/surfaces/generic_midi/midicontrollable.cc
inside
MIDIControllable::midi_sense_controller
section

if (in_sync || _surface->motorised ()) {
     controllable->set_value (midi_to_control (new_value));
}

is where the set_value does not happen due to in_sync is always 0 when transport control buttons of the Midi controller are used. This is due to this section:

bool const in_sync = (
   range < threshold &&
   controllable->get_value() <= midi_to_control(max_value) &&
   controllable->get_value() >= midi_to_control(min_value)
);

specifically that range is 127 for the control buttons (0 - 127) but threshold is 10. Changing threshold to 300 solve the issue, transport control buttons start working.

For the moment I did this to let me use the transport controls (as a side effect the fader end encoders are working OK even with fast movements):

diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index 54bb65c..a2308f7 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -59,7 +59,7 @@ using namespace std;
 GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
        : ControlProtocol (s, _("Generic MIDI"))
        , _motorised (false)
- , _threshold (10)
+ , _threshold (threshold_default)
        , gui (0)
 {
        _input_port = s.midi_input_port ();
@@ -580,10 +580,10 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
 
        if ((prop = node.property ("threshold")) != 0) {
                if (sscanf (prop->value().c_str(), "%d", &_threshold) != 1) {
- _threshold = 10;
+ _threshold = threshold_default;
                }
        } else {
- _threshold = 10;
+ _threshold = threshold_default;
        }
 
        if ((prop = node.property ("motorized")) != 0) {
@@ -726,7 +726,7 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
                        if ((prop = (*citer)->property ("threshold")) != 0) {
                                _threshold = atoi (prop->value ());
                        } else {
- _threshold = 10;
+ _threshold = threshold_default;
                        }
 
                }
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
index f09c8e4..f4f92eb 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
@@ -101,6 +101,7 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
        }
 
   private:
+ static const int threshold_default = 300;
         MIDI::Port* _input_port;
         MIDI::Port* _output_port;
        ARDOUR::microseconds_t _feedback_interval;
TagsNo tags attached.

Activities

tpalagyi

2015-11-28 14:57

reporter  

axiom25mkii_transport_control_fix.patch (1,804 bytes)   
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
index 54bb65c..a2308f7 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc
@@ -59,7 +59,7 @@ using namespace std;
 GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s)
 	: ControlProtocol (s, _("Generic MIDI"))
 	, _motorised (false)
-	, _threshold (10)
+	, _threshold (threshold_default)
 	, gui (0)
 {
 	_input_port = s.midi_input_port ();
@@ -580,10 +580,10 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version)
 
 	if ((prop = node.property ("threshold")) != 0) {
 		if (sscanf (prop->value().c_str(), "%d", &_threshold) != 1) {
-			_threshold = 10;
+			_threshold = threshold_default;
 		}
 	} else {
-		_threshold = 10;
+		_threshold = threshold_default;
 	}
 
 	if ((prop = node.property ("motorized")) != 0) {
@@ -726,7 +726,7 @@ GenericMidiControlProtocol::load_bindings (const string& xmlpath)
 			if ((prop = (*citer)->property ("threshold")) != 0) {
 				_threshold = atoi (prop->value ());
 			} else {
-				_threshold = 10;
+				_threshold = threshold_default;
 			}
 
 		}
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
index f09c8e4..f4f92eb 100644
--- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h
+++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h
@@ -101,6 +101,7 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol {
 	}
 
   private:
+	static const int threshold_default = 300;
         MIDI::Port* _input_port;
         MIDI::Port* _output_port;
 	ARDOUR::microseconds_t _feedback_interval;

paul

2016-01-09 15:45

administrator   ~0017773

There's no way to this work correctly with the current code. Combining threshold, CC messages, toggled and non-toggled controls is not handled correctly. Your proposed fix makes toggled controls work, but breaks continuously valued controls (because the existing code is wrong).

Also, note that in C++, you cannot only define a static const member in the object definition, it has to be present in the object declaration too. Some compilers allow it, but it is not standard. Just FYI.

Issue History

Date Modified Username Field Change
2015-11-28 14:57 tpalagyi New Issue
2015-11-28 14:57 tpalagyi File Added: axiom25mkii_transport_control_fix.patch
2016-01-09 15:45 paul Note Added: 0017773