add config var for region fade visibility
[ardour.git] / libs / ardour / ardour / internal_port.h
1 /*
2     Copyright (C) 2007 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_internal_port_h__
21 #define __ardour_internal_port_h__
22
23 #include <list>
24
25 #include <sigc++/signal.h>
26 #include <pbd/failed_constructor.h>
27 #include <ardour/port.h>
28
29 namespace ARDOUR {
30
31 class AudioEngine;
32 class Buffer;
33
34 /** Abstract class representing internal (ardour<->ardour only) ports
35  */
36 class InternalPort : public virtual Port {
37    public:
38
39         ~InternalPort();
40
41         std::string short_name();
42         
43         int set_name (std::string str);
44
45         int connected () const;
46
47         int reestablish ();
48         
49         bool connected_to (const std::string& portname) const;
50
51         const char ** get_connections () const;
52         bool monitoring_input () const { return false; }
53
54         void ensure_monitor_input (bool yn) {}
55         void request_monitor_input (bool yn) {}
56
57         nframes_t latency () const { return _latency; }
58         nframes_t total_latency() const { return _latency; }
59
60         void set_latency (nframes_t nframes);
61
62         static void connect (InternalPort& src, InternalPort& dst);
63         static void disconnect (InternalPort& a, InternalPort& b);
64
65   protected:
66         friend class AudioEngine;
67
68         InternalPort (const std::string&, DataType type, Flags flags);
69
70         int disconnect ();
71         void recompute_total_latency() const;
72         
73         std::list<InternalPort*> _connections;
74         nframes_t _latency;
75
76         static AudioEngine* engine;
77         static void set_engine (AudioEngine* e);
78 };
79  
80 } // namespace ARDOUR
81
82 #endif /* __ardour_internal_port_h__ */