summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie/surface.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2014-02-19 12:50:28 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2014-02-19 13:22:52 -0500
commit29b3c299a1bb037bdc2870d642bb6a23bdedabee (patch)
treea18a30ae06c52d79f73952edfad3afc8d3079713 /libs/surfaces/mackie/surface.cc
parentf6541d7addb16ca5aa4462b0094237b2bb147b77 (diff)
add a hack to deal with device discovery race, in which the devices were not actually known to be ready before the last update_surfaces() call (which is where binding between strips and routes occurs) ; add support for Mackie Control touch on/off messages
Diffstat (limited to 'libs/surfaces/mackie/surface.cc')
-rw-r--r--libs/surfaces/mackie/surface.cc35
1 files changed, 32 insertions, 3 deletions
diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc
index 694c73b1bc..09c5fff051 100644
--- a/libs/surfaces/mackie/surface.cc
+++ b/libs/surfaces/mackie/surface.cc
@@ -369,7 +369,7 @@ Surface::connect_to_signals ()
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;
@@ -386,7 +386,7 @@ 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
+ /* 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.
*
@@ -394,7 +394,6 @@ Surface::handle_midi_pitchbend_message (MIDI::Parser&, MIDI::pitchbend_t pb, uin
* 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));
@@ -429,6 +428,28 @@ Surface::handle_midi_note_on_message (MIDI::Parser &, MIDI::EventTwoBytes* ev)
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) {
@@ -516,8 +537,10 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
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 ();
}
@@ -525,6 +548,7 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
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;
@@ -532,6 +556,7 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
break;
case 0x04: /* LCP: Confirmation Denied */
+ DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n");
_active = false;
break;
default:
@@ -610,6 +635,8 @@ Surface::turn_it_on ()
_active = true;
+ _mcp.device_ready ();
+
for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
(*s)->notify_all ();
}
@@ -739,6 +766,8 @@ Surface::map_routes (const vector<boost::shared_ptr<Route> >& routes)
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