Remove unused declaration.
[ardour.git] / libs / ardour / ardour / jack_port.h
1 /*
2     Copyright (C) 2002 Paul Davis
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __ardour_jack_port_h__
21 #define __ardour_jack_port_h__
22
23 #include "pbd/failed_constructor.h"
24 #include "ardour/port.h"
25 #include <jack/jack.h>
26
27 namespace ARDOUR {
28
29 class AudioEngine;
30 class Buffer;
31
32 /** Abstract class representing JACK ports
33  */
34 class JackPort : public virtual Port, public PortConnectableByName {
35    public:
36
37         ~JackPort();
38
39         std::string short_name() const {
40                 return jack_port_short_name (_port);
41         }
42
43         int set_name (const std::string& str);
44
45         bool connected () const {
46                 return jack_port_connected (_port);
47         }
48
49         int reestablish ();
50         int reconnect ();
51
52         int connect (Port& other) {
53                 if (_flags & IsOutput) {
54                         return 0;
55                 }
56                 return connect (other.name());
57         }
58
59         int disconnect (Port& other) {
60                 return disconnect (other.name());
61         }
62
63         int disconnect_all ();
64
65         // connect-by-name API
66
67         int connect (const std::string& other_name);
68         int disconnect (const std::string& other_name);
69
70         bool connected_to (const std::string& portname) const {
71                 return jack_port_connected_to (_port, portname.c_str());
72         }
73
74         int get_connections (std::vector<std::string>& names) const;
75
76         bool monitoring_input () const {
77                 return jack_port_monitoring_input (_port);
78         }
79
80         void ensure_monitor_input (bool yn) {
81                 jack_port_ensure_monitor (_port, yn);
82         }
83
84         /*XXX completely bloody useless imho*/
85         void request_monitor_input (bool yn) {
86                 jack_port_request_monitor (_port, yn);
87         }
88
89         nframes_t latency () const {
90                 return jack_port_get_latency (_port);
91         }
92
93         nframes_t total_latency() const;
94
95         void set_latency (nframes_t nframes) {
96                 jack_port_set_latency (_port, nframes);
97         }
98
99
100   protected:
101         friend class AudioEngine;
102
103         JackPort (const std::string&, DataType type, Flags flags);
104         jack_port_t*  _port;
105
106         int disconnect ();
107
108         std::set<std::string> _named_connections;
109 };
110
111 } // namespace ARDOUR
112
113 #endif /* __ardour_jack_port_h__ */