From 9b6c41c13435755ec092a1d2630bdaa156b85081 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 11 Apr 2012 15:37:06 +0000 Subject: [PATCH] MCP: more clarification of control ID scheme git-svn-id: svn://localhost/ardour2/branches/3.0@11899 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/mackie/controls.h | 1 - libs/surfaces/mackie/fader.cc | 2 +- libs/surfaces/mackie/pot.cc | 2 +- libs/surfaces/mackie/surface.cc | 12 ++++++++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index f946f1507d..2ae18a7f77 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -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, diff --git a/libs/surfaces/mackie/fader.cc b/libs/surfaces/mackie/fader.cc index a6772427ee..9a44f8ef9b 100644 --- a/libs/surfaces/mackie/fader.cc +++ b/libs/surfaces/mackie/fader.cc @@ -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); } diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc index 48c408e258..67fcb65ef9 100644 --- a/libs/surfaces/mackie/pot.cc +++ b/libs/surfaces/mackie/pot.cc @@ -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); } diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 89685aa716..47c6054c6b 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -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 (&fader->group());