13
0

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
This commit is contained in:
Paul Davis 2012-04-11 16:31:23 +00:00
parent 8cc2f19926
commit 337b420266
10 changed files with 38 additions and 44 deletions

View File

@ -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 << " }";

View File

@ -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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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()) {

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -107,33 +107,33 @@ void Strip::add (Control & control)
} else if ((button = dynamic_cast<Button*>(&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)));

View File

@ -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());
}
}