From 1491787cfb61329cf65584893f87b708519cec8b Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Tue, 29 May 2012 23:30:13 +0000 Subject: [PATCH] MCP: fix assigment of outbound sysex messages, and don't drain port->selectable() for ipMIDI devices, since this throws away all incoming data, which arrives on the same fd as port->selectable() (unlike JACK MIDI) git-svn-id: svn://localhost/ardour2/branches/3.0@12483 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/surfaces/mackie/mackie_control_protocol.cc | 12 +++++++++++- libs/surfaces/mackie/surface.cc | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index 0fd9743a7d..61225b309a 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -1133,7 +1133,17 @@ MackieControlProtocol::midi_input_handler (IOCondition ioc, MIDI::Port* port) if (ioc & IO_IN) { - CrossThreadChannel::drain (port->selectable()); + /* Devices using regular JACK MIDI ports will need to have + the x-thread FIFO drained to avoid burning endless CPU. + + Devices using ipMIDI have port->selectable() as the same + file descriptor that data arrives on, so doing this + for them will simply throw all incoming data away. + */ + + if (!_device_info.uses_ipmidi()) { + CrossThreadChannel::drain (port->selectable()); + } DEBUG_TRACE (DEBUG::MackieControl, string_compose ("data available on %1\n", port->name())); framepos_t now = session->engine().frame_time(); diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index 0cc0f02a77..0a5ea09e3e 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -409,9 +409,9 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count */ if (_stype == mcu) { - mackie_sysex_hdr[3] = bytes[4]; + mackie_sysex_hdr[4] = bytes[4]; } else { - mackie_sysex_hdr_xt[3] = bytes[4]; + mackie_sysex_hdr_xt[4] = bytes[4]; } switch (bytes[5]) {