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_jack_port_h__
21 #define __ardour_jack_port_h__
23 #include <sigc++/signal.h>
24 #include <pbd/failed_constructor.h>
25 #include <ardour/port.h>
26 #include <jack/jack.h>
33 /** Abstract class representing JACK ports
35 class JackPort : public virtual Port, public PortConnectableByName {
40 std::string short_name() const {
41 return jack_port_short_name (_port);
44 int set_name (const std::string& str);
46 bool connected () const {
47 return jack_port_connected (_port);
53 int connect (Port& other) {
54 if( _flags & IsOutput ) {
57 return connect (other.name());
60 int disconnect (Port& other) {
61 return disconnect (other.name());
64 int disconnect_all ();
66 // connect-by-name API
68 int connect (const std::string& other_name);
69 int disconnect (const std::string& other_name);
71 bool connected_to (const std::string& portname) const {
72 return jack_port_connected_to (_port, portname.c_str());
75 int get_connections (std::vector<std::string>& names) const;
77 bool monitoring_input () const {
78 return jack_port_monitoring_input (_port);
81 void ensure_monitor_input (bool yn) {
82 jack_port_ensure_monitor (_port, yn);
85 /*XXX completely bloody useless imho*/
86 void request_monitor_input (bool yn) {
87 jack_port_request_monitor (_port, yn);
90 nframes_t latency () const {
91 return jack_port_get_latency (_port);
94 nframes_t total_latency() const;
96 void set_latency (nframes_t nframes) {
97 jack_port_set_latency (_port, nframes);
102 friend class AudioEngine;
104 JackPort (const std::string&, DataType type, Flags flags);
108 void recompute_total_latency() const;
110 std::set<std::string> _named_connections;
113 } // namespace ARDOUR
115 #endif /* __ardour_jack_port_h__ */