From 5ee1aaf8d0ad2b08398ed51aa21466877dbbb32d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 12 Apr 2012 18:16:16 +0000 Subject: [PATCH] MCP: rename ports again, remove ports from MCP bundles, wakeup devices git-svn-id: svn://localhost/ardour2/branches/3.0@11947 d708f5d6-7413-0410-9779-e7cbd77b26cf --- .../mackie/mackie_control_protocol.cc | 19 +++++++++++++++++-- libs/surfaces/mackie/surface.cc | 11 +++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 490e7eef20..70c13df9d8 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -517,8 +517,15 @@ MackieControlProtocol::set_device (const string& device_name) void MackieControlProtocol::create_surfaces () { - string device_name = X_("MC Main"); + string device_name; surface_type_t stype = mcu; + char buf[128]; + + if (_device_info.extenders() == 0) { + device_name = X_("mackie control"); + } else { + device_name = X_("mackie control #1"); + } DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Create %1 surfaces\n", 1 + _device_info.extenders())); @@ -529,7 +536,12 @@ MackieControlProtocol::create_surfaces () /* next device will be an extender */ - device_name = X_("MC Extender"); + if (_device_info.extenders() < 2) { + device_name = X_("mackie control #2"); + } else { + snprintf (buf, sizeof (buf), X_("mackie control #%d"), n+2); + device_name = buf; + } stype = ext; _input_bundle->add_channel ( @@ -1087,6 +1099,9 @@ MackieControlProtocol::midi_input_handler (IOCondition ioc, MIDI::Port* port) void MackieControlProtocol::clear_ports () { + _input_bundle->remove_channels (); + _output_bundle->remove_channels (); + for (PortSources::iterator i = port_sources.begin(); i != port_sources.end(); ++i) { g_source_destroy (*i); g_source_unref (*i); diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 91162c7962..9fecc2556e 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -154,6 +154,17 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui connect_to_signals (); + /* wakey wakey */ + + MidiByteArray wakeup (7, MIDI::sysex, 0x00, 0x00, 0x66, 0x14, 0x00, MIDI::eox); + _port->write (wakeup); + wakeup[4] = 0x15; /* wakup Mackie XT */ + _port->write (wakeup); + wakeup[4] = 0x10; /* wakupe Logic Control */ + _port->write (wakeup); + wakeup[4] = 0x11; /* wakeup Logic Control XT */ + _port->write (wakeup); + DEBUG_TRACE (DEBUG::MackieControl, "Surface::init finish\n"); }