summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/TypedConnection.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/TypedConnection.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/TypedConnection.h')
-rw-r--r--src/libs/engine/TypedConnection.h104
1 files changed, 0 insertions, 104 deletions
diff --git a/src/libs/engine/TypedConnection.h b/src/libs/engine/TypedConnection.h
deleted file mode 100644
index 1c7f3dc7..00000000
--- a/src/libs/engine/TypedConnection.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* This file is part of Ingen.
- * Copyright (C) 2007 Dave Robillard <http://drobilla.net>
- *
- * Ingen 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.
- *
- * Ingen 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 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.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef TYPEDCONNECTION_H
-#define TYPEDCONNECTION_H
-
-#include "types.h"
-#include "OutputPort.h"
-#include "Connection.h"
-
-namespace Ingen {
-
-class MidiMessage;
-class Port;
-template <typename T> class InputPort;
-
-
-/** A Connection with a type.
- *
- * \ingroup engine
- */
-template <typename T>
-class TypedConnection : public Connection
-{
-public:
- TypedConnection(OutputPort<T>* const src_port, InputPort<T>* const dst_port);
- virtual ~TypedConnection();
-
- void process(SampleCount nframes, FrameTime start, FrameTime end);
-
- inline OutputPort<T>* src_port() const { return dynamic_cast<OutputPort<T>*>(_src_port); }
- inline InputPort<T>* dst_port() const { return dynamic_cast<InputPort<T>*>(_dst_port); }
-
- /** Used by some (recursive) events to prevent double disconnections */
- bool pending_disconnection() { return _pending_disconnection; }
- void pending_disconnection(bool b) { _pending_disconnection = b; }
-
- /** Get the buffer for a particular voice.
- * A TypedConnection is smart - it knows the destination port respondering the
- * buffer, and will return accordingly (ie the same buffer for every voice
- * in a mono->poly connection).
- */
- inline Buffer<T>* buffer(size_t voice) const;
-
- void set_buffer_size(size_t size);
-
-private:
- Buffer<T>* _local_buffer; ///< Only used for poly->mono connections
- bool _must_mix;
- size_t _buffer_size;
- bool _pending_disconnection;
-};
-
-
-template <>
-inline Buffer<Sample>*
-TypedConnection<Sample>::buffer(size_t voice) const
-{
- TypedPort<Sample>* const src_port = (TypedPort<Sample>*)_src_port;
-
- if (_must_mix) {
- return _local_buffer;
- } else {
- if (src_port->poly() == 1)
- return src_port->buffer(0);
- else
- return src_port->buffer(voice);
- }
-}
-
-
-template <>
-inline Buffer<MidiMessage>*
-TypedConnection<MidiMessage>::buffer(size_t voice) const
-{
- // No such thing as polyphonic MIDI ports
- assert(_src_port->poly() == 1);
- assert(_dst_port->poly() == 1);
-
- TypedPort<MidiMessage>* const src_port = (TypedPort<MidiMessage>*)_src_port;
- return src_port->buffer(0);
-}
-
-
-template class TypedConnection<Sample>;
-template class TypedConnection<MidiMessage>;
-
-} // namespace Ingen
-
-#endif // TYPEDCONNECTION_H