2 Copyright (C) 1998 Paul Barton-Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __midi_manager_h__
21 #define __midi_manager_h__
29 #include "midi++/types.h"
30 #include "midi++/port.h"
40 /** Signal the start of an audio cycle.
41 * This MUST be called before any reading/writing for this cycle.
44 void cycle_start (pframes_t nframes);
46 /** Signal the end of an audio cycle.
47 * This signifies that the cycle began with @ref cycle_start has ended.
48 * This MUST be called at the end of each cycle.
53 MachineControl* mmc () const { return _mmc; }
54 Port *mtc_input_port() const { return _mtc_input_port; }
55 Port *mtc_output_port() const { return _mtc_output_port; }
56 Port *midi_input_port() const { return _midi_input_port; }
57 Port *midi_output_port() const { return _midi_output_port; }
58 Port *midi_clock_input_port() const { return _midi_clock_input_port; }
59 Port *midi_clock_output_port() const { return _midi_clock_output_port; }
61 Port* add_port (Port *);
62 void remove_port (Port *);
64 Port* port (std::string const &);
66 void set_port_states (std::list<XMLNode*>);
68 typedef std::list<Port *> PortList;
70 boost::shared_ptr<const PortList> get_midi_ports() const { return _ports.reader (); }
72 static void create (jack_client_t* jack);
74 static Manager *instance () {
77 static void destroy ();
79 void reestablish (jack_client_t *);
82 PBD::Signal0<void> PortsChanged;
85 /* This is a SINGLETON pattern */
87 Manager (jack_client_t *);
88 static Manager *theManager;
90 MIDI::MachineControl* _mmc;
91 MIDI::Port* _mtc_input_port;
92 MIDI::Port* _mtc_output_port;
93 MIDI::Port* _midi_input_port;
94 MIDI::Port* _midi_output_port;
95 MIDI::Port* _midi_clock_input_port;
96 MIDI::Port* _midi_clock_output_port;
98 SerializedRCUManager<PortList> _ports;
103 #endif // __midi_manager_h__