summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_backend.h35
-rw-r--r--libs/ardour/ardour/audio_diskstream.h4
-rw-r--r--libs/ardour/ardour/audio_port.h2
-rw-r--r--libs/ardour/ardour/audioengine.h62
-rw-r--r--libs/ardour/ardour/backend_search_path.h39
-rw-r--r--libs/ardour/ardour/data_type.h27
-rw-r--r--libs/ardour/ardour/directory_names.h1
-rw-r--r--libs/ardour/ardour/jack_audiobackend.h12
-rw-r--r--libs/ardour/ardour/midi_buffer.h1
-rw-r--r--libs/ardour/ardour/midi_port.h2
-rw-r--r--libs/ardour/ardour/port.h26
-rw-r--r--libs/ardour/ardour/port_engine.h139
-rw-r--r--libs/ardour/ardour/port_manager.h60
-rw-r--r--libs/ardour/ardour/types.h19
14 files changed, 323 insertions, 106 deletions
diff --git a/libs/ardour/ardour/audio_backend.h b/libs/ardour/ardour/audio_backend.h
index 98f6c4d8a7..7ae48c4c46 100644
--- a/libs/ardour/ardour/audio_backend.h
+++ b/libs/ardour/ardour/audio_backend.h
@@ -33,16 +33,16 @@ class AudioEngine;
class AudioBackend {
public:
- enum State {
- Stopped = 0x1,
- Running = 0x2,
- Paused = 0x4,
- Freewheeling = 0x8,
- };
-
- AudioBackend (AudioEngine& e) : engine (e), _state (Stopped) {}
+ AudioBackend (AudioEngine& e) : engine (e){}
virtual ~AudioBackend () {}
+ /** Return the name of this backend.
+ *
+ * Should use a well-known, unique term. Expected examples
+ * might include "JACK", "CoreAudio", "ASIO" etc.
+ */
+ virtual std::string name() const = 0;
+
/** return true if the underlying mechanism/API is still available
* for us to utilize. return false if some or all of the AudioBackend
* API can no longer be effectively used.
@@ -261,7 +261,7 @@ class AudioBackend {
virtual TransportState transport_state () { return TransportStopped; }
/** Attempt to locate the transport to @param pos
*/
- virtual void transport_locate (framepos_t pos) {}
+ virtual void transport_locate (framepos_t /*pos*/) {}
/** Return the current transport location, in samples measured
* from the origin (defined by the transport time master)
*/
@@ -275,11 +275,11 @@ class AudioBackend {
* JACK is the only currently known audio API with the concept of a shared
* transport timebase.
*/
- virtual int set_time_master (bool yn) { return 0; }
+ virtual int set_time_master (bool /*yn*/) { return 0; }
virtual framecnt_t sample_rate () const;
virtual pframes_t samples_per_cycle () const;
- virtual int usecs_per_cycle () const { return _usecs_per_cycle; }
+ virtual int usecs_per_cycle () const { return 1000000 * (samples_per_cycle() / sample_rate()); }
virtual size_t raw_buffer_size (DataType t);
/* Process time */
@@ -326,7 +326,7 @@ class AudioBackend {
* Can ONLY be called from within a process() callback tree (which implies
* that it can only be called by a process thread)
*/
- virtual bool get_sync_offset (pframes_t& offset) const { return 0; }
+ virtual bool get_sync_offset (pframes_t& /*offset*/) const { return false; }
/** Create a new thread suitable for running part of the buffer process
* cycle (i.e. Realtime scheduling, memory allocation, etc. etc are all
@@ -338,17 +338,6 @@ class AudioBackend {
private:
AudioEngine& engine;
- State _state;
-
- std::string _target_device;
- float _target_sample_rate;
- uint32_t _target_buffer_size;
- SampleFormat _target_sample_format;
- bool _target_interleaved;
- uint32_t _target_input_channels;
- uint32_t _target_output_channels;
- uin32_t _target_systemic_input_latency;
- uin32_t _target_systemic_input_latency;
};
}
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index cbc6b93fe0..21efc5c20c 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -114,7 +114,7 @@ class AudioDiskstream : public Diskstream
XMLNode& get_state(void);
int set_state(const XMLNode& node, int version);
- void request_jack_monitors_input (bool);
+ void request_input_monitoring (bool);
static void swap_by_ptr (Sample *first, Sample *last) {
while (first < last) {
@@ -159,7 +159,7 @@ class AudioDiskstream : public Diskstream
std::string name;
bool is_physical () const;
- void request_jack_monitors_input (bool) const;
+ void request_input_monitoring (bool) const;
};
/** Information about one of our channels */
diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h
index 7f084a5c85..a473dda418 100644
--- a/libs/ardour/ardour/audio_port.h
+++ b/libs/ardour/ardour/audio_port.h
@@ -48,7 +48,7 @@ class AudioPort : public Port
protected:
friend class AudioEngine;
- AudioPort (std::string const &, Flags);
+ AudioPort (std::string const &, PortFlags);
/* special access for engine only */
Sample* engine_get_whole_audio_buffer ();
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index a3f16ff376..422e12e9d8 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -47,6 +47,7 @@
#include "ardour/session_handle.h"
#include "ardour/types.h"
#include "ardour/chan_count.h"
+#include "ardour/port_manager.h"
#ifdef HAVE_JACK_SESSION
#include <jack/session.h>
@@ -61,37 +62,60 @@ class Session;
class ProcessThread;
class AudioBackend;
-class AudioEngine : public SessionHandlePtr
+class AudioEngine : public SessionHandlePtr, public PortManager
{
public:
- typedef std::map<std::string,boost::shared_ptr<Port> > Ports;
-
- AudioEngine (std::string client_name, std::string session_uuid);
+
+ static AudioEngine* create (const std::string& client_name, const std::string& session_uuid);
+
virtual ~AudioEngine ();
- static int discover_backends();
+ int discover_backends();
std::vector<std::string> available_backends() const;
std::string current_backend_name () const;
+ int set_backend (const std::string&);
ProcessThread* main_thread() const { return _main_thread; }
std::string client_name() const { return backend_client_name; }
-
- int stop (bool forever = false);
- int start ();
- int pause ();
- int freewheel (bool onoff);
+
+ /* START BACKEND PROXY API
+ *
+ * See audio_backend.h for full documentation and semantics. These wrappers
+ * just forward to a backend implementation.
+ */
+
+ int start ();
+ int stop ();
+ int pause ();
+ int freewheel (bool start_stop);
+ float get_cpu_load() const ;
+ void transport_start ();
+ void transport_stop ();
+ TransportState transport_state ();
+ void transport_locate (framepos_t pos);
+ framepos_t transport_frame();
+ framecnt_t sample_rate () const;
+ pframes_t samples_per_cycle () const;
+ int usecs_per_cycle () const;
+ size_t raw_buffer_size (DataType t);
+ pframes_t sample_time ();
+ pframes_t sample_time_at_cycle_start ();
+ pframes_t samples_since_cycle_start ();
+ bool get_sync_offset (pframes_t& offset) const;
+ int create_process_thread (boost::function<void()> func, pthread_t*, size_t stacksize);
+
+ /* END BACKEND PROXY API */
+
bool freewheeling() const { return _freewheeling; }
-
bool running() const { return _running; }
+
Glib::Threads::Mutex& process_lock() { return _process_lock; }
int request_buffer_size (pframes_t);
framecnt_t processed_frames() const { return _processed_frames; }
- float get_cpu_load();
-
void set_session (Session *);
void remove_session (); // not a replacement for SessionHandle::session_going_away()
@@ -161,8 +185,11 @@ public:
int process_callback (pframes_t nframes);
private:
+ AudioEngine (const std::string& client_name, const std::string& session_uuid);
+
static AudioEngine* _instance;
-
+
+ AudioBackend* _backend;
Glib::Threads::Mutex _process_lock;
Glib::Threads::Cond session_removed;
bool session_remove_pending;
@@ -187,6 +214,8 @@ public:
Glib::Threads::Thread* m_meter_thread;
ProcessThread* _main_thread;
+ std::string backend_client_name;
+ std::string backend_session_uuid;
void meter_thread ();
void start_metering_thread ();
@@ -196,6 +225,11 @@ public:
void parameter_changed (const std::string&);
PBD::ScopedConnection config_connection;
+
+ typedef std::map<std::string,AudioBackend*> BackendMap;
+ BackendMap _backends;
+ AudioBackend* backend_discover (const std::string&);
+ void drop_backend ();
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/backend_search_path.h b/libs/ardour/ardour/backend_search_path.h
new file mode 100644
index 0000000000..2adc22bd6f
--- /dev/null
+++ b/libs/ardour/ardour/backend_search_path.h
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2011 Paul 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 __ardour_backend_search_path_h__
+#define __ardour_backend_search_path_h__
+
+#include "pbd/search_path.h"
+
+namespace ARDOUR {
+
+ /**
+ * return a SearchPath containing directories in which to look for
+ * backend plugins.
+ *
+ * If ARDOUR_BACKEND_PATH is defined then the SearchPath returned
+ * will contain only those directories specified in it, otherwise it will
+ * contain the user and system directories which may contain audio/MIDI
+ * backends.
+ */
+ PBD::SearchPath backend_search_path ();
+
+} // namespace ARDOUR
+
+#endif /* __ardour_backend_search_path_h__ */
diff --git a/libs/ardour/ardour/data_type.h b/libs/ardour/ardour/data_type.h
index 6a016ae75a..b4129e2629 100644
--- a/libs/ardour/ardour/data_type.h
+++ b/libs/ardour/ardour/data_type.h
@@ -21,11 +21,11 @@
#define __ardour_data_type_h__
#include <string>
-#include <jack/jack.h>
+#include <stdint.h>
+#include <glib.h>
namespace ARDOUR {
-
/** A type of Data Ardour is capable of processing.
*
* The majority of this class is dedicated to conversion to and from various
@@ -61,33 +61,25 @@ public:
/** Construct from a string (Used for loading from XML and Ports)
* The string can be as in an XML file (eg "audio" or "midi"), or a
- * Jack type string (from jack_port_type) */
+ */
DataType(const std::string& str)
: _symbol(NIL) {
- if (str == "audio" || str == JACK_DEFAULT_AUDIO_TYPE)
+ if (!g_ascii_strncasecmp(str.c_str(), "audio", str.length())) {
_symbol = AUDIO;
- else if (str == "midi" || str == JACK_DEFAULT_MIDI_TYPE)
+ } else if (!g_ascii_strncasecmp(str.c_str(), "midi", str.length())) {
_symbol = MIDI;
- }
-
- /** Get the Jack type this DataType corresponds to */
- const char* to_jack_type() const {
- switch (_symbol) {
- case AUDIO: return JACK_DEFAULT_AUDIO_TYPE;
- case MIDI: return JACK_DEFAULT_MIDI_TYPE;
- default: return "";
}
}
/** Inverse of the from-string constructor */
const char* to_string() const {
switch (_symbol) {
- case AUDIO: return "audio";
- case MIDI: return "midi";
- default: return "unknown"; // reeeally shouldn't ever happen
+ case AUDIO: return "audio";
+ case MIDI: return "midi";
+ default: return "unknown"; // reeeally shouldn't ever happen
}
}
-
+
const char* to_i18n_string () const;
inline operator uint32_t() const { return (uint32_t)_symbol; }
@@ -125,7 +117,6 @@ private:
};
-
} // namespace ARDOUR
#endif // __ardour_data_type_h__
diff --git a/libs/ardour/ardour/directory_names.h b/libs/ardour/ardour/directory_names.h
index 9f7c778d33..935cdd977b 100644
--- a/libs/ardour/ardour/directory_names.h
+++ b/libs/ardour/ardour/directory_names.h
@@ -38,6 +38,7 @@ extern const char* const route_templates_dir_name;
extern const char* const surfaces_dir_name;
extern const char* const user_config_dir_name;
extern const char* const panner_dir_name;
+extern const char* const backend_dir_name;
};
diff --git a/libs/ardour/ardour/jack_audiobackend.h b/libs/ardour/ardour/jack_audiobackend.h
index 07214ee77a..2e12d521cd 100644
--- a/libs/ardour/ardour/jack_audiobackend.h
+++ b/libs/ardour/ardour/jack_audiobackend.h
@@ -93,6 +93,18 @@ ifdef HAVE_JACK_SESSION
ChanCount n_physical (unsigned long) const;
void get_physical (DataType, unsigned long, std::vector<std::string> &);
+
+ /* pffooo */
+
+ std::string _target_device;
+ float _target_sample_rate;
+ uint32_t _target_buffer_size;
+ SampleFormat _target_sample_format;
+ bool _target_interleaved;
+ uint32_t _target_input_channels;
+ uint32_t _target_output_channels;
+ uin32_t _target_systemic_input_latency;
+ uin32_t _target_systemic_input_latency;
};
}
diff --git a/libs/ardour/ardour/midi_buffer.h b/libs/ardour/ardour/midi_buffer.h
index 5ef5e4c845..781396a598 100644
--- a/libs/ardour/ardour/midi_buffer.h
+++ b/libs/ardour/ardour/midi_buffer.h
@@ -44,7 +44,6 @@ public:
void copy(const MidiBuffer& copy);
bool push_back(const Evoral::MIDIEvent<TimeType>& event);
- bool push_back(const jack_midi_event_t& event);
bool push_back(TimeType time, size_t size, const uint8_t* data);
uint8_t* reserve(TimeType time, size_t size);
diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h
index 5dc55398cb..e14c7926fb 100644
--- a/libs/ardour/ardour/midi_port.h
+++ b/libs/ardour/ardour/midi_port.h
@@ -59,7 +59,7 @@ class MidiPort : public Port {
protected:
friend class AudioEngine;
- MidiPort (const std::string& name, Flags);
+ MidiPort (const std::string& name, PortFlags);
private:
MidiBuffer* _buffer;
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index 5afe8e2806..6186ce7748 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -30,6 +30,7 @@
#include "pbd/signals.h"
#include "ardour/data_type.h"
+#include "ardour/port_engine.h"
#include "ardour/types.h"
namespace ARDOUR {
@@ -40,11 +41,6 @@ class Buffer;
class Port : public boost::noncopyable
{
public:
- enum Flags {
- IsInput = JackPortIsInput,
- IsOutput = JackPortIsOutput,
- };
-
virtual ~Port ();
static void set_connecting_blocked( bool yn ) {
@@ -62,7 +58,7 @@ public:
int set_name (std::string const &);
/** @return flags */
- Flags flags () const {
+ PortFlags flags () const {
return _flags;
}
@@ -90,8 +86,8 @@ public:
virtual int connect (Port *);
int disconnect (Port *);
- void request_monitor_input (bool);
- void ensure_monitor_input (bool);
+ void request_input_monitoring (bool);
+ void ensure_input_monitoring (bool);
bool monitoring_input () const;
int reestablish ();
int reconnect ();
@@ -99,7 +95,7 @@ public:
bool last_monitor() const { return _last_monitor; }
void set_last_monitor (bool yn) { _last_monitor = yn; }
- jack_port_t* jack_port() const { return _jack_port; }
+ PortEngine::PortHandle port_handle() { return _port_handle; }
void get_connected_latency_range (jack_latency_range_t& range, bool playback) const;
@@ -122,8 +118,6 @@ public:
bool physically_connected () const;
- static void set_engine (AudioEngine *);
-
PBD::Signal1<void,bool> MonitorInputChanged;
static PBD::Signal2<void,boost::shared_ptr<Port>,boost::shared_ptr<Port> > PostDisconnect;
static PBD::Signal0<void> PortDrop;
@@ -143,9 +137,9 @@ public:
protected:
- Port (std::string const &, DataType, Flags);
+ Port (std::string const &, DataType, PortFlags);
- jack_port_t* _jack_port; ///< JACK port
+ PortEngine::PortHandle _port_handle;
static bool _connecting_blocked;
static pframes_t _global_port_buffer_offset; /* access only from process() tree */
@@ -156,15 +150,13 @@ protected:
jack_latency_range_t _private_playback_latency;
jack_latency_range_t _private_capture_latency;
- static AudioEngine* _engine; ///< the AudioEngine
-
private:
std::string _name; ///< port short name
- Flags _flags; ///< flags
+ PortFlags _flags; ///< flags
bool _last_monitor;
/** ports that we are connected to, kept so that we can
- reconnect to JACK when required
+ reconnect to the backend when required
*/
std::set<std::string> _connections;
diff --git a/libs/ardour/ardour/port_engine.h b/libs/ardour/ardour/port_engine.h
new file mode 100644
index 0000000000..3bea32620e
--- /dev/null
+++ b/libs/ardour/ardour/port_engine.h
@@ -0,0 +1,139 @@
+/*
+ Copyright (C) 2013 Paul 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 __libardour_port_engine_h__
+#define __libardour_port_engine_h__
+
+#include <vector>
+#include <string>
+
+#include <stdint.h>
+
+#include "ardour/data_type.h"
+#include "ardour/types.h"
+
+namespace ARDOUR {
+
+/** PortEngine is an abstract base class that defines the functionality
+ * required by Ardour.
+ *
+ * A Port is basically an endpoint for a datastream (which can either be
+ * continuous, like audio, or event-based, like MIDI). Ports have buffers
+ * associated with them into which data can be written (if they are output
+ * ports) and from which data can be read (if they input ports). Ports can be
+ * connected together so that data written to an output port can be read from
+ * an input port. These connections can be 1:1, 1:N OR N:1.
+ *
+ * Ports may be associated with software only, or with hardware. Hardware
+ * related ports are often referred to as physical, and correspond to some
+ * relevant physical entity on a hardware device, such as an audio jack or a
+ * MIDI connector. Physical ports may be potentially asked to monitor their
+ * inputs, though some implementations may not support this.
+ *
+ * Most physical ports will also be considered "terminal", which means that
+ * data delivered there or read from there will go to or comes from a system
+ * outside of the PortEngine implementation's control (e.g. the analog domain
+ * for audio, or external MIDI devices for MIDI). Non-physical ports can also
+ * be considered "terminal". For example, the output port of a software
+ * synthesizer is a terminal port, because the data contained in its buffer
+ * does not and cannot be considered to come from any other port - it is
+ * synthesized by its owner.
+ *
+ * Ports also have latency associated with them. Each port has a playback
+ * latency and a capture latency:
+ *
+ * <b>capture latency</b>: how long since the data read from the buffer of a
+ * port arrived at at a terminal port. The data will have
+ * come from the "outside world" if the terminal port is also
+ * physical, or will have been synthesized by the entity that
+ * owns the terminal port.
+ *
+ * <b>playback latency</b>: how long until the data written to the buffer of
+ * port will reach a terminal port.
+ *
+ *
+ * For more detailed questions about the PortEngine API, consult the JACK API
+ * documentation, on which this entire object is based.
+ */
+
+class PortEngine {
+ public:
+ PortEngine() {}
+ virtual ~PortEngine();
+
+ /* We use void* here so that the API can be defined for any implementation.
+ *
+ * We could theoretically use a template (PortEngine<T>) and define
+ * PortHandle as T, but this complicates the desired inheritance
+ * pattern in which FooPortEngine handles things for the Foo API,
+ * rather than being a derivative of PortEngine<Foo>.
+ */
+
+ typedef void* PortHandle;
+
+ virtual bool connected() const = 0;
+
+ virtual int set_port_name (PortHandle, const std::string&) = 0;
+ virtual std::string get_port_name (PortHandle) const = 0;
+ virtual PortHandle* get_port_by_name (const std::string&) const = 0;
+
+ virtual PortHandle register_port (const std::string&, DataType::Symbol, ARDOUR::PortFlags) = 0;
+ virtual void unregister_port (PortHandle) = 0;
+ virtual bool connected (PortHandle) = 0;
+ virtual int disconnect_all (PortHandle) = 0;
+ virtual bool connected_to (PortHandle, const std::string&) = 0;
+ virtual int get_connections (PortHandle, std::vector<std::string>&) = 0;
+ virtual bool physically_connected (PortHandle) = 0;
+ virtual int connect (PortHandle, const std::string&) = 0;
+ virtual int disconnect (PortHandle, const std::string&) = 0;
+
+ /* MIDI */
+
+ virtual void midi_event_get (pframes_t& timestamp, size_t& size, uint8_t** buf, void* port_buffer, uint32_t event_index) = 0;
+ virtual int midi_event_put (void* port_buffer, pframes_t timestamp, const uint8_t* buffer, size_t size) = 0;
+ virtual uint32_t get_midi_event_count (void* port_buffer);
+ virtual void midi_clear (void* port_buffer);
+
+ /* Monitoring */
+
+ virtual bool can_monitor_input() const = 0;
+ virtual int request_input_monitoring (PortHandle, bool) = 0;
+ virtual int ensure_input_monitoring (PortHandle, bool) = 0;
+ virtual bool monitoring_input (PortHandle) = 0;
+
+ /* Latency management
+ */
+
+ struct LatencyRange {
+ uint32_t min;
+ uint32_t max;
+ };
+
+ virtual void set_latency_range (PortHandle, int dir, LatencyRange) = 0;
+ virtual LatencyRange get_latency_range (PortHandle, int dir) = 0;
+ virtual LatencyRange get_connected_latency_range (PortHandle, int dir) = 0;
+
+ virtual void* get_buffer (PortHandle, pframes_t) = 0;
+
+ virtual pframes_t last_frame_time () const = 0;
+};
+
+}
+
+#endif /* __libardour_port_engine_h__ */
diff --git a/libs/ardour/ardour/port_manager.h b/libs/ardour/ardour/port_manager.h
index f6aedc02a1..399ab46b34 100644
--- a/libs/ardour/ardour/port_manager.h
+++ b/libs/ardour/ardour/port_manager.h
@@ -32,11 +32,11 @@
#include "pbd/rcu.h"
#include "ardour/chan_count.h"
+#include "ardour/port.h"
+#include "ardour/port_engine.h"
namespace ARDOUR {
-class Port;
-
class PortManager
{
public:
@@ -44,36 +44,44 @@ class PortManager
PortManager();
virtual ~PortManager() {}
+
+ PortEngine& port_engine() { return *_impl; }
/* Port registration */
- virtual boost::shared_ptr<Port> register_input_port (DataType, const std::string& portname) = 0;
- virtual boost::shared_ptr<Port> register_output_port (DataType, const std::string& portname) = 0;
- virtual int unregister_port (boost::shared_ptr<Port>) = 0;
+ boost::shared_ptr<Port> register_input_port (DataType, const std::string& portname);
+ boost::shared_ptr<Port> register_output_port (DataType, const std::string& portname);
+ int unregister_port (boost::shared_ptr<Port>);
/* Port connectivity */
- virtual int connect (const std::string& source, const std::string& destination) = 0;
- virtual int disconnect (const std::string& source, const std::string& destination) = 0;
- virtual int disconnect (boost::shared_ptr<Port>) = 0;
-
+ int connect (const std::string& source, const std::string& destination);
+ int disconnect (const std::string& source, const std::string& destination);
+ int disconnect (boost::shared_ptr<Port>);
+ bool connected (const std::string&);
+
/* other Port management */
- virtual bool port_is_physical (const std::string&) const = 0;
- virtual void get_physical_outputs (DataType type, std::vector<std::string>&) = 0;
- virtual void get_physical_inputs (DataType type, std::vector<std::string>&) = 0;
- virtual boost::shared_ptr<Port> get_port_by_name (const std::string &) = 0;
- virtual void port_renamed (const std::string&, const std::string&) = 0;
- virtual ChanCount n_physical_outputs () const = 0;
- virtual ChanCount n_physical_inputs () const = 0;
- virtual const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags) = 0;
+ bool port_is_physical (const std::string&) const;
+ void get_physical_outputs (DataType type, std::vector<std::string>&);
+ void get_physical_inputs (DataType type, std::vector<std::string>&);
+ boost::shared_ptr<Port> get_port_by_name (const std::string &);
+ void port_renamed (const std::string&, const std::string&);
+ ChanCount n_physical_outputs () const;
+ ChanCount n_physical_inputs () const;
+ const char ** get_ports (const std::string& port_name_pattern, const std::string& type_name_pattern, uint32_t flags);
void remove_all_ports ();
/* per-Port monitoring */
- virtual bool can_request_input_monitoring () const = 0;
- virtual void request_input_monitoring (const std::string&, bool) const = 0;
+ bool can_request_input_monitoring () const;
+ void request_input_monitoring (const std::string&, bool) const;
+ void ensure_input_monitoring (const std::string&, bool) const;
+
+ std::string make_port_name_relative (const std::string&) const;
+ std::string make_port_name_non_relative (const std::string&) const;
+ bool port_is_mine (const std::string&) const;
class PortRegistrationFailure : public std::exception {
public:
@@ -82,23 +90,17 @@ class PortManager
~PortRegistrationFailure () throw () {}
- virtual const char *what() const throw () { return reason.c_str(); }
+ const char *what() const throw () { return reason.c_str(); }
private:
std::string reason;
};
+
protected:
- typedef void* PortHandle;
- PortHandle register (const std::string&, DataType type, Port::Flags);
- void unregister (PortHandle);
- bool connected (PortHandle);
- int disconnect_all (PortHandle);
- bool connected_to (PortHandle, const std::string);
- int get_connections (PortHandle, std::vector<std::string>&);
-
- private:
+ PortEngine* _impl;
SerializedRCUManager<Ports> ports;
+
boost::shared_ptr<Port> register_port (DataType type, const std::string& portname, bool input);
void port_registration_failure (const std::string& portname);
};
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 11cdb79575..390f1e4fec 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -584,6 +584,25 @@ namespace ARDOUR {
FadeSymmetric,
};
+ enum TransportState {
+ /* these values happen to match the constants used by JACK but
+ this equality cannot be assumed.
+ */
+ TransportStopped = 0,
+ TransportRolling = 1,
+ TransportLooping = 2,
+ TransportStarting = 3,
+ };
+
+ enum PortFlags {
+ /* these values happen to match the constants used by JACK but
+ this equality cannot be assumed.
+ */
+ IsInput = 1,
+ IsOutput = 2,
+ };
+
+
} // namespace ARDOUR