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 << " }";
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);
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);
}
return MidiByteArray ();
}
- return MidiByteArray (3, 0x90, raw_id(), msg);
+ return MidiByteArray (3, 0x90, id(), msg);
}
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()) {
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
{
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;
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);
}
}
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;
msg += (lrintf (value * 10.0) + 1) & 0x0f; // 0b00001111
}
- return MidiByteArray (3, 0xb0, raw_id(), msg);
+ return MidiByteArray (3, 0xb0, id(), msg);
}
} 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;
}
}
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)));
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 {
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());
}
}