summaryrefslogtreecommitdiff
path: root/libs/midi++2/mmc.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-07 00:40:58 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-07 00:40:58 +0000
commitea23298f10e9587eba483cb54a6f7d75ca68126a (patch)
treebdd396ac05d0be01cbbcc6447844a04814e79cbf /libs/midi++2/mmc.cc
parent6cccf3ce7dc86998d6797f393bec5b69610fc5f3 (diff)
Setup fixed ports for MIDI control data; hence remove configuration of those ports. Move MIDI tracer to the Windows menu. Trim some unused code from the midi++ Manager.
git-svn-id: svn://localhost/ardour2/branches/3.0@7384 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2/mmc.cc')
-rw-r--r--libs/midi++2/mmc.cc30
1 files changed, 11 insertions, 19 deletions
diff --git a/libs/midi++2/mmc.cc b/libs/midi++2/mmc.cc
index 597904d293..406fd0ef19 100644
--- a/libs/midi++2/mmc.cc
+++ b/libs/midi++2/mmc.cc
@@ -18,6 +18,7 @@
$Id$
*/
+#include <fcntl.h>
#include <map>
#include "control_protocol/timecode.h"
@@ -25,6 +26,7 @@
#include "midi++/mmc.h"
#include "midi++/port.h"
#include "midi++/parser.h"
+#include "midi++/manager.h"
using namespace std;
using namespace MIDI;
@@ -193,30 +195,20 @@ static void build_mmc_cmd_map ()
}
-MachineControl::MachineControl ()
- : _port (0)
+MachineControl::MachineControl (jack_client_t* jack)
{
build_mmc_cmd_map ();
_receive_device_id = 0;
_send_device_id = 0x7f;
-}
-
-void
-MachineControl::set_port (Port* p)
-{
- _port = p;
- port_connections.drop_connections ();
+ _input_port = Manager::instance()->add_port (new Port ("MMC", O_RDONLY, jack));
+ _output_port = Manager::instance()->add_port (new Port ("MMC", O_WRONLY, jack));
- if (_port->input()) {
- _port->input()->mmc.connect_same_thread (port_connections, boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
- _port->input()->start.connect_same_thread (port_connections, boost::bind (&MachineControl::spp_start, this, _1, _2));
- _port->input()->contineu.connect_same_thread (port_connections, boost::bind (&MachineControl::spp_continue, this, _1, _2));
- _port->input()->stop.connect_same_thread (port_connections, boost::bind (&MachineControl::spp_stop, this, _1, _2));
- } else {
- warning << "MMC connected to a non-input port: useless!" << endmsg;
- }
+ _input_port->input()->mmc.connect_same_thread (port_connections, boost::bind (&MachineControl::process_mmc_message, this, _1, _2, _3));
+ _input_port->input()->start.connect_same_thread (port_connections, boost::bind (&MachineControl::spp_start, this, _1, _2));
+ _input_port->input()->contineu.connect_same_thread (port_connections, boost::bind (&MachineControl::spp_continue, this, _1, _2));
+ _input_port->input()->stop.connect_same_thread (port_connections, boost::bind (&MachineControl::spp_stop, this, _1, _2));
}
void
@@ -643,7 +635,7 @@ MachineControl::enable_send (bool yn)
void
MachineControl::send (MachineControlCommand const & c)
{
- if (_port == 0 || !_enable_send) {
+ if (_output_port == 0 || !_enable_send) {
// cerr << "Not delivering MMC " << _mmc->port() << " - " << session_send_mmc << endl;
return;
}
@@ -651,7 +643,7 @@ MachineControl::send (MachineControlCommand const & c)
MIDI::byte buffer[32];
MIDI::byte* b = c.fill_buffer (this, buffer);
- if (_port->midimsg (buffer, b - buffer, 0)) {
+ if (_output_port->midimsg (buffer, b - buffer, 0)) {
error << "MMC: cannot send command" << endmsg;
}
}