MCP: more clarification of control ID scheme
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Apr 2012 15:37:06 +0000 (15:37 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 11 Apr 2012 15:37:06 +0000 (15:37 +0000)
git-svn-id: svn://localhost/ardour2/branches/3.0@11899 d708f5d6-7413-0410-9779-e7cbd77b26cf

libs/surfaces/mackie/controls.h
libs/surfaces/mackie/fader.cc
libs/surfaces/mackie/pot.cc
libs/surfaces/mackie/surface.cc

index f946f1507dd8db863cd6e274eb332b1ba4acab5d..2ae18a7f77b342273717ea05715b3e5648e4ad0e 100644 (file)
@@ -41,7 +41,6 @@ class Control
 {
 public:
        enum base_id_t {
-               fader_base_id = 0xe0,
                pot_base_id = 0x30,
                jog_base_id = 0x3c,
                fader_touch_button_base_id = 0xe0,
index a6772427ee0b4a7ab27498d7365d9222f55d6256..9a44f8ef9bbe0607d6b81b68868dd5bd7b7a6e95 100644 (file)
@@ -45,5 +45,5 @@ MidiByteArray
 Fader::update_message ()
 {
        int posi = int (0x3fff * position);
-       return MidiByteArray  (3, fader_base_id | raw_id(), posi & 0x7f, posi >> 7);
+       return MidiByteArray  (3, 0xe0 | raw_id(), posi & 0x7f, posi >> 7);
 }
index 48c408e258bc81f5468ad2a49e5eb5ff1a6f499f..67fcb65ef9be43c3d059fb9f687cf0e38f05a2f5 100644 (file)
@@ -81,7 +81,7 @@ Pot::update_message ()
                msg +=  (lrintf (value * 10.0) + 1) & 0x0f; // 0b00001111
        }
 
-       return MidiByteArray (3, 0xb0, pot_base_id | raw_id(), msg);
+       return MidiByteArray (3, 0xb0, raw_id(), msg);
 
 }
        
index 89685aa716e4c258e76f148694ac75c42251a339..47c6054c6b735c334076c17ca5bd3b8fbf194d0b 100644 (file)
@@ -230,7 +230,7 @@ Surface::init_controls()
 }
 
 static StripControlDefinition mackie_strip_controls[] = {
-       { "gain", Control::fader_base_id, Fader::factory, },
+       { "gain", 0, Fader::factory, },
        { "vpot", Control::pot_base_id, Pot::factory, },
        { "recenable", Control::recenable_button_base_id, Button::factory, },
        { "solo", Control::solo_button_base_id, Button::factory, },
@@ -332,10 +332,18 @@ Surface::connect_to_signals ()
 void
 Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uint32_t fader_id)
 {
+       /* Pitchbend messages are fader messages. Nothing in the data we get
+        * from the MIDI::Parser conveys the fader ID, which was given by the
+        * channel ID in the status byte.
+        *
+        * Instead, we have used bind() to supply the fader-within-strip ID 
+        * when we connected to the per-channel pitchbend events.
+        */
+
        DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi pitchbend on port %3, fader = %1 value = %2\n", 
                                                           fader_id, pb, _number));
        
-       Fader* fader = faders[Control::fader_base_id | fader_id];
+       Fader* fader = faders[fader_id];
 
        if (fader) {
                Strip* strip = dynamic_cast<Strip*> (&fader->group());