summaryrefslogtreecommitdiff
path: root/libs/ardour/ardour
diff options
context:
space:
mode:
Diffstat (limited to 'libs/ardour/ardour')
-rw-r--r--libs/ardour/ardour/audio_diskstream.h2
-rw-r--r--libs/ardour/ardour/audio_port.h32
-rw-r--r--libs/ardour/ardour/audioengine.h8
-rw-r--r--libs/ardour/ardour/base_audio_port.h102
-rw-r--r--libs/ardour/ardour/base_midi_port.h63
-rw-r--r--libs/ardour/ardour/diskstream.h1
-rw-r--r--libs/ardour/ardour/internal_audio_port.h55
-rw-r--r--libs/ardour/ardour/internal_port.h82
-rw-r--r--libs/ardour/ardour/jack_audio_port.h54
-rw-r--r--libs/ardour/ardour/jack_midi_port.h57
-rw-r--r--libs/ardour/ardour/midi_diskstream.h2
-rw-r--r--libs/ardour/ardour/midi_port.h17
-rw-r--r--libs/ardour/ardour/port.h191
-rw-r--r--libs/ardour/ardour/port_set.h6
14 files changed, 114 insertions, 558 deletions
diff --git a/libs/ardour/ardour/audio_diskstream.h b/libs/ardour/ardour/audio_diskstream.h
index 79ffe3d490..92c8e82df8 100644
--- a/libs/ardour/ardour/audio_diskstream.h
+++ b/libs/ardour/ardour/audio_diskstream.h
@@ -39,10 +39,10 @@
#include <ardour/session.h>
#include <ardour/route_group.h>
#include <ardour/route.h>
-#include <ardour/port.h>
#include <ardour/utils.h>
#include <ardour/diskstream.h>
#include <ardour/audioplaylist.h>
+#include <ardour/port.h>
struct tm;
diff --git a/libs/ardour/ardour/audio_port.h b/libs/ardour/ardour/audio_port.h
index fa416864e9..339165da0f 100644
--- a/libs/ardour/ardour/audio_port.h
+++ b/libs/ardour/ardour/audio_port.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2002 Paul Davis
+ Copyright (C) 2002-2009 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,28 +21,42 @@
#ifndef __ardour_audio_port_h__
#define __ardour_audio_port_h__
-#include <ardour/base_audio_port.h>
+#include <ardour/port.h>
+#include <ardour/audio_buffer.h>
namespace ARDOUR {
-class AudioPort : public BaseAudioPort, public PortFacade {
-
+class AudioPort : public Port
+{
public:
~AudioPort();
- void reset ();
+ DataType type () const {
+ return DataType::AUDIO;
+ }
+
+ void cycle_start (nframes_t, nframes_t);
+ void cycle_end (nframes_t, nframes_t);
- void cycle_start (nframes_t nframes, nframes_t offset);
- void cycle_end (nframes_t nframes, nframes_t offset);
+ Buffer& get_buffer (nframes_t nframes, nframes_t offset) {
+ return get_audio_buffer (nframes, offset);
+ }
- AudioBuffer& get_audio_buffer( nframes_t nframes, nframes_t offset );
+ AudioBuffer& get_audio_buffer (nframes_t, nframes_t);
+
+ void reset ();
protected:
friend class AudioEngine;
- AudioPort (const std::string&, Flags, bool external, nframes_t);
+ AudioPort (std::string const &, Flags, bool, nframes_t);
+
private:
+ void mixdown (nframes_t, nframes_t, bool);
+
bool _has_been_mixed_down;
+ AudioBuffer* _buffer;
+ bool _own_buffer;
};
} // namespace ARDOUR
diff --git a/libs/ardour/ardour/audioengine.h b/libs/ardour/ardour/audioengine.h
index 89abc6669a..16090a7d77 100644
--- a/libs/ardour/ardour/audioengine.h
+++ b/libs/ardour/ardour/audioengine.h
@@ -146,13 +146,11 @@ class AudioEngine : public sigc::trackable
return get_nth_physical (type, n, JackPortIsOutput);
}
- nframes_t get_port_total_latency (const Port&);
void update_total_latencies ();
void update_total_latency (const Port&);
- /** Caller may not delete the object pointed to by the return value
- */
- Port *get_port_by_name (const std::string& name, bool keep = true);
+ Port *get_port_by_name (const std::string &);
+ Port *get_port_by_name_locked (const std::string &);
enum TransportState {
TransportStopped = JackTransportStopped,
@@ -234,8 +232,6 @@ class AudioEngine : public sigc::trackable
int process_callback (nframes_t nframes);
void remove_all_ports ();
- Port* get_port (const std::string& short_name);
-
typedef std::pair<std::string,std::string> PortConnection;
typedef std::list<PortConnection> PortConnections;
diff --git a/libs/ardour/ardour/base_audio_port.h b/libs/ardour/ardour/base_audio_port.h
deleted file mode 100644
index 5bad90150b..0000000000
--- a/libs/ardour/ardour/base_audio_port.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- Copyright (C) 2002 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
-*/
-
-#ifndef __ardour_base_audio_port_h__
-#define __ardour_base_audio_port_h__
-
-#include <string>
-
-#include <sigc++/signal.h>
-
-#include <pbd/failed_constructor.h>
-
-#include <ardour/ardour.h>
-#include <ardour/port.h>
-#include <ardour/audio_buffer.h>
-
-namespace ARDOUR {
-
-class AudioEngine;
-
-class BaseAudioPort : public virtual Port {
- public:
- virtual ~BaseAudioPort();
-
- DataType type() const { return DataType::AUDIO; }
-
- virtual Buffer& get_buffer ( nframes_t nframes, nframes_t offset ) {
- return get_audio_buffer( nframes, offset);
- }
-
- virtual AudioBuffer& get_audio_buffer (nframes_t nframes, nframes_t offset) = 0;
-
- void reset ();
-
- void reset_overs () {
- /* XXX NOT THREAD SAFE */
- _short_overs = 0;
- _long_overs = 0;
- _overlen = 0;
- }
-
- void reset_peak_meter () {
- /* XXX NOT THREAD SAFE */
- _peak = 0;
- }
-
- void reset_meters () {
- /* XXX NOT THREAD SAFE */
- reset_peak_meter ();
- reset_overs ();
- }
-
- float peak_db() const { return _peak_db; }
- Sample peak() const { return _peak; }
-
- uint32_t short_overs () const { return _short_overs; }
- uint32_t long_overs () const { return _long_overs; }
-
- static void set_short_over_length (nframes_t);
- static void set_long_over_length (nframes_t);
-
- void set_mixdown_function (void (*func)(const std::set<Port*>&, AudioBuffer*, nframes_t, nframes_t, bool));
-
- protected:
- BaseAudioPort (const std::string& name, Flags flags);
-
- AudioBuffer* _buffer;
- nframes_t _overlen;
- Sample _peak;
- float _peak_db;
- uint32_t _short_overs;
- uint32_t _long_overs;
- bool _own_buffer;
-
- void (*_mixdown)(const std::set<Port*>&, AudioBuffer*, nframes_t, nframes_t, bool);
-
- static void default_mixdown (const std::set<Port*>&, AudioBuffer*, nframes_t, nframes_t, bool);
-
- static nframes_t _long_over_length;
- static nframes_t _short_over_length;
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_base_audio_port_h__ */
diff --git a/libs/ardour/ardour/base_midi_port.h b/libs/ardour/ardour/base_midi_port.h
deleted file mode 100644
index 5ea18fce43..0000000000
--- a/libs/ardour/ardour/base_midi_port.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- Copyright (C) 2002 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
-*/
-
-#ifndef __ardour_base_midi_port_h__
-#define __ardour_base_midi_port_h__
-
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <ardour/ardour.h>
-#include <ardour/port.h>
-#include <ardour/midi_buffer.h>
-
-namespace ARDOUR {
-
-class MidiEngine;
-
-class BaseMidiPort : public virtual Port {
- public:
- virtual ~BaseMidiPort();
-
- DataType type() const { return DataType::MIDI; }
-
- Buffer& get_buffer( nframes_t nframes, nframes_t offset ) {
- return get_midi_buffer( nframes, offset );
- }
-
- virtual MidiBuffer& get_midi_buffer (nframes_t nframes, nframes_t offset ) = 0;
-
- size_t capacity() { return _buffer->capacity(); }
- size_t size() { return _buffer->size(); }
-
- void set_mixdown_function (void (*func)(const std::set<Port*>&, MidiBuffer*, nframes_t, nframes_t, bool));
-
- protected:
- BaseMidiPort (const std::string& name, Flags);
-
- MidiBuffer* _buffer;
- bool _own_buffer;
-
- void (*_mixdown)(const std::set<Port*>&, MidiBuffer*, nframes_t, nframes_t, bool);
- static void default_mixdown (const std::set<Port*>&, MidiBuffer*, nframes_t, nframes_t, bool);
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_base_midi_port_h__ */
diff --git a/libs/ardour/ardour/diskstream.h b/libs/ardour/ardour/diskstream.h
index 24655a1d41..b0ac26342f 100644
--- a/libs/ardour/ardour/diskstream.h
+++ b/libs/ardour/ardour/diskstream.h
@@ -40,7 +40,6 @@
#include <ardour/session.h>
#include <ardour/route_group.h>
#include <ardour/route.h>
-#include <ardour/port.h>
#include <ardour/utils.h>
struct tm;
diff --git a/libs/ardour/ardour/internal_audio_port.h b/libs/ardour/ardour/internal_audio_port.h
deleted file mode 100644
index 7b70989d4b..0000000000
--- a/libs/ardour/ardour/internal_audio_port.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Copyright (C) 2007 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
-*/
-
-#ifndef __ardour_internal_audio_port_h__
-#define __ardour_internal_audio_port_h__
-
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <ardour/ardour.h>
-#include <ardour/internal_port.h>
-#include <ardour/audio_port.h>
-
-namespace ARDOUR {
-
-class AudioEngine;
-class InternalAudioPort : public AudioPort, public InternalPort {
- public:
- void cycle_start(nframes_t nframes) {
- _buffer.silence (nframes);
- }
-
- AudioBuffer& get_audio_buffer();
-
- void set_mixdown_function (void (*func)(const std::list<InternalPort*>&, AudioBuffer&, nframes_t, nframes_t));
- void reset ();
-
- protected:
- friend class AudioEngine;
-
- InternalAudioPort (const std::string& name, Flags flags);
- void (*_mixdown)(const std::list<InternalPort*>&, AudioBuffer&, nframes_t, nframes_t);
-
- static void default_mixdown (const std::list<InternalPort*>&, AudioBuffer&, nframes_t, nframes_t);
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_internal_audio_port_h__ */
diff --git a/libs/ardour/ardour/internal_port.h b/libs/ardour/ardour/internal_port.h
deleted file mode 100644
index e6053c0e58..0000000000
--- a/libs/ardour/ardour/internal_port.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- Copyright (C) 2007 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
-
-#ifndef __ardour_internal_port_h__
-#define __ardour_internal_port_h__
-
-#include <list>
-
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <ardour/port.h>
-
-namespace ARDOUR {
-
-class AudioEngine;
-class Buffer;
-
-/** Abstract class representing internal (ardour<->ardour only) ports
- */
-class InternalPort : public virtual Port {
- public:
-
- ~InternalPort();
-
- std::string short_name();
-
- int set_name (std::string str);
-
- int connected () const;
-
- int reestablish ();
-
- bool connected_to (const std::string& portname) const;
-
- const char ** get_connections () const;
- bool monitoring_input () const { return false; }
-
- void ensure_monitor_input (bool yn) {}
- void request_monitor_input (bool yn) {}
-
- nframes_t latency () const { return _latency; }
- nframes_t total_latency() const { return _latency; }
-
- void set_latency (nframes_t nframes);
-
- static void connect (InternalPort& src, InternalPort& dst);
- static void disconnect (InternalPort& a, InternalPort& b);
-
- protected:
- friend class AudioEngine;
-
- InternalPort (const std::string&, DataType type, Flags flags);
-
- int disconnect ();
- void recompute_total_latency() const;
-
- std::list<InternalPort*> _connections;
- nframes_t _latency;
-
- static AudioEngine* engine;
- static void set_engine (AudioEngine* e);
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_internal_port_h__ */
diff --git a/libs/ardour/ardour/jack_audio_port.h b/libs/ardour/ardour/jack_audio_port.h
deleted file mode 100644
index 5ca27132e0..0000000000
--- a/libs/ardour/ardour/jack_audio_port.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- Copyright (C) 2002 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
-*/
-
-#ifndef __ardour_jack_audio_port_h__
-#define __ardour_jack_audio_port_h__
-
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <ardour/ardour.h>
-#include <ardour/jack_port.h>
-#include <ardour/audio_port.h>
-
-namespace ARDOUR {
-
-class AudioEngine;
-class JackAudioPort : public JackPort, public BaseAudioPort {
- public:
- void cycle_end (nframes_t nframes, nframes_t offset);
- void cycle_start (nframes_t nframes, nframes_t offset);
-
- int reestablish ();
-
- AudioBuffer& get_audio_buffer( nframes_t nframes, nframes_t offset );
-
- protected:
- friend class AudioPort;
-
- JackAudioPort (const std::string& name, Flags flags, AudioBuffer* buf);
-
- AudioBuffer* _source_buffer;
- private:
- bool _has_been_mixed_down;
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_jack_audio_port_h__ */
diff --git a/libs/ardour/ardour/jack_midi_port.h b/libs/ardour/ardour/jack_midi_port.h
deleted file mode 100644
index 91cbd400aa..0000000000
--- a/libs/ardour/ardour/jack_midi_port.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- Copyright (C) 2002 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id: port.h 712 2006-07-28 01:08:57Z drobilla $
-*/
-
-#ifndef __ardour_jack_midi_port_h__
-#define __ardour_jack_midi_port_h__
-
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <ardour/ardour.h>
-#include <jack/jack.h>
-#include <jack/midiport.h>
-#include <ardour/port.h>
-#include <ardour/jack_port.h>
-#include <ardour/base_midi_port.h>
-#include <ardour/midi_buffer.h>
-
-namespace ARDOUR {
-
-class MidiEngine;
-
-class JackMidiPort : public JackPort, public BaseMidiPort {
- public:
- void cycle_start (nframes_t nframes, nframes_t offset);
- void cycle_end (nframes_t nframes, nframes_t offset);
- void flush_buffers (nframes_t nframes, nframes_t offset);
- void set_buffer (MidiBuffer& buf);
-
- MidiBuffer& get_midi_buffer( nframes_t nframes, nframes_t offset );
-
- protected:
- friend class MidiPort;
-
- JackMidiPort (const std::string&, Flags, MidiBuffer*);
- private:
- bool _has_been_mixed_down;
-};
-
-} // namespace ARDOUR
-
-#endif /* __ardour_jack_midi_port_h__ */
diff --git a/libs/ardour/ardour/midi_diskstream.h b/libs/ardour/ardour/midi_diskstream.h
index 56e704f88e..02b0132f7a 100644
--- a/libs/ardour/ardour/midi_diskstream.h
+++ b/libs/ardour/ardour/midi_diskstream.h
@@ -34,14 +34,12 @@
#include <pbd/fastlog.h>
#include <pbd/ringbufferNPT.h>
-
#include <ardour/ardour.h>
#include <ardour/configuration.h>
#include <ardour/session.h>
#include <ardour/route_group.h>
#include <ardour/route.h>
-#include <ardour/port.h>
#include <ardour/utils.h>
#include <ardour/diskstream.h>
#include <ardour/midi_playlist.h>
diff --git a/libs/ardour/ardour/midi_port.h b/libs/ardour/ardour/midi_port.h
index a5a269b1ef..a3c87ff702 100644
--- a/libs/ardour/ardour/midi_port.h
+++ b/libs/ardour/ardour/midi_port.h
@@ -21,29 +21,40 @@
#ifndef __ardour_midi_port_h__
#define __ardour_midi_port_h__
-#include <ardour/base_midi_port.h>
+#include <ardour/port.h>
+#include <ardour/midi_buffer.h>
namespace ARDOUR {
class MidiEngine;
-class MidiPort : public BaseMidiPort, public PortFacade {
+class MidiPort : public Port {
public:
~MidiPort();
- void reset ();
+ DataType type () const {
+ return DataType::MIDI;
+ }
void cycle_start (nframes_t nframes, nframes_t offset);
void cycle_end (nframes_t nframes, nframes_t offset);
void flush_buffers (nframes_t nframes, nframes_t offset);
+ Buffer& get_buffer (nframes_t nframes, nframes_t offset) {
+ return get_midi_buffer (nframes, offset);
+ }
+
MidiBuffer& get_midi_buffer( nframes_t nframes, nframes_t offset );
protected:
friend class AudioEngine;
MidiPort (const std::string& name, Flags, bool external, nframes_t bufsize);
+
private:
+ void mixdown (nframes_t, nframes_t, bool);
+
+ MidiBuffer* _buffer;
bool _has_been_mixed_down;
};
diff --git a/libs/ardour/ardour/port.h b/libs/ardour/ardour/port.h
index 6bd607c334..cf62429db3 100644
--- a/libs/ardour/ardour/port.h
+++ b/libs/ardour/ardour/port.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2002 Paul Davis
+ Copyright (C) 2009 Paul Davis
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -20,167 +20,118 @@
#ifndef __ardour_port_h__
#define __ardour_port_h__
+#include "ardour/data_type.h"
+#include "ardour/types.h"
+#include <sigc++/trackable.h>
+#include <jack/jack.h>
+#include <string>
#include <set>
#include <vector>
-#include <string>
-#include <cstring>
-#include <sigc++/signal.h>
-#include <pbd/failed_constructor.h>
-#include <pbd/destructible.h>
-#include <ardour/ardour.h>
-#include <ardour/data_type.h>
-#include <jack/jack.h>
namespace ARDOUR {
class AudioEngine;
-class Buffer;
+class Buffer;
-/** Abstract base for ports
- */
-class Port : public virtual PBD::Destructible {
- public:
+class Port : public sigc::trackable
+{
+public:
enum Flags {
IsInput = JackPortIsInput,
IsOutput = JackPortIsOutput,
- IsPhysical = JackPortIsPhysical,
- IsTerminal = JackPortIsTerminal,
- CanMonitor = JackPortCanMonitor
};
- virtual ~Port();
+ virtual ~Port ();
- std::string name() const {
+ /** @return Port name (excluding prefix) */
+ std::string name () const {
return _name;
}
- Flags flags() const {
+ int set_name (std::string const &);
+
+ /** @return flags */
+ Flags flags () const {
return _flags;
}
- bool receives_input() const {
+ /** @return true if this Port receives input, otherwise false */
+ bool receives_input () const {
return _flags & IsInput;
}
+ /** @return true if this Port sends output, otherwise false */
bool sends_output () const {
return _flags & IsOutput;
}
- bool can_monitor () const {
- return _flags & CanMonitor;
- }
-
- void enable_metering() {
- _metering++;
- }
-
- void disable_metering () {
- if (_metering) { _metering--; }
+ /* @return true if this port is visible outside Ardour (via JACK) */
+ bool external () const {
+ return _jack_port != 0;
}
- virtual void cycle_start (nframes_t nframes, nframes_t offset) {}
- virtual void cycle_end (nframes_t nframes, nframes_t offset) {}
- virtual void flush_buffers (nframes_t nframes, nframes_t offset ) {}
- virtual DataType type() const = 0;
- virtual Buffer& get_buffer( nframes_t nframes, nframes_t offset ) = 0;
-
- virtual bool connected () const;
- virtual bool connected_to (const std::string& portname) const;
- virtual int get_connections (std::vector<std::string>&) const;
+ bool connected () const;
+ int disconnect_all ();
+ int get_connections (std::vector<std::string> &) const;
- virtual int connect (Port& other);
- virtual int disconnect (Port& other);
- virtual int disconnect_all ();
-
- virtual void reset ();
- virtual int reestablish () {return 0; }
- virtual int reconnect () { return 0; }
+ /* connection by name */
+ bool connected_to (std::string const &) const;
+ int connect (std::string const &);
+ int disconnect (std::string const &);
- virtual int set_name (const std::string& str) {
- _name = str;
- return 0;
- }
+ /* connection by Port* */
+ bool connected_to (Port *) const;
+ int connect (Port *);
+ int disconnect (Port *);
- virtual std::string short_name() const = 0;
- virtual bool monitoring_input () const = 0;
- virtual void ensure_monitor_input (bool yn) = 0;
- virtual void request_monitor_input (bool yn) = 0;
- virtual nframes_t latency () const = 0;
- virtual nframes_t total_latency () const = 0;
- virtual void set_latency (nframes_t nframes) = 0;
+ void ensure_monitor_input (bool);
+ bool monitoring_input () const;
+ nframes_t total_latency () const;
+ int reestablish ();
+ int reconnect ();
+ void set_latency (nframes_t);
+ void request_monitor_input (bool);
+ void make_external ();
- sigc::signal<void,bool> MonitorInputChanged;
- sigc::signal<void,bool> ClockSyncChanged;
+ virtual void reset ();
- static void set_engine (AudioEngine*);
+ virtual DataType type () const = 0;
+ virtual void cycle_start (nframes_t, nframes_t) = 0;
+ virtual void cycle_end (nframes_t, nframes_t) = 0;
+ virtual Buffer& get_buffer (nframes_t, nframes_t) = 0;
+ virtual void flush_buffers (nframes_t, nframes_t) {}
- protected:
- friend class AudioEngine;
+ static void set_engine (AudioEngine *);
- Port (const std::string& name, Flags flgs);
+ sigc::signal<void, bool> MonitorInputChanged;
- virtual void recompute_total_latency() const {}
+protected:
- /* engine isn't supposed to access below here */
-
- Flags _flags;
- std::string _type;
- std::string _name;
- unsigned short _metering;
- bool _last_monitor;
- nframes_t _latency;
-
- std::set<Port*> _connections;
-
- static AudioEngine* engine;
+ Port (std::string const &, DataType, Flags, bool);
- private:
+ jack_port_t* _jack_port; ///< JACK port, or 0 if we don't have one
+ std::set<Port*> _connections; ///< internal Ports that we are connected to
- void port_going_away (Port *);
-};
-
-class PortConnectableByName {
- public:
- PortConnectableByName() {}
- virtual ~PortConnectableByName() {}
-
- virtual int connect (const std::string& other_name) = 0;
- virtual int disconnect (const std::string& other_name) = 0;
-};
-
-class PortFacade : public virtual Port, public PortConnectableByName {
- public:
- PortFacade (const std::string& name, Flags flgs) : Port (name, flgs), _ext_port (0) {}
- ~PortFacade() {}
-
- void reset ();
- int reestablish ();
- int reconnect ();
+ static AudioEngine* _engine; ///< the AudioEngine
+
+private:
+ friend class AudioEngine;
- int connect (Port& other);
- int disconnect (Port& other);
- int disconnect_all ();
+ void recompute_total_latency () const;
+ void do_make_external (DataType);
+
+ /* XXX */
+ bool _last_monitor;
+ nframes_t _latency;
- int connect (const std::string& other_name);
- int disconnect (const std::string& other_name);
+ std::string _name; ///< port name (excluding prefix)
+ Flags _flags; ///< flags
- bool connected () const;
- bool connected_to (const std::string& portname) const;
- int get_connections (std::vector<std::string>&) const;
-
- std::string short_name() const;
- int set_name (const std::string& str);
- bool monitoring_input () const;
- void ensure_monitor_input (bool yn);
- void request_monitor_input (bool yn);
- nframes_t latency () const;
- nframes_t total_latency () const;
- void set_latency (nframes_t nframes);
-
- protected:
- Port* _ext_port;
+ /// list of JACK ports that we are connected to; we only keep this around
+ /// so that we can implement ::reconnect ()
+ std::set<std::string> _named_connections;
};
-} // namespace ARDOUR
+}
-#endif /* __ardour_port_h__ */
+#endif
diff --git a/libs/ardour/ardour/port_set.h b/libs/ardour/ardour/port_set.h
index 51673472c3..7b9e716e4a 100644
--- a/libs/ardour/ardour/port_set.h
+++ b/libs/ardour/ardour/port_set.h
@@ -20,13 +20,13 @@
#define __ardour_port_set_h__
#include <vector>
-#include <ardour/port.h>
-#include <ardour/audio_port.h>
-#include <ardour/midi_port.h>
#include <ardour/chan_count.h>
namespace ARDOUR {
+class Port;
+class AudioPort;
+class MidiPort;
/** An ordered list of Ports, possibly of various types.
*