X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fmackie%2Fsurface.cc;h=ec8192f91dd33dfbe21f20c47104d81affd237f8;hb=8243aeb3a17d4bf3b7a2b7527d530c69c2161bf0;hp=e4559de794aad64b11756d7a7eabbc9ca70ee89c;hpb=5516e3bdd23248366aacd1d3d8caa08f888ac8a3;p=ardour.git diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index e4559de794..ec8192f91d 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -57,7 +57,7 @@ #include "jog.h" #include "meter.h" -#include "i18n.h" +#include "pbd/i18n.h" #ifdef PLATFORM_WINDOWS #define random() rand() @@ -65,7 +65,7 @@ using namespace std; using namespace PBD; -using ARDOUR::Route; +using ARDOUR::Stripable; using ARDOUR::Panner; using ARDOUR::Profile; using ARDOUR::AutomationControl; @@ -377,14 +377,16 @@ Surface::master_monitor_may_have_changed () void Surface::setup_master () { - boost::shared_ptr m; + boost::shared_ptr m; if ((m = _mcp.get_session().monitor_out()) == 0) { m = _mcp.get_session().master_out(); } if (!m) { - _master_fader->set_control (boost::shared_ptr()); + if (_master_fader) { + _master_fader->set_control (boost::shared_ptr()); + } master_connection.disconnect (); return; } @@ -673,8 +675,6 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count { MidiByteArray bytes (count, raw_bytes); - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes)); - if (_mcp.device_info().no_handshake()) { turn_it_on (); } @@ -691,6 +691,9 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count switch (bytes[5]) { case 0x01: + if (!_active) { + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes)); + } /* MCP: Device Ready LCP: Connection Challenge */ @@ -698,12 +701,25 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count 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) { + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mackie Control Device ready, current status = %1\n", _active)); + } turn_it_on (); } break; + case 0x06: + if (!_active) { + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes)); + } + /* Behringer X-Touch Compact: Device Ready + */ + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Behringer X-Touch Compact ready, current status = %1\n", _active)); + turn_it_on (); + break; + case 0x03: /* LCP Connection Confirmation */ + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes)); 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)); @@ -712,10 +728,14 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count break; case 0x04: /* LCP: Confirmation Denied */ + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes)); DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n"); _active = false; break; + default: + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("handle_midi_sysex: %1\n", bytes)); + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unknown device ID byte %1", (int) bytes[5])); error << "MCP: unknown sysex: " << bytes << endmsg; } } @@ -921,28 +941,29 @@ Surface::write (const MidiByteArray& data) } void -Surface::map_routes (const vector >& routes) +Surface::map_stripables (const vector >& stripables) { - vector >::const_iterator r; + vector >::const_iterator r; Strips::iterator s = strips.begin(); - DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 routes\n", routes.size())); + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Mapping %1 stripables to %2 strips\n", stripables.size(), strips.size())); - for (r = routes.begin(); r != routes.end() && s != strips.end(); ++s) { + for (r = stripables.begin(); r != stripables.end() && s != strips.end(); ++s) { - /* don't try to assign routes to a locked strip. it won't + /* don't try to assign stripables to a locked strip. it won't use it anyway, but if we do, then we get out of sync with the proposed mapping. */ if (!(*s)->locked()) { - (*s)->set_route (*r); + (*s)->set_stripable (*r); ++r; } } for (; s != strips.end(); ++s) { - (*s)->set_route (boost::shared_ptr()); + DEBUG_TRACE (DEBUG::MackieControl, string_compose ("strip %1 being set to null stripable\n", (*s)->index())); + (*s)->set_stripable (boost::shared_ptr()); } } @@ -1129,14 +1150,6 @@ Surface::update_view_mode_display (bool with_helpful_text) } } -void -Surface::gui_selection_changed (const ARDOUR::StrongRouteNotificationList& routes) -{ - for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) { - (*s)->gui_selection_changed (routes); - } -} - void Surface::say_hello () { @@ -1162,10 +1175,10 @@ Surface::set_jog_mode (JogWheel::Mode) } bool -Surface::route_is_locked_to_strip (boost::shared_ptr r) const +Surface::stripable_is_locked_to_strip (boost::shared_ptr stripable) const { for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) { - if ((*s)->route() == r && (*s)->locked()) { + if ((*s)->stripable() == stripable && (*s)->locked()) { return true; } } @@ -1173,10 +1186,10 @@ Surface::route_is_locked_to_strip (boost::shared_ptr r) const } bool -Surface::route_is_mapped (boost::shared_ptr r) const +Surface::stripable_is_mapped (boost::shared_ptr stripable) const { for (Strips::const_iterator s = strips.begin(); s != strips.end(); ++s) { - if ((*s)->route() == r) { + if ((*s)->stripable() == stripable) { return true; } }