2 Copyright (C) 2002 Paul 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 __ardour_port_h__
21 #define __ardour_port_h__
23 #include <sigc++/signal.h>
24 #include <pbd/failed_constructor.h>
25 #include <ardour/ardour.h>
26 #include <ardour/data_type.h>
27 #include <jack/jack.h>
34 /** Abstract base for ports
36 class Port : public virtual sigc::trackable {
39 IsInput = JackPortIsInput,
40 IsOutput = JackPortIsOutput,
41 IsPhysical = JackPortIsPhysical,
42 IsTerminal = JackPortIsTerminal,
43 CanMonitor = JackPortCanMonitor
48 std::string name() const {
57 bool receives_input() const {
58 return _flags & IsInput;
61 bool sends_output () const {
62 return _flags & JackPortIsOutput;
65 bool can_monitor () const {
66 return _flags & CanMonitor;
69 void enable_metering() {
73 void disable_metering () {
74 if (_metering) { _metering--; }
77 virtual DataType type() const = 0;
78 virtual void cycle_start(nframes_t nframes) {}
79 virtual void cycle_end() {}
80 virtual Buffer& get_buffer() = 0;
81 virtual std::string short_name() = 0;
82 virtual int set_name (std::string str) = 0;
83 virtual bool is_mine (jack_client_t *client) = 0;
84 virtual int reestablish () = 0;
85 virtual int connected () const = 0;
86 virtual bool connected_to (const std::string& portname) const = 0;
87 virtual const char ** get_connections () const = 0;
88 virtual bool monitoring_input () const = 0;
89 virtual void ensure_monitor_input (bool yn) = 0;
90 virtual void request_monitor_input (bool yn) = 0;
91 virtual nframes_t latency () const = 0;
92 virtual nframes_t total_latency () const = 0;
93 virtual void set_latency (nframes_t nframes) = 0;
95 sigc::signal<void,bool> MonitorInputChanged;
96 sigc::signal<void,bool> ClockSyncChanged;
99 friend class AudioEngine;
103 virtual int disconnect () = 0;
104 virtual void recompute_total_latency() const = 0;
105 virtual void reset ();
107 /* engine isn't supposed to access below here */
112 unsigned short _metering;
116 } // namespace ARDOUR
118 #endif /* __ardour_port_h__ */