2 Copyright (C) 1998-99 Paul Barton-Davis
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "ardour/audioengine.h"
21 #include "ardour/async_midi_port.h"
22 #include "ardour/midiport_manager.h"
26 using namespace ARDOUR;
32 MidiPortManager::MidiPortManager ()
36 MidiPortManager::~MidiPortManager ()
39 AudioEngine::instance()->unregister_port (_midi_in);
42 AudioEngine::instance()->unregister_port (_midi_in);
44 if (_mtc_input_port) {
45 AudioEngine::instance()->unregister_port (_mtc_input_port);
47 if (_mtc_output_port) {
48 AudioEngine::instance()->unregister_port (_mtc_output_port);
50 if (_midi_clock_input_port) {
51 AudioEngine::instance()->unregister_port (_midi_clock_input_port);
53 if (_midi_clock_output_port) {
54 AudioEngine::instance()->unregister_port (_midi_clock_output_port);
60 MidiPortManager::port (string const & n)
62 boost::shared_ptr<MidiPort> mp = boost::dynamic_pointer_cast<MidiPort> (AudioEngine::instance()->get_port_by_name (n));
67 MidiPortManager::create_ports ()
69 _midi_in = AudioEngine::instance()->register_input_port (DataType::MIDI, _("MIDI control in"), true);
70 _midi_out = AudioEngine::instance()->register_output_port (DataType::MIDI, _("MIDI control out"), true);
72 _midi_input_port = boost::dynamic_pointer_cast<AsyncMIDIPort>(_midi_in).get();
73 _midi_output_port = boost::dynamic_pointer_cast<AsyncMIDIPort>(_midi_out).get();
77 MidiPortManager::set_port_states (list<XMLNode*> s)
79 PortManager::PortList pl;
81 AudioEngine::instance()->get_ports (DataType::MIDI, pl);
83 for (list<XMLNode*>::iterator i = s.begin(); i != s.end(); ++i) {
84 for (PortManager::PortList::const_iterator j = pl.begin(); j != pl.end(); ++j) {
85 // (*j)->set_state (**i);