summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/Connection.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-08 06:04:32 +0000
committerDavid Robillard <d@drobilla.net>2007-04-08 06:04:32 +0000
commite96c36c1a7abb062e36efc0ac95c35fedcef922e (patch)
tree826d5caa0392201472d12c02a1c3df4cf7b275be /src/libs/engine/Connection.h
parent7d69e89f22304e37fa325ce4f39a374a02072a69 (diff)
downloadingen-e96c36c1a7abb062e36efc0ac95c35fedcef922e.tar.gz
ingen-e96c36c1a7abb062e36efc0ac95c35fedcef922e.tar.bz2
ingen-e96c36c1a7abb062e36efc0ac95c35fedcef922e.zip
De-template-ification of port types (req. for LV2 MIDI, but nice code size reduction).
LV2 MIDI patching support (LV2 style MIDI throughout, inc. internal plugins). git-svn-id: http://svn.drobilla.net/lad/ingen@415 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/Connection.h')
-rw-r--r--src/libs/engine/Connection.h36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/libs/engine/Connection.h b/src/libs/engine/Connection.h
index a7a2b3fa..7d109d88 100644
--- a/src/libs/engine/Connection.h
+++ b/src/libs/engine/Connection.h
@@ -21,11 +21,14 @@
#include <cstdlib>
#include <boost/utility.hpp>
#include <raul/Deletable.h>
+#include "DataType.h"
+#include "Port.h"
#include "types.h"
namespace Ingen {
class Port;
+class Buffer;
/** Represents a single inbound connection for an InputPort.
@@ -41,7 +44,8 @@ class Port;
class Connection : public Raul::Deletable
{
public:
- virtual ~Connection() {}
+ Connection(Port* src_port, Port* dst_port);
+ virtual ~Connection();
Port* src_port() const { return _src_port; }
Port* dst_port() const { return _dst_port; }
@@ -50,17 +54,41 @@ public:
bool pending_disconnection() { return _pending_disconnection; }
void pending_disconnection(bool b) { _pending_disconnection = b; }
- virtual void set_buffer_size(size_t size) {}
+ void process(SampleCount nframes, FrameTime start, FrameTime end);
-protected:
- Connection(Port* const src_port, Port* const dst_port);
+ /** Get the buffer for a particular voice.
+ * A Connection is smart - it knows the destination port requesting the
+ * buffer, and will return accordingly (ie the same buffer for every voice
+ * in a mono->poly connection).
+ */
+ inline Buffer* buffer(size_t voice) const;
+ void set_buffer_size(size_t size);
+
+ DataType type() const { return _src_port->type(); }
+
+protected:
Port* const _src_port;
Port* const _dst_port;
+ Buffer* _local_buffer;
+ size_t _buffer_size;
+ bool _must_mix;
bool _pending_disconnection;
};
+inline Buffer*
+Connection::buffer(size_t voice) const
+{
+ if (_must_mix)
+ return _local_buffer;
+ else if (_src_port->poly() == 1)
+ return _src_port->buffer(0);
+ else
+ return _src_port->buffer(voice);
+}
+
+
} // namespace Ingen
#endif // CONNECTION_H