2 Copyright (C) 2013 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 __libardour_waves_dataport_h__
21 #define __libardour_waves_dataport_h__
23 #include "ardour/types.h"
31 virtual ~WavesDataPort ();
33 inline const std::string& name () const
38 int set_name (const std::string &name)
44 virtual DataType type () const = 0;
46 inline PortFlags flags () const
51 inline bool is_input () { return flags () & IsInput; }
52 inline bool is_output () { return flags () & IsOutput; }
53 inline bool is_physical () { return flags () & IsPhysical; }
54 inline bool is_terminal () { return flags () & IsTerminal; }
55 inline operator void* () { return (void*)this; }
57 inline const LatencyRange& latency_range (bool for_playback) const
59 return for_playback ? _playback_latency_range : _capture_latency_range;
62 inline void set_latency_range (const LatencyRange &latency_range, bool for_playback)
66 _playback_latency_range = latency_range;
70 _capture_latency_range = latency_range;
74 int connect (WavesDataPort *port);
76 int disconnect (WavesDataPort *port);
78 void disconnect_all ();
80 bool inline is_connected (const WavesDataPort *port) const
82 return std::find (_connections.begin (), _connections.end (), port) != _connections.end ();
85 bool inline is_connected () const
87 return _connections.size () != 0;
90 bool is_physically_connected () const;
92 inline const std::vector<WavesDataPort *>& get_connections () const { return _connections; }
94 virtual void* get_buffer (pframes_t nframes) = 0;
97 WavesDataPort (const std::string& inport_name, PortFlags inflags);
98 virtual void _wipe_buffer() = 0;
103 const PortFlags _flags;
104 LatencyRange _capture_latency_range;
105 LatencyRange _playback_latency_range;
106 std::vector<WavesDataPort*> _connections;
108 void _connect (WavesDataPort* port, bool api_call);
109 void _disconnect (WavesDataPort* port, bool api_call);
114 #endif /* __libardour_waves_dataport_h__ */