if (_current_initial_bank <= sorted.size()) {
- DEBUG_TRACE (DEBUG::MackieControl, string_compose ("switch to %1, %2, available routes %3\n", _current_initial_bank, strip_cnt, sorted.size()));
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("switch to %1, %2, available routes %3 on %4 surfaces\n",
+ _current_initial_bank, strip_cnt, sorted.size(),
+ surfaces.size()));
// link routes to strips
}
}
+void
+MackieControlProtocol::device_ready ()
+{
+ /* this is not required to be called, but for devices which do
+ * handshaking, it can be called once the device has verified the
+ * connection.
+ */
+
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("device ready init (active=%1)\n", active()));
+ update_surfaces ();
+}
+
// send messages to surface to set controls to correct values
void
MackieControlProtocol::update_surfaces()
{
- DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::update_surfaces() init\n");
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("MackieControlProtocol::update_surfaces() init (active=%1)\n", active()));
if (!active()) {
return;
}
}
}
+void
+Strip::handle_fader_touch (Fader& fader, bool touch_on)
+{
+ if (touch_on) {
+ fader.start_touch (_surface->mcp().transport_frame());
+ } else {
+ fader.stop_touch (_surface->mcp().transport_frame(), false);
+ }
+}
+
void
Strip::handle_fader (Fader& fader, float position)
{
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("fader to %1\n", position));
fader.set_value (position);
- fader.start_touch (_surface->mcp().transport_frame());
queue_display_reset (2000);
// must echo bytes back to slider now, because
p->controller.connect_same_thread (*this, boost::bind (&Surface::handle_midi_controller_message, this, _1, _2));
/* Button messages are NoteOn */
p->note_on.connect_same_thread (*this, boost::bind (&Surface::handle_midi_note_on_message, this, _1, _2));
- /* Button messages are NoteOn. libmidi++ sends note-on w/velocity = 0 as note-off so catch them too */
+ /* Button messages are NoteOn but libmidi++ sends note-on w/velocity = 0 as note-off so catch them too */
p->note_off.connect_same_thread (*this, boost::bind (&Surface::handle_midi_note_on_message, this, _1, _2));
/* Fader messages are Pitchbend */
uint32_t i;
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
+ /* Pitchbend messages are fader position 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.
*
* when we connected to the per-channel pitchbend events.
*/
-
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface::handle_midi_pitchbend_message on port %3, fader = %1 value = %2\n",
fader_id, pb, _number));
turn_it_on ();
}
+ /* fader touch sense is given by "buttons" 0xe..0xe7 and 0xe8 for the
+ * master.
+ */
+
+ if (ev->note_number >= 0xE0 && ev->note_number <= 0xE8) {
+ Fader* fader = faders[ev->note_number];
+
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Surface: fader touch message, fader = %1\n", fader));
+
+ if (fader) {
+
+ Strip* strip = dynamic_cast<Strip*> (&fader->group());
+
+ if (ev->velocity > 64) {
+ strip->handle_fader_touch (*fader, true);
+ } else {
+ strip->handle_fader_touch (*fader, false);
+ }
+ }
+ return;
+ }
+
Button* button = buttons[ev->note_number];
if (button) {
LCP: Connection Challenge
*/
if (bytes[4] == 0x10 || bytes[4] == 0x11) {
+ DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device connection challenge\n");
write_sysex (host_connection_query (bytes));
} else {
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active));
if (!_active) {
turn_it_on ();
}
break;
case 0x03: /* LCP Connection Confirmation */
+ DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device confirms connection, ardour replies\n");
if (bytes[4] == 0x10 || bytes[4] == 0x11) {
write_sysex (host_connection_confirmation (bytes));
_active = true;
break;
case 0x04: /* LCP: Confirmation Denied */
+ DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n");
_active = false;
break;
default:
_active = true;
+ _mcp.device_ready ();
+
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->notify_all ();
}
vector<boost::shared_ptr<Route> >::const_iterator r;
Strips::iterator s = strips.begin();
+ DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 routes", routes.size()));
+
for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) {
/* don't try to assign routes to a locked strip. it won't