diff options
Diffstat (limited to 'libs/ardour/ardour/port.h')
-rw-r--r-- | libs/ardour/ardour/port.h | 98 |
1 files changed, 80 insertions, 18 deletions
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h index e9179ae326..93c34da16d 100644 --- a/libs/ardour/ardour/port.h +++ b/libs/ardour/ardour/port.h @@ -20,6 +20,10 @@ #ifndef __ardour_port_h__ #define __ardour_port_h__ +#include <set> +#include <vector> +#include <string> + #include <sigc++/signal.h> #include <pbd/failed_constructor.h> #include <ardour/ardour.h> @@ -43,13 +47,12 @@ class Port : public virtual sigc::trackable { CanMonitor = JackPortCanMonitor }; - virtual ~Port() {} + virtual ~Port(); std::string name() const { return _name; } - Flags flags() const { return _flags; } @@ -59,7 +62,7 @@ class Port : public virtual sigc::trackable { } bool sends_output () const { - return _flags & JackPortIsOutput; + return _flags & IsOutput; } bool can_monitor () const { @@ -73,18 +76,30 @@ class Port : public virtual sigc::trackable { void disable_metering () { if (_metering) { _metering--; } } - - DataType type() const { return _type; } - virtual void cycle_start(nframes_t nframes) {} - virtual void cycle_end() {} + virtual void cycle_start (nframes_t nframes, nframes_t offset) {} + virtual void cycle_end (nframes_t nframes, nframes_t offset) {} + virtual DataType type() const = 0; virtual Buffer& get_buffer() = 0; - virtual std::string short_name() = 0; - virtual int set_name (std::string str) = 0; - virtual int reestablish () = 0; - virtual int connected () const = 0; - virtual bool connected_to (const std::string& portname) const = 0; - virtual const char ** get_connections () const = 0; + + virtual bool connected () const; + virtual bool connected_to (const std::string& portname) const; + virtual int get_connections (std::vector<std::string>&) const; + + virtual int connect (Port& other); + virtual int disconnect (Port& other); + virtual int disconnect_all (); + + virtual void reset (); + virtual int reestablish () {return 0; } + virtual int reconnect () { return 0; } + + virtual int set_name (const std::string& str) { + _name = str; + return 0; + } + + virtual std::string short_name() const = 0; virtual bool monitoring_input () const = 0; virtual void ensure_monitor_input (bool yn) = 0; virtual void request_monitor_input (bool yn) = 0; @@ -95,24 +110,71 @@ class Port : public virtual sigc::trackable { sigc::signal<void,bool> MonitorInputChanged; sigc::signal<void,bool> ClockSyncChanged; + static void set_engine (AudioEngine*); + protected: friend class AudioEngine; - Port (DataType, Flags); + Port (const std::string& name, Flags flgs); - virtual int disconnect () = 0; - virtual void recompute_total_latency() const = 0; - virtual void reset (); + virtual void recompute_total_latency() const {} /* engine isn't supposed to access below here */ Flags _flags; - const DataType _type; + std::string _type; std::string _name; unsigned short _metering; bool _last_monitor; + nframes_t _latency; + + std::set<Port*> _connections; + + static AudioEngine* engine; +}; + +class PortConnectableByName { + public: + PortConnectableByName() {} + virtual ~PortConnectableByName() {} + + virtual int connect (const std::string& other_name) = 0; + virtual int disconnect (const std::string& other_name) = 0; }; +class PortFacade : public virtual Port, public PortConnectableByName { + public: + PortFacade (const std::string& name, Flags flgs) : Port (name, flgs), _ext_port (0) {} + ~PortFacade() {} + + void reset (); + int reestablish (); + int reconnect (); + + int connect (Port& other); + int disconnect (Port& other); + int disconnect_all (); + + int connect (const std::string& other_name); + int disconnect (const std::string& other_name); + + bool connected () const; + bool connected_to (const std::string& portname) const; + int get_connections (std::vector<std::string>&) const; + + std::string short_name() const; + int set_name (const std::string& str); + bool monitoring_input () const; + void ensure_monitor_input (bool yn); + void request_monitor_input (bool yn); + nframes_t latency () const; + nframes_t total_latency () const; + void set_latency (nframes_t nframes); + + protected: + Port* _ext_port; +}; + } // namespace ARDOUR #endif /* __ardour_port_h__ */ |