diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-09-12 11:28:50 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-09-12 11:28:50 -0400 |
commit | bb826f4beebfcedc50570b818c305560d2233e47 (patch) | |
tree | 1484460f914e64fdbdce58230ffe7934bc0761f4 /libs/midi++2/midi++ | |
parent | 8c5cff60912c7e0a7256f635641399500d8d00d9 (diff) | |
parent | f85b362351a5f9167f93b6988f2c8a4c7e03a33c (diff) |
incomplete merge of master into windows (requires upcoming changes to master to be complete)
Diffstat (limited to 'libs/midi++2/midi++')
-rw-r--r-- | libs/midi++2/midi++/jack_midi_port.h | 111 | ||||
-rw-r--r-- | libs/midi++2/midi++/manager.h | 103 | ||||
-rw-r--r-- | libs/midi++2/midi++/mmc.h | 11 | ||||
-rw-r--r-- | libs/midi++2/midi++/parser.h | 4 | ||||
-rw-r--r-- | libs/midi++2/midi++/port.h | 7 |
5 files changed, 10 insertions, 226 deletions
diff --git a/libs/midi++2/midi++/jack_midi_port.h b/libs/midi++2/midi++/jack_midi_port.h deleted file mode 100644 index 284df0ef2d..0000000000 --- a/libs/midi++2/midi++/jack_midi_port.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (C) 1998-2010 Paul Barton-Davis - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __libmidi_port_h__ -#define __libmidi_port_h__ - -#include <string> -#include <iostream> - -#include <jack/types.h> - -#include "pbd/xml++.h" -#include "pbd/crossthread.h" -#include "pbd/signals.h" -#include "pbd/ringbuffer.h" - -#include "evoral/Event.hpp" -#include "evoral/EventRingBuffer.hpp" - -#include "midi++/types.h" -#include "midi++/parser.h" -#include "midi++/port.h" - -namespace MIDI { - -class Channel; -class PortRequest; - -class JackMIDIPort : public Port { - public: - JackMIDIPort (std::string const &, Port::Flags, jack_client_t *); - JackMIDIPort (const XMLNode&, jack_client_t *); - ~JackMIDIPort (); - - XMLNode& get_state () const; - void set_state (const XMLNode&); - - void cycle_start (pframes_t nframes); - void cycle_end (); - - void parse (framecnt_t timestamp); - int write (const byte *msg, size_t msglen, timestamp_t timestamp); - int read (byte *buf, size_t bufsize); - void drain (int check_interval_usecs); - int selectable () const { -#ifdef PLATFORM_WINDOWS - return false; -#else - return xthread.selectable(); -#endif - } - - pframes_t nframes_this_cycle() const { return _nframes_this_cycle; } - - void reestablish (jack_client_t *); - void reconnect (); - - static void set_process_thread (pthread_t); - static pthread_t get_process_thread () { return _process_thread; } - static bool is_process_thread(); - - static PBD::Signal0<void> MakeConnections; - static PBD::Signal0<void> JackHalted; - -private: - bool _currently_in_cycle; - pframes_t _nframes_this_cycle; - jack_client_t* _jack_client; - jack_port_t* _jack_port; - timestamp_t _last_write_timestamp; - RingBuffer< Evoral::Event<double> > output_fifo; - Evoral::EventRingBuffer<timestamp_t> input_fifo; - Glib::Threads::Mutex output_fifo_lock; -#ifndef PLATFORM_WINDOWS - CrossThreadChannel xthread; -#endif - - int create_port (); - - /** Channel used to signal to the MidiControlUI that input has arrived */ - - std::string _connections; - PBD::ScopedConnection connect_connection; - PBD::ScopedConnection halt_connection; - void flush (void* jack_port_buffer); - void jack_halted (); - void make_connections (); - void init (std::string const &, Flags); - - static pthread_t _process_thread; - -}; - -} // namespace MIDI - -#endif // __libmidi_port_h__ diff --git a/libs/midi++2/midi++/manager.h b/libs/midi++2/midi++/manager.h deleted file mode 100644 index c37ba392b4..0000000000 --- a/libs/midi++2/midi++/manager.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) 1998 Paul Barton-Davis - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -*/ - -#ifndef __midi_manager_h__ -#define __midi_manager_h__ - -#include <list> - -#include <string> - -#include "pbd/rcu.h" - -#include "midi++/types.h" -#include "midi++/port.h" - -namespace MIDI { - -class MachineControl; - -class Manager { - public: - ~Manager (); - - /** Signal the start of an audio cycle. - * This MUST be called before any reading/writing for this cycle. - * Realtime safe. - */ - void cycle_start (pframes_t nframes); - - /** Signal the end of an audio cycle. - * This signifies that the cycle began with @ref cycle_start has ended. - * This MUST be called at the end of each cycle. - * Realtime safe. - */ - void cycle_end (); - - MachineControl* mmc () const { return _mmc; } - Port *mtc_input_port() const { return _mtc_input_port; } - Port *mtc_output_port() const { return _mtc_output_port; } - Port *midi_input_port() const { return _midi_input_port; } - Port *midi_output_port() const { return _midi_output_port; } - Port *midi_clock_input_port() const { return _midi_clock_input_port; } - Port *midi_clock_output_port() const { return _midi_clock_output_port; } - - Port* add_port (Port *); - void remove_port (Port *); - - Port* port (std::string const &); - - void set_port_states (std::list<XMLNode*>); - - typedef std::list<Port *> PortList; - - boost::shared_ptr<const PortList> get_midi_ports() const { return _ports.reader (); } - - static void create (jack_client_t* jack); - - static Manager *instance () { - return theManager; - } - static void destroy (); - - void reestablish (jack_client_t *); - void reconnect (); - - PBD::Signal0<void> PortsChanged; - - private: - /* This is a SINGLETON pattern */ - - Manager (jack_client_t *); - static Manager *theManager; - - MIDI::MachineControl* _mmc; - MIDI::Port* _mtc_input_port; - MIDI::Port* _mtc_output_port; - MIDI::Port* _midi_input_port; - MIDI::Port* _midi_output_port; - MIDI::Port* _midi_clock_input_port; - MIDI::Port* _midi_clock_output_port; - - SerializedRCUManager<PortList> _ports; -}; - -} // namespace MIDI - -#endif // __midi_manager_h__ diff --git a/libs/midi++2/midi++/mmc.h b/libs/midi++2/midi++/mmc.h index 18204e3fa8..01f8bf3b8a 100644 --- a/libs/midi++2/midi++/mmc.h +++ b/libs/midi++2/midi++/mmc.h @@ -22,17 +22,22 @@ #include <jack/types.h> #include "timecode/time.h" + #include "pbd/signals.h" #include "pbd/ringbuffer.h" + #include "midi++/types.h" #include "midi++/parser.h" +namespace ARDOUR { + class PortEngine; +} + namespace MIDI { class Port; class Parser; class MachineControlCommand; -class Manager; /** Class to handle incoming and outgoing MIDI machine control messages */ class MachineControl @@ -89,7 +94,9 @@ class MachineControl cmdResume = 0x7F }; - MachineControl (Manager *, jack_client_t *); + MachineControl (); + + void set_ports (MIDI::Port* input, MIDI::Port* output); Port* input_port() { return _input_port; } Port* output_port() { return _output_port; } diff --git a/libs/midi++2/midi++/parser.h b/libs/midi++2/midi++/parser.h index f5f343e952..44897f9d8e 100644 --- a/libs/midi++2/midi++/parser.h +++ b/libs/midi++2/midi++/parser.h @@ -41,7 +41,7 @@ typedef PBD::Signal3<void,Parser &, byte *, size_t> Signal; class Parser { public: - Parser (Port &p); + Parser (); ~Parser (); /* sets the time that will be reported for any MTC or MIDI Clock @@ -105,7 +105,6 @@ class Parser { const char *midi_event_type_name (MIDI::eventType); void trace (bool onoff, std::ostream *o, const std::string &prefix = ""); bool tracing() { return trace_stream != 0; } - Port &port() { return _port; } void set_offline (bool); bool offline() const { return _offline; } @@ -136,7 +135,6 @@ class Parser { void reset_mtc_state (); private: - Port&_port; /* tracing */ std::ostream *trace_stream; diff --git a/libs/midi++2/midi++/port.h b/libs/midi++2/midi++/port.h index 153cfb0529..a915320fa3 100644 --- a/libs/midi++2/midi++/port.h +++ b/libs/midi++2/midi++/port.h @@ -55,13 +55,6 @@ class Port { virtual XMLNode& get_state () const; virtual void set_state (const XMLNode&); - // FIXME: make Manager a friend of port so these can be hidden? - - /* Only for use by MidiManager. Don't ever call this. */ - virtual void cycle_start (pframes_t) {} - /* Only for use by MidiManager. Don't ever call this. */ - virtual void cycle_end () {} - /** Write a message to port. * @param msg Raw MIDI message to send * @param msglen Size of @a msg |