diff options
author | Carl Hetherington <carl@carlh.net> | 2010-07-07 00:40:58 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-07-07 00:40:58 +0000 |
commit | ea23298f10e9587eba483cb54a6f7d75ca68126a (patch) | |
tree | bdd396ac05d0be01cbbcc6447844a04814e79cbf /libs/surfaces | |
parent | 6cccf3ce7dc86998d6797f393bec5b69610fc5f3 (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/surfaces')
-rw-r--r-- | libs/surfaces/generic_midi/generic_midi_control_protocol.cc | 31 | ||||
-rw-r--r-- | libs/surfaces/generic_midi/generic_midi_control_protocol.h | 6 | ||||
-rw-r--r-- | libs/surfaces/mackie/interface.cc | 39 |
3 files changed, 24 insertions, 52 deletions
diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc index 62cc93263b..de7c00171b 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.cc +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.cc @@ -30,7 +30,6 @@ #include "pbd/xml++.h" #include "midi++/port.h" -#include "midi++/manager.h" #include "ardour/filesystem_paths.h" #include "ardour/session.h" @@ -57,20 +56,8 @@ GenericMidiControlProtocol::GenericMidiControlProtocol (Session& s) , gui (0) { - MIDI::Manager* mm = MIDI::Manager::instance(); - - /* XXX it might be nice to run "control" through i18n, but thats a bit tricky because - the name is defined in ardour.rc which is likely not internationalized. - */ - - _port = mm->port (Config->get_midi_port_name()); - - if (_port == 0) { - error << string_compose (_("no MIDI port named \"%1\" exists - generic MIDI control disabled"), - Config->get_midi_port_name()) - << endmsg; - throw failed_constructor(); - } + _input_port = s.midi_input_port (); + _output_port = s.midi_output_port (); do_feedback = false; _feedback_interval = 10000; // microseconds @@ -274,7 +261,7 @@ GenericMidiControlProtocol::_send_feedback () return; } - _port->write (buf, (int32_t) (end - buf), 0); + _output_port->write (buf, (int32_t) (end - buf), 0); } bool @@ -324,7 +311,7 @@ GenericMidiControlProtocol::start_learning (Controllable* c) } if (!mc) { - mc = new MIDIControllable (*_port, *c, false); + mc = new MIDIControllable (*_input_port, *c, false); } { @@ -421,7 +408,7 @@ GenericMidiControlProtocol::create_binding (PBD::Controllable* control, int pos, MIDI::byte value = control_number; // Create a MIDIControllable - MIDIControllable* mc = new MIDIControllable (*_port, *control, false); + MIDIControllable* mc = new MIDIControllable (*_input_port, *control, false); // Remove any old binding for this midi channel/type/value pair // Note: can't use delete_binding() here because we don't know the specific controllable we want to remove, only the midi information @@ -533,7 +520,7 @@ GenericMidiControlProtocol::set_state (const XMLNode& node, int version) c = session->controllable_by_id (id); if (c) { - MIDIControllable* mc = new MIDIControllable (*_port, *c, false); + MIDIControllable* mc = new MIDIControllable (*_input_port, *c, false); if (mc->set_state (**niter, version) == 0) { controllables.push_back (mc); @@ -715,7 +702,7 @@ GenericMidiControlProtocol::create_binding (const XMLNode& node) prop = node.property (X_("uri")); uri = prop->value(); - MIDIControllable* mc = new MIDIControllable (*_port, momentary); + MIDIControllable* mc = new MIDIControllable (*_input_port, momentary); if (mc->init (uri)) { delete mc; @@ -832,7 +819,7 @@ GenericMidiControlProtocol::create_function (const XMLNode& node) prop = node.property (X_("function")); - MIDIFunction* mf = new MIDIFunction (*_port); + MIDIFunction* mf = new MIDIFunction (*_input_port); if (mf->init (*this, prop->value(), data, data_size)) { delete mf; @@ -928,7 +915,7 @@ GenericMidiControlProtocol::create_action (const XMLNode& node) prop = node.property (X_("action")); - MIDIAction* ma = new MIDIAction (*_port); + MIDIAction* ma = new MIDIAction (*_input_port); if (ma->init (*this, prop->value(), data, data_size)) { delete ma; diff --git a/libs/surfaces/generic_midi/generic_midi_control_protocol.h b/libs/surfaces/generic_midi/generic_midi_control_protocol.h index 1ad2c681d4..7ad23d9373 100644 --- a/libs/surfaces/generic_midi/generic_midi_control_protocol.h +++ b/libs/surfaces/generic_midi/generic_midi_control_protocol.h @@ -50,7 +50,8 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol { int set_active (bool yn); static bool probe() { return true; } - MIDI::Port* port () const { return _port; } + MIDI::Port* input_port () const { return _input_port; } + MIDI::Port* output_port () const { return _output_port; } void set_feedback_interval (ARDOUR::microseconds_t); int set_feedback (bool yn); @@ -81,7 +82,8 @@ class GenericMidiControlProtocol : public ARDOUR::ControlProtocol { void prev_bank (); private: - MIDI::Port* _port; + MIDI::Port* _input_port; + MIDI::Port* _output_port; ARDOUR::microseconds_t _feedback_interval; ARDOUR::microseconds_t last_feedback_time; diff --git a/libs/surfaces/mackie/interface.cc b/libs/surfaces/mackie/interface.cc index 067941484c..d3625cac51 100644 --- a/libs/surfaces/mackie/interface.cc +++ b/libs/surfaces/mackie/interface.cc @@ -31,36 +31,19 @@ using namespace std; ControlProtocol* new_mackie_protocol (ControlProtocolDescriptor*, Session* s) { - if ( Config->get_mmc_port_name().substr(0,3) == "mcu" ) - { - error << "mcu already used as mmc port" << endmsg; - } - else if ( Config->get_mtc_port_name().substr(0,3) == "mcu" ) - { - error << "mcu already used as mtc port" << endmsg; - } - else if ( Config->get_midi_port_name().substr(0,3) == "mcu" ) - { - error << "mcu already used as midi port" << endmsg; + MackieControlProtocol* mcp = 0; + + try { + mcp = new MackieControlProtocol (*s); + mcp->set_active (true); } - else - { - // no one else is using the port, so try instantiate the object - MackieControlProtocol * mcp = 0; - try - { - mcp = new MackieControlProtocol (*s); - mcp->set_active( true ); - } - catch( exception & e ) - { - error << "Error instantiating MackieControlProtocol: " << e.what() << endmsg; - delete mcp; - mcp = 0; - } - return mcp; + catch (exception & e) { + error << "Error instantiating MackieControlProtocol: " << e.what() << endmsg; + delete mcp; + mcp = 0; } - return 0; + + return mcp; } void |