From 337b420266cc1a3dd476f9997caeb107407dd86c Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 11 Apr 2012 16:31:23 +0000 Subject: [PATCH] MCP: rename raw_id() to id(); add missign modifier_state() function git-svn-id: svn://localhost/ardour2/branches/3.0@11907 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/mackie/controls.cc | 2 +- libs/surfaces/mackie/controls.h | 8 +--- libs/surfaces/mackie/fader.cc | 2 +- libs/surfaces/mackie/led.cc | 2 +- .../mackie/mackie_control_protocol.cc | 4 +- .../surfaces/mackie/mackie_control_protocol.h | 2 +- libs/surfaces/mackie/meter.cc | 8 ++-- libs/surfaces/mackie/pot.cc | 2 +- libs/surfaces/mackie/strip.cc | 48 +++++++++---------- libs/surfaces/mackie/surface.cc | 4 +- 10 files changed, 38 insertions(+), 44 deletions(-) diff --git a/libs/surfaces/mackie/controls.cc b/libs/surfaces/mackie/controls.cc index 6c9fb559f4..9b546f00cf 100644 --- a/libs/surfaces/mackie/controls.cc +++ b/libs/surfaces/mackie/controls.cc @@ -73,7 +73,7 @@ ostream & Mackie::operator << (ostream & os, const Mackie::Control & control) os << " { "; os << "name: " << control.name(); os << ", "; - os << "raw_id: " << "0x" << setw(2) << setfill('0') << hex << control.raw_id() << setfill(' '); + os << "id: " << "0x" << setw(2) << setfill('0') << hex << control.id() << setfill(' '); os << ", "; os << "group: " << control.group().name(); os << " }"; diff --git a/libs/surfaces/mackie/controls.h b/libs/surfaces/mackie/controls.h index e3fe7ca131..546bd8bd25 100644 --- a/libs/surfaces/mackie/controls.h +++ b/libs/surfaces/mackie/controls.h @@ -43,16 +43,10 @@ public: Control (int id, std::string name, Group& group); virtual ~Control() {} - /// the value of the second bytes of the message. It's - /// the id of the control, but only guaranteed to be - /// unique within the control type. - int raw_id() const { return _id; } - + int id() const { return _id; } const std::string & name() const { return _name; } Group & group() const { return _group; } - virtual bool accepts_feedback() const { return true; } - bool in_use () const; void set_in_use (bool); diff --git a/libs/surfaces/mackie/fader.cc b/libs/surfaces/mackie/fader.cc index 9a44f8ef9b..bcb8f73ca6 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, 0xe0 | raw_id(), posi & 0x7f, posi >> 7); + return MidiByteArray (3, 0xe0 | id(), posi & 0x7f, posi >> 7); } diff --git a/libs/surfaces/mackie/led.cc b/libs/surfaces/mackie/led.cc index 8dc1d626cc..43628e92bf 100644 --- a/libs/surfaces/mackie/led.cc +++ b/libs/surfaces/mackie/led.cc @@ -55,5 +55,5 @@ Led::set_state (LedState new_state) return MidiByteArray (); } - return MidiByteArray (3, 0x90, raw_id(), msg); + return MidiByteArray (3, 0x90, id(), msg); } diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 20f07e6175..d8c89ff37e 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -955,9 +955,9 @@ MackieControlProtocol::handle_button_event (Surface& surface, Button& button, Bu return; } - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2\n", (bs == press ? "press" : "release"), button.raw_id())); + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Handling %1 for button %2\n", (bs == press ? "press" : "release"), button.id())); - ButtonMap::iterator b = button_map.find (button.raw_id()); + ButtonMap::iterator b = button_map.find (button.id()); if (b != button_map.end()) { diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h index c89bfa2c10..a93159f36c 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.h +++ b/libs/surfaces/mackie/mackie_control_protocol.h @@ -285,7 +285,7 @@ class MackieControlProtocol void add_in_use_timeout (Mackie::Surface& surface, Mackie::Control& in_use_control, Mackie::Control* touch_control); - int modifier_state(); + int modifier_state() const { return _modifier_state; } protected: // shut down the surface diff --git a/libs/surfaces/mackie/meter.cc b/libs/surfaces/mackie/meter.cc index 03c0f1aa30..a4824d3612 100644 --- a/libs/surfaces/mackie/meter.cc +++ b/libs/surfaces/mackie/meter.cc @@ -45,7 +45,7 @@ Meter::update_message (float dB) { float def = 0.0f; /* Meter deflection %age */ - // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", raw_id(), dB)); + // DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Meter ID %1 dB %2\n", id(), dB)); if (dB < -70.0f) { def = 0.0f; @@ -75,12 +75,12 @@ Meter::update_message (float dB) if (def > 100.0f) { if (!overload_on) { overload_on = true; - msg << MidiByteArray (2, 0xd0, (raw_id() << 4) | 0xe); + msg << MidiByteArray (2, 0xd0, (id() << 4) | 0xe); } } else { if (overload_on) { overload_on = false; - msg << MidiByteArray (2, 0xd0, (raw_id() << 4) | 0xf); + msg << MidiByteArray (2, 0xd0, (id() << 4) | 0xf); } } @@ -90,7 +90,7 @@ Meter::update_message (float dB) if (last_segment_value_sent != segment) { last_segment_value_sent = segment; - msg << MidiByteArray (2, 0xD0, (raw_id()<<4) | segment); + msg << MidiByteArray (2, 0xD0, (id()<<4) | segment); } return msg; diff --git a/libs/surfaces/mackie/pot.cc b/libs/surfaces/mackie/pot.cc index 67fcb65ef9..3b8e8b65a5 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, raw_id(), msg); + return MidiByteArray (3, 0xb0, id(), msg); } diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index b8327b82c1..268e77d82c 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -107,33 +107,33 @@ void Strip::add (Control & control) } else if ((button = dynamic_cast(&control)) != 0) { - if (control.raw_id() >= Button::recenable_base_id && - control.raw_id() < Button::recenable_base_id + 8) { + if (control.id() >= Button::recenable_base_id && + control.id() < Button::recenable_base_id + 8) { _recenable = button; - } else if (control.raw_id() >= Button::mute_base_id && - control.raw_id() < Button::mute_base_id + 8) { + } else if (control.id() >= Button::mute_base_id && + control.id() < Button::mute_base_id + 8) { _mute = button; - } else if (control.raw_id() >= Button::solo_base_id && - control.raw_id() < Button::solo_base_id + 8) { + } else if (control.id() >= Button::solo_base_id && + control.id() < Button::solo_base_id + 8) { _solo = button; - } else if (control.raw_id() >= Button::select_base_id && - control.raw_id() < Button::select_base_id + 8) { + } else if (control.id() >= Button::select_base_id && + control.id() < Button::select_base_id + 8) { _select = button; - } else if (control.raw_id() >= Button::vselect_base_id && - control.raw_id() < Button::vselect_base_id + 8) { + } else if (control.id() >= Button::vselect_base_id && + control.id() < Button::vselect_base_id + 8) { _vselect = button; - } else if (control.raw_id() >= Button::fader_touch_base_id && - control.raw_id() < Button::fader_touch_base_id + 8) { + } else if (control.id() >= Button::fader_touch_base_id && + control.id() < Button::fader_touch_base_id + 8) { _fader_touch = button; } @@ -445,34 +445,34 @@ Strip::handle_button (Button& button, ButtonState bs) } if (bs == press) { - if (button.raw_id() >= Button::recenable_base_id && - button.raw_id() < Button::recenable_base_id + 8) { + if (button.id() >= Button::recenable_base_id && + button.id() < Button::recenable_base_id + 8) { _route->set_record_enabled (!_route->record_enabled(), this); - } else if (button.raw_id() >= Button::mute_base_id && - button.raw_id() < Button::mute_base_id + 8) { + } else if (button.id() >= Button::mute_base_id && + button.id() < Button::mute_base_id + 8) { _route->set_mute (!_route->muted(), this); - } else if (button.raw_id() >= Button::solo_base_id && - button.raw_id() < Button::solo_base_id + 8) { + } else if (button.id() >= Button::solo_base_id && + button.id() < Button::solo_base_id + 8) { _route->set_solo (!_route->soloed(), this); - } else if (button.raw_id() >= Button::select_base_id && - button.raw_id() < Button::select_base_id + 8) { + } else if (button.id() >= Button::select_base_id && + button.id() < Button::select_base_id + 8) { _surface->mcp().select_track (_route); - } else if (button.raw_id() >= Button::vselect_base_id && - button.raw_id() < Button::vselect_base_id + 8) { + } else if (button.id() >= Button::vselect_base_id && + button.id() < Button::vselect_base_id + 8) { } } - if (button.raw_id() >= Button::fader_touch_base_id && - button.raw_id() < Button::fader_touch_base_id + 8) { + if (button.id() >= Button::fader_touch_base_id && + button.id() < Button::fader_touch_base_id + 8) { DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader touch, press ? %1\n", (bs == press))); diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 8600d34be7..0dab9d87ad 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -374,7 +374,7 @@ Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev) strip->handle_button (*button, ev->velocity == 0x7f ? press : release); } else { /* global button */ - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("global button %1\n", button->raw_id())); + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("global button %1\n", button->id())); _mcp.handle_button_event (*this, *button, ev->velocity == 0x7f ? press : release); } } else { @@ -497,7 +497,7 @@ Surface::zero_all () for (Controls::iterator it = controls.begin(); it != controls.end(); ++it) { Control & control = **it; - if (!control.group().is_strip() && control.accepts_feedback()) { + if (!control.group().is_strip()) { _port->write (control.zero()); } }