From 971c02f3707c4872a2da9a3b946b6508290c5ab4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 7 Oct 2007 23:09:48 +0000 Subject: Added shared abstract interface for ports. Moved DataType to shared. Switch data type URIs to match LV2 type semantics (e.g. separate audio/control types). git-svn-id: http://svn.drobilla.net/lad/ingen@840 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/engine/AudioBuffer.cpp | 4 +- src/libs/engine/AudioDriver.hpp | 6 +- src/libs/engine/Buffer.hpp | 2 +- src/libs/engine/BufferFactory.cpp | 2 +- src/libs/engine/ClientBroadcaster.cpp | 4 +- src/libs/engine/ClientBroadcaster.hpp | 4 +- src/libs/engine/Connection.cpp | 8 +- src/libs/engine/Connection.hpp | 24 +-- src/libs/engine/DataType.hpp | 86 ---------- src/libs/engine/Driver.hpp | 2 +- src/libs/engine/DuplexPort.cpp | 4 +- src/libs/engine/Engine.cpp | 2 +- src/libs/engine/Engine.hpp | 2 +- src/libs/engine/EventSink.cpp | 2 +- src/libs/engine/EventSink.hpp | 2 +- src/libs/engine/InputPort.cpp | 14 +- src/libs/engine/InputPort.hpp | 4 +- src/libs/engine/JackAudioDriver.cpp | 2 +- src/libs/engine/JackAudioDriver.hpp | 2 +- src/libs/engine/LADSPANode.cpp | 20 ++- src/libs/engine/LV2Node.cpp | 15 +- src/libs/engine/Makefile.am | 5 +- src/libs/engine/MidiBuffer.hpp | 2 +- src/libs/engine/MidiControlNode.cpp | 14 +- src/libs/engine/MidiNoteNode.cpp | 10 +- src/libs/engine/MidiTriggerNode.cpp | 10 +- src/libs/engine/NodeBase.cpp | 16 +- src/libs/engine/NodeBase.hpp | 23 +-- src/libs/engine/NodeFactory.cpp | 8 +- src/libs/engine/NodeImpl.hpp | 19 ++- src/libs/engine/OSCBuffer.cpp | 2 +- src/libs/engine/OSCBuffer.hpp | 2 +- src/libs/engine/OSCClientSender.cpp | 2 +- src/libs/engine/ObjectSender.cpp | 39 ++--- src/libs/engine/ObjectSender.hpp | 4 +- src/libs/engine/ObjectStore.cpp | 8 +- src/libs/engine/ObjectStore.hpp | 4 +- src/libs/engine/OutputPort.hpp | 6 +- src/libs/engine/Patch.cpp | 24 +-- src/libs/engine/Patch.hpp | 24 +-- src/libs/engine/Port.cpp | 174 -------------------- src/libs/engine/Port.hpp | 117 ------------- src/libs/engine/PortImpl.cpp | 183 +++++++++++++++++++++ src/libs/engine/PortImpl.hpp | 125 ++++++++++++++ src/libs/engine/TransportNode.cpp | 2 +- src/libs/engine/events/ClearPatchEvent.cpp | 2 +- src/libs/engine/events/ConnectionEvent.cpp | 2 +- src/libs/engine/events/ConnectionEvent.hpp | 6 +- src/libs/engine/events/CreateNodeEvent.cpp | 2 +- src/libs/engine/events/CreateNodeEvent.hpp | 1 - src/libs/engine/events/CreatePatchEvent.hpp | 2 - src/libs/engine/events/CreatePortEvent.cpp | 28 ++-- src/libs/engine/events/CreatePortEvent.hpp | 30 ++-- src/libs/engine/events/DestroyEvent.cpp | 6 +- src/libs/engine/events/DestroyEvent.hpp | 9 +- .../engine/events/DisablePortMonitoringEvent.cpp | 2 +- .../engine/events/DisablePortMonitoringEvent.hpp | 2 +- src/libs/engine/events/DisconnectNodeEvent.cpp | 2 +- src/libs/engine/events/DisconnectNodeEvent.hpp | 2 +- src/libs/engine/events/DisconnectPortEvent.cpp | 2 +- src/libs/engine/events/DisconnectPortEvent.hpp | 2 +- src/libs/engine/events/DisconnectionEvent.cpp | 4 +- src/libs/engine/events/DisconnectionEvent.hpp | 8 +- .../engine/events/EnablePortBroadcastingEvent.cpp | 2 +- .../engine/events/EnablePortBroadcastingEvent.hpp | 4 +- src/libs/engine/events/LoadPluginsEvent.hpp | 2 - src/libs/engine/events/MidiLearnEvent.cpp | 4 +- src/libs/engine/events/NoteEvent.cpp | 8 +- src/libs/engine/events/PingQueuedEvent.hpp | 2 +- src/libs/engine/events/RenameEvent.cpp | 4 +- src/libs/engine/events/RequestObjectEvent.cpp | 4 +- src/libs/engine/events/RequestPluginEvent.cpp | 2 +- src/libs/engine/events/RequestPortValueEvent.cpp | 4 +- src/libs/engine/events/RequestPortValueEvent.hpp | 8 +- src/libs/engine/events/SendPortActivityEvent.cpp | 2 +- src/libs/engine/events/SendPortActivityEvent.hpp | 6 +- src/libs/engine/events/SendPortValueEvent.cpp | 2 +- src/libs/engine/events/SendPortValueEvent.hpp | 12 +- src/libs/engine/events/SetPolyphonicEvent.cpp | 2 +- src/libs/engine/events/SetPolyphonyEvent.cpp | 2 +- src/libs/engine/events/SetPortValueEvent.cpp | 12 +- src/libs/engine/events/SetPortValueEvent.hpp | 4 +- src/libs/engine/events/SetPortValueQueuedEvent.cpp | 2 +- src/libs/engine/events/SetPortValueQueuedEvent.hpp | 4 +- 84 files changed, 590 insertions(+), 648 deletions(-) delete mode 100644 src/libs/engine/DataType.hpp delete mode 100644 src/libs/engine/Port.cpp delete mode 100644 src/libs/engine/Port.hpp create mode 100644 src/libs/engine/PortImpl.cpp create mode 100644 src/libs/engine/PortImpl.hpp (limited to 'src/libs/engine') diff --git a/src/libs/engine/AudioBuffer.cpp b/src/libs/engine/AudioBuffer.cpp index 53fe6bb8..c302480a 100644 --- a/src/libs/engine/AudioBuffer.cpp +++ b/src/libs/engine/AudioBuffer.cpp @@ -29,7 +29,7 @@ namespace Ingen { AudioBuffer::AudioBuffer(size_t size) - : Buffer(DataType::FLOAT, size) + : Buffer((size == 1) ? DataType::CONTROL : DataType::AUDIO, size) , _data(NULL) , _local_data(NULL) , _joined_buf(NULL) @@ -187,7 +187,7 @@ AudioBuffer::copy(const Buffer* src, size_t start_sample, size_t end_sample) assert(end_sample >= start_sample); assert(end_sample < _size); assert(src); - assert(src->type() == DataType::FLOAT); + assert(src->type() == DataType::CONTROL || DataType::AUDIO); Sample* const buf = data(); assert(buf); diff --git a/src/libs/engine/AudioDriver.hpp b/src/libs/engine/AudioDriver.hpp index 8b4c0831..cb4c4150 100644 --- a/src/libs/engine/AudioDriver.hpp +++ b/src/libs/engine/AudioDriver.hpp @@ -22,13 +22,13 @@ #include #include "Driver.hpp" #include "types.hpp" -#include "DataType.hpp" +#include "interface/DataType.hpp" namespace Ingen { class Patch; class AudioDriver; -class Port; +class PortImpl; class ProcessContext; @@ -39,7 +39,7 @@ class ProcessContext; class AudioDriver : public Driver { public: - AudioDriver() : Driver(DataType::FLOAT) {} + AudioDriver() : Driver(DataType::AUDIO) {} virtual void set_root_patch(Patch* patch) = 0; virtual Patch* root_patch() = 0; diff --git a/src/libs/engine/Buffer.hpp b/src/libs/engine/Buffer.hpp index 44b69cbe..cb8f09d4 100644 --- a/src/libs/engine/Buffer.hpp +++ b/src/libs/engine/Buffer.hpp @@ -23,7 +23,7 @@ #include #include #include "types.hpp" -#include "DataType.hpp" +#include "interface/DataType.hpp" namespace Ingen { diff --git a/src/libs/engine/BufferFactory.cpp b/src/libs/engine/BufferFactory.cpp index 8c84fb81..882e1805 100644 --- a/src/libs/engine/BufferFactory.cpp +++ b/src/libs/engine/BufferFactory.cpp @@ -27,7 +27,7 @@ namespace BufferFactory { Buffer* create(DataType type, size_t size) { - if (type == DataType::FLOAT) + if (type == DataType::CONTROL || type == DataType::AUDIO) return new AudioBuffer(size); else if (type == DataType::MIDI) return new MidiBuffer(size); diff --git a/src/libs/engine/ClientBroadcaster.cpp b/src/libs/engine/ClientBroadcaster.cpp index 363b9f09..3c275e4a 100644 --- a/src/libs/engine/ClientBroadcaster.cpp +++ b/src/libs/engine/ClientBroadcaster.cpp @@ -26,7 +26,7 @@ #include "Patch.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "Connection.hpp" #include "AudioDriver.hpp" #include "ObjectSender.hpp" @@ -130,7 +130,7 @@ ClientBroadcaster::send_node(const NodeImpl* node, bool recursive) void -ClientBroadcaster::send_port(const Port* port) +ClientBroadcaster::send_port(const PortImpl* port) { for (Clients::const_iterator i = _clients.begin(); i != _clients.end(); ++i) ObjectSender::send_port((*i).second, port); diff --git a/src/libs/engine/ClientBroadcaster.hpp b/src/libs/engine/ClientBroadcaster.hpp index 50589005..e9e74b3a 100644 --- a/src/libs/engine/ClientBroadcaster.hpp +++ b/src/libs/engine/ClientBroadcaster.hpp @@ -31,7 +31,7 @@ using std::string; namespace Ingen { class NodeImpl; -class Port; +class PortImpl; class PluginImpl; class Patch; class Connection; @@ -64,7 +64,7 @@ public: void send_plugins(const std::list& plugin_list); void send_patch(const Patch* const p, bool recursive); void send_node(const NodeImpl* const node, bool recursive); - void send_port(const Port* port); + void send_port(const PortImpl* port); void send_destroyed(const string& path); void send_polyphonic(const string& path, bool polyphonic); void send_patch_cleared(const string& patch_path); diff --git a/src/libs/engine/Connection.cpp b/src/libs/engine/Connection.cpp index 5b45f6fc..0d54fe9f 100644 --- a/src/libs/engine/Connection.cpp +++ b/src/libs/engine/Connection.cpp @@ -20,7 +20,7 @@ #include "util.hpp" #include "Connection.hpp" #include "NodeImpl.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "BufferFactory.hpp" #include "AudioBuffer.hpp" #include "ProcessContext.hpp" @@ -33,7 +33,7 @@ namespace Ingen { * This handles both polyphonic and monophonic nodes, transparently to the * user (InputPort). */ -Connection::Connection(Port* src_port, Port* dst_port) +Connection::Connection(PortImpl* src_port, PortImpl* dst_port) : _src_port(src_port) , _dst_port(dst_port) , _local_buffer(NULL) @@ -85,7 +85,7 @@ Connection::set_buffer_size(size_t size) void Connection::prepare_poly(uint32_t poly) { - if (type() == DataType::FLOAT) + if (type() == DataType::CONTROL || type() == DataType::AUDIO) _must_mix = (poly > 1) && ( (_src_port->poly() != _dst_port->poly()) || (_src_port->polyphonic() && !_dst_port->polyphonic()) @@ -123,7 +123,7 @@ Connection::process(ProcessContext& context) * would avoid having to mix multiple times. Probably not a very common * case, but it would be faster anyway. */ - if (_must_mix && type() == DataType::FLOAT) { + if (_must_mix && type() == DataType::CONTROL || type() == DataType::AUDIO) { const AudioBuffer* const src_buffer = (AudioBuffer*)src_port()->buffer(0); AudioBuffer* mix_buf = (AudioBuffer*)_local_buffer; diff --git a/src/libs/engine/Connection.hpp b/src/libs/engine/Connection.hpp index 4a077a87..36dc0ee2 100644 --- a/src/libs/engine/Connection.hpp +++ b/src/libs/engine/Connection.hpp @@ -21,13 +21,13 @@ #include #include #include -#include "DataType.hpp" -#include "Port.hpp" +#include "interface/DataType.hpp" +#include "PortImpl.hpp" #include "types.hpp" namespace Ingen { -class Port; +class PortImpl; class Buffer; @@ -44,11 +44,11 @@ class Buffer; class Connection : public Raul::Deletable { public: - Connection(Port* src_port, Port* dst_port); + Connection(PortImpl* src_port, PortImpl* dst_port); virtual ~Connection(); - Port* src_port() const { return _src_port; } - Port* dst_port() const { return _dst_port; } + PortImpl* src_port() const { return _src_port; } + PortImpl* dst_port() const { return _dst_port; } /** Used by some (recursive) events to prevent double disconnections */ bool pending_disconnection() { return _pending_disconnection; } @@ -70,12 +70,12 @@ public: 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; + PortImpl* const _src_port; + PortImpl* const _dst_port; + Buffer* _local_buffer; + size_t _buffer_size; + bool _must_mix; + bool _pending_disconnection; }; diff --git a/src/libs/engine/DataType.hpp b/src/libs/engine/DataType.hpp deleted file mode 100644 index d883e95b..00000000 --- a/src/libs/engine/DataType.hpp +++ /dev/null @@ -1,86 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 DATATYPE_H -#define DATATYPE_H - -namespace Ingen -{ - - -/** A data type that can be stored in a Port. - * - * This type refers to the type of the entire buffer, mirroring LV2, - * e.g. :AudioPort and :ControlPort both are really 32-bit floating point, - * but they are different port types. - */ -class DataType { -public: - - enum Symbol { - UNKNOWN = 0, - AUDIO = 1, - CONTROL = 2, - MIDI = 3, - OSC = 4 - }; - - DataType(const std::string& uri) - : _symbol(UNKNOWN) - { - if (uri == type_uri(AUDIO)) { - _symbol = AUDIO; - } else if (uri == type_uri(CONTROL)) { - _symbol = CONTROL; - } else if (uri == type_uri(MIDI)) { - _symbol = MIDI; - } else if (uri == type_uri(OSC)) { - _symbol = OSC; - } - } - - DataType(Symbol symbol) - : _symbol(symbol) - {} - - const char* uri() const { return type_uri(_symbol); } - const Symbol& symbol() const { return _symbol; } - - inline bool operator==(const Symbol& symbol) const { return (_symbol == symbol); } - inline bool operator!=(const Symbol& symbol) const { return (_symbol != symbol); } - inline bool operator==(const DataType& type) const { return (_symbol == type._symbol); } - inline bool operator!=(const DataType& type) const { return (_symbol != type._symbol); } - -private: - Symbol _symbol; - - static inline const char* type_uri(unsigned symbol_num) { - switch (symbol_num) { - case 0: return "ingen:AudioPort"; - case 1: return "ingen:ControlPort"; - case 2: return "ingen:MidiPort"; - case 3: return "ingen:OSCPort"; - default: return ""; - } - } -}; - - - -} // namespace Ingen - -#endif // DATATYPE_H diff --git a/src/libs/engine/Driver.hpp b/src/libs/engine/Driver.hpp index 13a5a432..590b66b5 100644 --- a/src/libs/engine/Driver.hpp +++ b/src/libs/engine/Driver.hpp @@ -21,7 +21,7 @@ #include #include #include -#include "DataType.hpp" +#include "interface/DataType.hpp" #include "DuplexPort.hpp" namespace Ingen { diff --git a/src/libs/engine/DuplexPort.cpp b/src/libs/engine/DuplexPort.cpp index b349a7d6..83ba0e5a 100644 --- a/src/libs/engine/DuplexPort.cpp +++ b/src/libs/engine/DuplexPort.cpp @@ -30,12 +30,12 @@ namespace Ingen { DuplexPort::DuplexPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size, bool is_output) - : Port(parent, name, index, poly, type, buffer_size) + : PortImpl(parent, name, index, poly, type, buffer_size) , InputPort(parent, name, index, poly, type, buffer_size) , OutputPort(parent, name, index, poly, type, buffer_size) , _is_output(is_output) { - assert(Port::_parent == parent); + assert(PortImpl::_parent == parent); } diff --git a/src/libs/engine/Engine.cpp b/src/libs/engine/Engine.cpp index 382e2b8d..b5e14eb0 100644 --- a/src/libs/engine/Engine.cpp +++ b/src/libs/engine/Engine.cpp @@ -98,7 +98,7 @@ Engine::~Engine() Driver* Engine::driver(DataType type) { - if (type == DataType::FLOAT) + if (type == DataType::AUDIO) return _audio_driver.get(); else if (type == DataType::MIDI) return _midi_driver; diff --git a/src/libs/engine/Engine.hpp b/src/libs/engine/Engine.hpp index eb1f014b..f7e82c06 100644 --- a/src/libs/engine/Engine.hpp +++ b/src/libs/engine/Engine.hpp @@ -24,7 +24,7 @@ #include #include #include "module/module.h" -#include "DataType.hpp" +#include "interface/DataType.hpp" template class Queue; diff --git a/src/libs/engine/EventSink.cpp b/src/libs/engine/EventSink.cpp index 7fc7b157..6c775d4c 100644 --- a/src/libs/engine/EventSink.cpp +++ b/src/libs/engine/EventSink.cpp @@ -18,7 +18,7 @@ #include #include "events/SendPortValueEvent.hpp" #include "EventSink.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" using namespace std; diff --git a/src/libs/engine/EventSink.hpp b/src/libs/engine/EventSink.hpp index 4816a069..9e937d1a 100644 --- a/src/libs/engine/EventSink.hpp +++ b/src/libs/engine/EventSink.hpp @@ -26,7 +26,7 @@ namespace Ingen { -class Port; +class PortImpl; class Engine; class SendPortValueEvent; diff --git a/src/libs/engine/InputPort.cpp b/src/libs/engine/InputPort.cpp index 678e3d8d..6a4de550 100644 --- a/src/libs/engine/InputPort.cpp +++ b/src/libs/engine/InputPort.cpp @@ -32,7 +32,7 @@ namespace Ingen { InputPort::InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size) - : Port(parent, name, index, poly, type, buffer_size) + : PortImpl(parent, name, index, poly, type, buffer_size) { } @@ -40,7 +40,7 @@ InputPort::InputPort(NodeImpl* parent, const string& name, uint32_t index, uint3 void InputPort::set_buffer_size(size_t size) { - Port::set_buffer_size(size); + PortImpl::set_buffer_size(size); assert(_buffer_size = size); for (Raul::List::iterator c = _connections.begin(); c != _connections.end(); ++c) @@ -74,11 +74,11 @@ InputPort::add_connection(Raul::ListNode* const c) _buffers->at(i)->unjoin(); } } - Port::connect_buffers(); + PortImpl::connect_buffers(); } // Automatically broadcast connected control inputs - if (_type == DataType::FLOAT && _buffer_size == 1) + if (_type == DataType::CONTROL) _broadcast = true; } @@ -119,10 +119,10 @@ InputPort::remove_connection(const OutputPort* src_port) } if (modify_buffers) - Port::connect_buffers(); + PortImpl::connect_buffers(); // Turn off broadcasting if we're not connected any more (FIXME: not quite right..) - if (_type == DataType::FLOAT && _buffer_size == 1 && _connections.size() == 0) + if (_type == DataType::CONTROL && _connections.size() == 0) _broadcast = false; return connection; @@ -184,7 +184,7 @@ InputPort::pre_process(ProcessContext& context) return; } - if (_type == DataType::FLOAT) { + if (_type == DataType::CONTROL || _type == DataType::AUDIO) { for (uint32_t voice=0; voice < _poly; ++voice) { // Copy first connection _buffers->at(voice)->copy( diff --git a/src/libs/engine/InputPort.hpp b/src/libs/engine/InputPort.hpp index ffba62e6..228371f8 100644 --- a/src/libs/engine/InputPort.hpp +++ b/src/libs/engine/InputPort.hpp @@ -22,7 +22,7 @@ #include #include #include -#include "Port.hpp" +#include "PortImpl.hpp" #include "MidiBuffer.hpp" using std::string; @@ -44,7 +44,7 @@ class NodeImpl; * * \ingroup engine */ -class InputPort : virtual public Port +class InputPort : virtual public PortImpl { public: InputPort(NodeImpl* parent, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size); diff --git a/src/libs/engine/JackAudioDriver.cpp b/src/libs/engine/JackAudioDriver.cpp index c8350b5c..d1cde5ca 100644 --- a/src/libs/engine/JackAudioDriver.cpp +++ b/src/libs/engine/JackAudioDriver.cpp @@ -30,7 +30,7 @@ #include "PostProcessor.hpp" #include "NodeImpl.hpp" #include "Patch.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "MidiDriver.hpp" #include "DuplexPort.hpp" #include "EventSource.hpp" diff --git a/src/libs/engine/JackAudioDriver.hpp b/src/libs/engine/JackAudioDriver.hpp index 07877e6f..cc19a8e8 100644 --- a/src/libs/engine/JackAudioDriver.hpp +++ b/src/libs/engine/JackAudioDriver.hpp @@ -31,7 +31,7 @@ namespace Ingen { class Engine; class Patch; -class Port; +class PortImpl; class DuplexPort; class JackAudioDriver; typedef jack_default_audio_sample_t jack_sample_t; diff --git a/src/libs/engine/LADSPANode.cpp b/src/libs/engine/LADSPANode.cpp index f7b32072..9c2da41e 100644 --- a/src/libs/engine/LADSPANode.cpp +++ b/src/libs/engine/LADSPANode.cpp @@ -57,7 +57,7 @@ bool LADSPANode::instantiate() { if (!_ports) - _ports = new Raul::Array(_descriptor->PortCount); + _ports = new Raul::Array(_descriptor->PortCount); _instances = new LADSPA_Handle[_polyphony]; @@ -74,7 +74,7 @@ LADSPANode::instantiate() string port_name; string port_path; - Port* port = NULL; + PortImpl* port = NULL; for (size_t j=0; j < _descriptor->PortCount; ++j) { port_name = Path::nameify(_descriptor->PortNames[j]); @@ -101,19 +101,23 @@ LADSPANode::instantiate() port_path = path() + "/" + port_name; - if (LADSPA_IS_PORT_CONTROL(_descriptor->PortDescriptors[j])) + DataType type = DataType::AUDIO; + port_buffer_size = _buffer_size; + + if (LADSPA_IS_PORT_CONTROL(_descriptor->PortDescriptors[j])) { + type = DataType::CONTROL; port_buffer_size = 1; - else if (LADSPA_IS_PORT_AUDIO(_descriptor->PortDescriptors[j])) - port_buffer_size = _buffer_size; - + } else { + assert(LADSPA_IS_PORT_AUDIO(_descriptor->PortDescriptors[j])); + } assert (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j]) || LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])); if (LADSPA_IS_PORT_INPUT(_descriptor->PortDescriptors[j])) { - port = new InputPort(this, port_name, j, _polyphony, DataType::FLOAT, port_buffer_size); + port = new InputPort(this, port_name, j, _polyphony, type, port_buffer_size); _ports->at(j) = port; } else if (LADSPA_IS_PORT_OUTPUT(_descriptor->PortDescriptors[j])) { - port = new OutputPort(this, port_name, j, _polyphony, DataType::FLOAT, port_buffer_size); + port = new OutputPort(this, port_name, j, _polyphony, type, port_buffer_size); _ports->at(j) = port; } diff --git a/src/libs/engine/LV2Node.cpp b/src/libs/engine/LV2Node.cpp index c37a2665..ed330d6d 100644 --- a/src/libs/engine/LV2Node.cpp +++ b/src/libs/engine/LV2Node.cpp @@ -126,7 +126,7 @@ LV2Node::instantiate() uint32_t num_ports = slv2_plugin_get_num_ports(_lv2_plugin); assert(num_ports > 0); - _ports = new Raul::Array(num_ports, NULL); + _ports = new Raul::Array(num_ports, NULL); _instances = new Raul::Array(_polyphony, NULL); @@ -143,7 +143,7 @@ LV2Node::instantiate() string port_name; string port_path; - Port* port = NULL; + PortImpl* port = NULL; for (uint32_t j=0; j < num_ports; ++j) { SLV2Port id = slv2_plugin_get_port_by_index(_lv2_plugin, j); @@ -167,12 +167,13 @@ LV2Node::instantiate() DataType data_type = DataType::UNKNOWN; switch (port_type) { case SLV2_PORT_DATA_TYPE_CONTROL: + data_type = DataType::CONTROL; break; case SLV2_PORT_DATA_TYPE_AUDIO: - data_type = DataType::FLOAT; break; + data_type = DataType::AUDIO; break; case SLV2_PORT_DATA_TYPE_MIDI: data_type = DataType::MIDI; break; case SLV2_PORT_DATA_TYPE_OSC: - data_type = DataType::OSC; + data_type = DataType::OSC; break; default: break; } @@ -217,14 +218,14 @@ LV2Node::activate() for (uint32_t i=0; i < _polyphony; ++i) { for (unsigned long j=0; j < num_ports(); ++j) { - Port* const port = _ports->at(j); + PortImpl* const port = _ports->at(j); set_port_buffer(i, j, port->buffer(i)); - if (port->type() == DataType::FLOAT && port->buffer_size() == 1) { + if (port->type() == DataType::CONTROL) { ((AudioBuffer*)port->buffer(i))->set( slv2_port_get_default_value(_lv2_plugin, slv2_plugin_get_port_by_index(_lv2_plugin, j)), 0); - } else if (port->type() == DataType::FLOAT) { + } else if (port->type() == DataType::AUDIO) { ((AudioBuffer*)port->buffer(i))->set(0.0f, 0); } } diff --git a/src/libs/engine/Makefile.am b/src/libs/engine/Makefile.am index 91d48fd7..8b037fb9 100644 --- a/src/libs/engine/Makefile.am +++ b/src/libs/engine/Makefile.am @@ -31,7 +31,6 @@ libingen_engine_la_SOURCES = \ Connection.cpp \ Connection.hpp \ CompiledPatch.hpp \ - DataType.hpp \ Driver.hpp \ DuplexPort.cpp \ DuplexPort.hpp \ @@ -82,8 +81,8 @@ libingen_engine_la_SOURCES = \ Patch.hpp \ PluginImpl.cpp \ PluginImpl.hpp \ - Port.cpp \ - Port.hpp \ + PortImpl.cpp \ + PortImpl.hpp \ PostProcessor.cpp \ PostProcessor.hpp \ ProcessContext.hpp \ diff --git a/src/libs/engine/MidiBuffer.hpp b/src/libs/engine/MidiBuffer.hpp index f1948666..fe3d36bb 100644 --- a/src/libs/engine/MidiBuffer.hpp +++ b/src/libs/engine/MidiBuffer.hpp @@ -20,7 +20,7 @@ #include #include "Buffer.hpp" -#include "DataType.hpp" +#include "interface/DataType.hpp" namespace Ingen { diff --git a/src/libs/engine/MidiControlNode.cpp b/src/libs/engine/MidiControlNode.cpp index bf2564d0..5bc14182 100644 --- a/src/libs/engine/MidiControlNode.cpp +++ b/src/libs/engine/MidiControlNode.cpp @@ -34,34 +34,34 @@ MidiControlNode::MidiControlNode(const string& path, bool polyphonic, Patch* par : NodeBase(new PluginImpl(Plugin::Internal, "ingen:control_node"), path, false, parent, srate, buffer_size), _learning(false) { - _ports = new Raul::Array(7); + _ports = new Raul::Array(7); _midi_in_port = new InputPort(this, "MIDIIn", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; - _param_port = new InputPort(this, "ControllerNumber", 1, 1, DataType::FLOAT, 1); + _param_port = new InputPort(this, "ControllerNumber", 1, 1, DataType::CONTROL, 1); _param_port->set_metadata("ingen:minimum", 0.0f); _param_port->set_metadata("ingen:maximum", 127.0f); _param_port->set_metadata("ingen:default", 0.0f); _param_port->set_metadata("ingen:integer", 1); _ports->at(1) = _param_port; - _log_port = new InputPort(this, "Logarithmic", 2, 1, DataType::FLOAT, 1); + _log_port = new InputPort(this, "Logarithmic", 2, 1, DataType::CONTROL, 1); _log_port->set_metadata("ingen:toggled", 1); _log_port->set_metadata("ingen:default", 0.0f); _ports->at(2) = _log_port; - _min_port = new InputPort(this, "Min", 3, 1, DataType::FLOAT, 1); + _min_port = new InputPort(this, "Min", 3, 1, DataType::CONTROL, 1); _min_port->set_metadata("ingen:default", 0.0f); _ports->at(3) = _min_port; - _max_port = new InputPort(this, "Max", 4, 1, DataType::FLOAT, 1); + _max_port = new InputPort(this, "Max", 4, 1, DataType::CONTROL, 1); _ports->at(4) = _max_port; - _audio_port = new OutputPort(this, "Out(AR)", 5, 1, DataType::FLOAT, _buffer_size); + _audio_port = new OutputPort(this, "Out(AR)", 5, 1, DataType::AUDIO, _buffer_size); _ports->at(5) = _audio_port; - _control_port = new OutputPort(this, "Out(CR)", 6, 1, DataType::FLOAT, 1); + _control_port = new OutputPort(this, "Out(CR)", 6, 1, DataType::CONTROL, 1); _ports->at(6) = _control_port; PluginImpl* p = const_cast(_plugin); diff --git a/src/libs/engine/MidiNoteNode.cpp b/src/libs/engine/MidiNoteNode.cpp index b3d69ac2..146a0978 100644 --- a/src/libs/engine/MidiNoteNode.cpp +++ b/src/libs/engine/MidiNoteNode.cpp @@ -44,25 +44,25 @@ MidiNoteNode::MidiNoteNode(const string& path, bool polyphonic, Patch* parent, S _sustain(false) { - _ports = new Raul::Array(5); + _ports = new Raul::Array(5); _midi_in_port = new InputPort(this, "MIDIIn", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; - _freq_port = new OutputPort(this, "Frequency", 1, _polyphony, DataType::FLOAT, _buffer_size); + _freq_port = new OutputPort(this, "Frequency", 1, _polyphony, DataType::AUDIO, _buffer_size); _ports->at(1) = _freq_port; - _vel_port = new OutputPort(this, "Velocity", 2, _polyphony, DataType::FLOAT, _buffer_size); + _vel_port = new OutputPort(this, "Velocity", 2, _polyphony, DataType::AUDIO, _buffer_size); _vel_port->set_metadata("ingen:minimum", 0.0f); _vel_port->set_metadata("ingen:maximum", 1.0f); _ports->at(2) = _vel_port; - _gate_port = new OutputPort(this, "Gate", 3, _polyphony, DataType::FLOAT, _buffer_size); + _gate_port = new OutputPort(this, "Gate", 3, _polyphony, DataType::AUDIO, _buffer_size); _gate_port->set_metadata("ingen:toggled", 1); _gate_port->set_metadata("ingen:default", 0.0f); _ports->at(3) = _gate_port; - _trig_port = new OutputPort(this, "Trigger", 4, _polyphony, DataType::FLOAT, _buffer_size); + _trig_port = new OutputPort(this, "Trigger", 4, _polyphony, DataType::AUDIO, _buffer_size); _trig_port->set_metadata("ingen:toggled", 1); _trig_port->set_metadata("ingen:default", 0.0f); _ports->at(4) = _trig_port; diff --git a/src/libs/engine/MidiTriggerNode.cpp b/src/libs/engine/MidiTriggerNode.cpp index 7490fcc0..6d7da38a 100644 --- a/src/libs/engine/MidiTriggerNode.cpp +++ b/src/libs/engine/MidiTriggerNode.cpp @@ -31,25 +31,25 @@ namespace Ingen { MidiTriggerNode::MidiTriggerNode(const string& path, bool polyphonic, Patch* parent, SampleRate srate, size_t buffer_size) : NodeBase(new PluginImpl(Plugin::Internal, "ingen:trigger_node"), path, false, parent, srate, buffer_size) { - _ports = new Raul::Array(5); + _ports = new Raul::Array(5); _midi_in_port = new InputPort(this, "MIDIIn", 0, 1, DataType::MIDI, _buffer_size); _ports->at(0) = _midi_in_port; - _note_port = new InputPort(this, "NoteNumber", 1, 1, DataType::FLOAT, 1); + _note_port = new InputPort(this, "NoteNumber", 1, 1, DataType::CONTROL, 1); _note_port->set_metadata("ingen:minimum", 0.0f); _note_port->set_metadata("ingen:maximum", 127.0f); _note_port->set_metadata("ingen:default", 60.0f); _note_port->set_metadata("ingen:integer", 1); _ports->at(1) = _note_port; - _gate_port = new OutputPort(this, "Gate", 2, 1, DataType::FLOAT, _buffer_size); + _gate_port = new OutputPort(this, "Gate", 2, 1, DataType::AUDIO, _buffer_size); _ports->at(2) = _gate_port; - _trig_port = new OutputPort(this, "Trigger", 3, 1, DataType::FLOAT, _buffer_size); + _trig_port = new OutputPort(this, "Trigger", 3, 1, DataType::AUDIO, _buffer_size); _ports->at(3) = _trig_port; - _vel_port = new OutputPort(this, "Velocity", 4, 1, DataType::FLOAT, _buffer_size); + _vel_port = new OutputPort(this, "Velocity", 4, 1, DataType::AUDIO, _buffer_size); _ports->at(4) = _vel_port; PluginImpl* p = const_cast(_plugin); diff --git a/src/libs/engine/NodeBase.cpp b/src/libs/engine/NodeBase.cpp index d5400cdf..d5e75970 100644 --- a/src/libs/engine/NodeBase.cpp +++ b/src/libs/engine/NodeBase.cpp @@ -24,7 +24,7 @@ #include "util.hpp" #include "PluginImpl.hpp" #include "ClientBroadcaster.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "Patch.hpp" #include "ObjectStore.hpp" @@ -66,6 +66,20 @@ NodeBase::~NodeBase() delete _ports->at(i); } + +Port* +NodeBase::port(uint32_t index) const +{ + return (*_ports)[index]; +} + + +const Plugin* +NodeBase::plugin() const +{ + return _plugin; +} + void NodeBase::activate() diff --git a/src/libs/engine/NodeBase.hpp b/src/libs/engine/NodeBase.hpp index 2e4480b8..9aa26310 100644 --- a/src/libs/engine/NodeBase.hpp +++ b/src/libs/engine/NodeBase.hpp @@ -23,6 +23,7 @@ #include #include #include +#include "interface/Port.hpp" #include "NodeImpl.hpp" using std::string; @@ -84,7 +85,8 @@ public: bool traversed() const { return _traversed; } void traversed(bool b) { _traversed = b; } - const Raul::Array& ports() const { return *_ports; } + virtual Port* port(uint32_t index) const; + virtual PortImpl* port_impl(uint32_t index) const { return (*_ports)[index]; } /* These are NOT to be used in the audio thread! * The providers and dependants in CompiledNode are for that @@ -96,8 +98,9 @@ public: Raul::List* dependants() { return _dependants; } void dependants(Raul::List* l) { _dependants = l; } - virtual const PluginImpl* plugin() const { return _plugin; } - virtual void plugin(const PluginImpl* const pi) { _plugin = pi; } + virtual const Plugin* plugin() const; + virtual const PluginImpl* plugin_impl() const { return _plugin; } + virtual void plugin(const PluginImpl* pi) { _plugin = pi; } /** A node's parent is always a patch, so static cast should be safe */ inline Patch* parent_patch() const { return (Patch*)_parent; } @@ -112,13 +115,13 @@ protected: size_t _buffer_size; bool _activated; - bool _traversed; ///< Flag for process order algorithm - Raul::Semaphore _input_ready; ///< Parallelism: input ready signal - Raul::AtomicInt _process_lock; ///< Parallelism: Waiting on inputs 'lock' - Raul::AtomicInt _n_inputs_ready; ///< Parallelism: # input ready signals this cycle - Raul::Array* _ports; ///< Access in audio thread only - Raul::List* _providers; ///< Nodes connected to this one's input ports - Raul::List* _dependants; ///< Nodes this one's output ports are connected to + bool _traversed; ///< Flag for process order algorithm + Raul::Semaphore _input_ready; ///< Parallelism: input ready signal + Raul::AtomicInt _process_lock; ///< Parallelism: Waiting on inputs 'lock' + Raul::AtomicInt _n_inputs_ready; ///< Parallelism: # input ready signals this cycle + Raul::Array* _ports; ///< Access in audio thread only + Raul::List* _providers; ///< Nodes connected to this one's input ports + Raul::List* _dependants; ///< Nodes this one's output ports are connected to }; diff --git a/src/libs/engine/NodeFactory.cpp b/src/libs/engine/NodeFactory.cpp index 1e05b923..cef8e9a4 100644 --- a/src/libs/engine/NodeFactory.cpp +++ b/src/libs/engine/NodeFactory.cpp @@ -59,16 +59,16 @@ NodeFactory::NodeFactory(Ingen::Shared::World* world) NodeImpl* n = NULL; n = new MidiNoteNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new PluginImpl(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin_impl())); delete n; n = new MidiTriggerNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new PluginImpl(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin_impl())); delete n; n = new MidiControlNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new PluginImpl(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin_impl())); delete n; n = new TransportNode("foo", 1, parent, 1, 1); - _internal_plugins.push_back(new PluginImpl(n->plugin())); + _internal_plugins.push_back(new PluginImpl(n->plugin_impl())); delete n; delete parent; diff --git a/src/libs/engine/NodeImpl.hpp b/src/libs/engine/NodeImpl.hpp index 70a09c33..f139cde0 100644 --- a/src/libs/engine/NodeImpl.hpp +++ b/src/libs/engine/NodeImpl.hpp @@ -28,10 +28,14 @@ namespace Raul { template class List; class Maid; } namespace Ingen { +namespace Shared { class Plugin; class Node; class Port; } + +using namespace Shared; + class Buffer; class PluginImpl; class Patch; -class Port; +class PortImpl; /** A Node (or "module") in a Patch (which is also a Node). @@ -118,10 +122,10 @@ public: virtual void set_port_buffer(uint32_t voice, uint32_t port_num, Buffer* buf) = 0; - // FIXME: Only used by client senders. Remove? - virtual const Raul::Array& ports() const = 0; - virtual uint32_t num_ports() const = 0; + + virtual Port* port(uint32_t index) const = 0; + virtual PortImpl* port_impl(uint32_t index) const = 0; /** Used by the process order finding algorithm (ie during connections) */ virtual bool traversed() const = 0; @@ -145,7 +149,12 @@ public: /** Information about the Plugin this Node is an instance of. * Not the best name - not all nodes come from plugins (ie Patch) */ - virtual const PluginImpl* plugin() const = 0; + virtual const PluginImpl* plugin_impl() const = 0; + + /** Information about the Plugin this Node is an instance of. + * Not the best name - not all nodes come from plugins (ie Patch) + */ + virtual const Shared::Plugin* plugin() const = 0; virtual void set_buffer_size(size_t size) = 0; }; diff --git a/src/libs/engine/OSCBuffer.cpp b/src/libs/engine/OSCBuffer.cpp index 44cf3235..d3d1c952 100644 --- a/src/libs/engine/OSCBuffer.cpp +++ b/src/libs/engine/OSCBuffer.cpp @@ -54,7 +54,7 @@ OSCBuffer::join(Buffer* buf) _joined_buf = obuf; - cerr << "OSC buffer joined" << endl; + //cerr << "OSC buffer joined" << endl; //_state = mbuf->_state; diff --git a/src/libs/engine/OSCBuffer.hpp b/src/libs/engine/OSCBuffer.hpp index 1d3758e5..d70474a2 100644 --- a/src/libs/engine/OSCBuffer.hpp +++ b/src/libs/engine/OSCBuffer.hpp @@ -19,7 +19,7 @@ #define OSCBUFFER_H #include "Buffer.hpp" -#include "DataType.hpp" +#include "interface/DataType.hpp" #include "../../../../lv2/extensions/osc/lv2_osc.h" namespace Ingen { diff --git a/src/libs/engine/OSCClientSender.cpp b/src/libs/engine/OSCClientSender.cpp index 1d1a9323..ff0b2037 100644 --- a/src/libs/engine/OSCClientSender.cpp +++ b/src/libs/engine/OSCClientSender.cpp @@ -26,7 +26,7 @@ #include "Patch.hpp" #include "NodeImpl.hpp" #include "PluginImpl.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "Connection.hpp" #include "AudioDriver.hpp" #include "interface/ClientInterface.hpp" diff --git a/src/libs/engine/ObjectSender.cpp b/src/libs/engine/ObjectSender.cpp index 7cbf028a..fb1039c7 100644 --- a/src/libs/engine/ObjectSender.cpp +++ b/src/libs/engine/ObjectSender.cpp @@ -20,11 +20,11 @@ #include "ObjectStore.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Port.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" +#include "PortImpl.hpp" #include "Connection.hpp" #include "NodeFactory.hpp" -#include "DataType.hpp" +#include "interface/DataType.hpp" #include "AudioBuffer.hpp" namespace Ingen { @@ -48,7 +48,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur // Send ports for (uint32_t i=0; i < patch->num_ports(); ++i) { - Port* const port = patch->ports().at(i); + PortImpl* const port = patch->port_impl(i); send_port(client, port); } @@ -77,7 +77,7 @@ ObjectSender::send_patch(ClientInterface* client, const Patch* patch, bool recur void ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recursive) { - const PluginImpl* const plugin = node->plugin(); + const PluginImpl* const plugin = node->plugin_impl(); assert(node->path().length() > 0); @@ -93,7 +93,7 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu client->bundle_begin(); - client->new_node(node->plugin()->uri(), node->path(), node->polyphonic(), node->ports().size()); + client->new_node(node->plugin()->uri(), node->path(), node->polyphonic(), node->num_ports()); // Send metadata const GraphObjectImpl::MetadataMap& data = node->metadata(); @@ -104,37 +104,20 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu if (recursive) { // Send ports - for (size_t j=0; j < node->ports().size(); ++j) - send_port(client, node->ports().at(j)); + for (size_t j=0; j < node->num_ports(); ++j) + send_port(client, node->port_impl(j)); } } void -ObjectSender::send_port(ClientInterface* client, const Port* port) +ObjectSender::send_port(ClientInterface* client, const PortImpl* port) { assert(port); - //cerr << "Sending port " << port->path(); - - // FIXME: temporary compatibility hack - string type = port->type().uri(); - if (port->type() == DataType::FLOAT) { - if (port->buffer_size() == 1) - type = "ingen:control"; - else - type = "ingen:audio"; - } else if (port->type() == DataType::MIDI) { - type = "ingen:midi"; - } else if (port->type() == DataType::OSC) { - type = "ingen:osc"; - } - - //cerr << ", type = " << type << endl; - client->bundle_begin(); - client->new_port(port->path(), type, port->is_output()); + client->new_port(port->path(), port->type().uri(), port->is_output()); // Send metadata const GraphObjectImpl::MetadataMap& data = port->metadata(); @@ -142,7 +125,7 @@ ObjectSender::send_port(ClientInterface* client, const Port* port) client->metadata_update(port->path(), (*j).first, (*j).second); // Send control value - if (port->type() == DataType::FLOAT && port->buffer_size() == 1) { + if (port->type() == DataType::CONTROL) { const Sample value = dynamic_cast(port->buffer(0))->value_at(0); //cerr << port->path() << " sending default value " << default_value << endl; client->control_change(port->path(), value); diff --git a/src/libs/engine/ObjectSender.hpp b/src/libs/engine/ObjectSender.hpp index c93804ba..e1274708 100644 --- a/src/libs/engine/ObjectSender.hpp +++ b/src/libs/engine/ObjectSender.hpp @@ -28,7 +28,7 @@ namespace Shared { class Patch; class NodeImpl; -class Port; +class PortImpl; class PluginImpl; @@ -48,7 +48,7 @@ public: static void send_patch(ClientInterface* client, const Patch* patch, bool recursive); static void send_node(ClientInterface* client, const NodeImpl* node, bool recursive); - static void send_port(ClientInterface* client, const Port* port); + static void send_port(ClientInterface* client, const PortImpl* port); }; } // namespace Ingen diff --git a/src/libs/engine/ObjectStore.cpp b/src/libs/engine/ObjectStore.cpp index b321e51c..719770ed 100644 --- a/src/libs/engine/ObjectStore.cpp +++ b/src/libs/engine/ObjectStore.cpp @@ -23,7 +23,7 @@ #include "ObjectStore.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ThreadManager.hpp" using namespace std; @@ -54,11 +54,11 @@ ObjectStore::find_node(const Path& path) /** Find the Port at the given path. */ -Port* +PortImpl* ObjectStore::find_port(const Path& path) { GraphObjectImpl* const object = find_object(path); - return dynamic_cast(object); + return dynamic_cast(object); } @@ -85,7 +85,7 @@ ObjectStore::add(GraphObjectImpl* o) NodeImpl* node = dynamic_cast(o); if (node) { for (uint32_t i=0; i < node->num_ports(); ++i) { - add(node->ports().at(i)); + add(node->port_impl(i)); } } } diff --git a/src/libs/engine/ObjectStore.hpp b/src/libs/engine/ObjectStore.hpp index e99450ab..66d182ba 100644 --- a/src/libs/engine/ObjectStore.hpp +++ b/src/libs/engine/ObjectStore.hpp @@ -28,7 +28,7 @@ namespace Ingen { class Patch; class NodeImpl; -class Port; +class PortImpl; class GraphObjectImpl; @@ -48,7 +48,7 @@ public: Patch* find_patch(const Path& path); NodeImpl* find_node(const Path& path); - Port* find_port(const Path& path); + PortImpl* find_port(const Path& path); GraphObjectImpl* find_object(const Path& path); Objects::iterator find(const Path& path) { return _objects.find(path); } diff --git a/src/libs/engine/OutputPort.hpp b/src/libs/engine/OutputPort.hpp index 54f4f2bc..1db9e4d9 100644 --- a/src/libs/engine/OutputPort.hpp +++ b/src/libs/engine/OutputPort.hpp @@ -20,7 +20,7 @@ #include #include -#include "Port.hpp" +#include "PortImpl.hpp" #include "types.hpp" namespace Ingen { @@ -37,7 +37,7 @@ namespace Ingen { * * \ingroup engine */ -class OutputPort : virtual public Port +class OutputPort : virtual public PortImpl { public: OutputPort(NodeImpl* parent, @@ -46,7 +46,7 @@ public: uint32_t poly, DataType type, size_t buffer_size) - : Port(parent, name, index, poly, type, buffer_size) + : PortImpl(parent, name, index, poly, type, buffer_size) {} void pre_process(ProcessContext& context); diff --git a/src/libs/engine/Patch.cpp b/src/libs/engine/Patch.cpp index 0619c743..6f3b0a48 100644 --- a/src/libs/engine/Patch.cpp +++ b/src/libs/engine/Patch.cpp @@ -22,7 +22,7 @@ #include "NodeImpl.hpp" #include "Patch.hpp" #include "PluginImpl.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "Connection.hpp" #include "DuplexPort.hpp" #include "Engine.hpp" @@ -103,7 +103,7 @@ Patch::disable() { _process = false; - for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) + for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) (*i)->clear_buffers(); } @@ -285,7 +285,7 @@ Patch::remove_node(const string& name) /** Remove a connection. Realtime safe. */ Raul::ListNode* -Patch::remove_connection(const Port* src_port, const Port* dst_port) +Patch::remove_connection(const PortImpl* src_port, const PortImpl* dst_port) { bool found = false; Raul::ListNode* connection = NULL; @@ -317,7 +317,7 @@ Patch::num_ports() const /** Create a port. Not realtime safe. */ -Port* +PortImpl* Patch::create_port(const string& name, DataType type, size_t buffer_size, bool is_output) { if (type == DataType::UNKNOWN) { @@ -338,14 +338,14 @@ Patch::create_port(const string& name, DataType type, size_t buffer_size, bool i * * Realtime safe. Preprocessing thread only. */ -Raul::ListNode* +Raul::ListNode* Patch::remove_port(const string& name) { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); bool found = false; - Raul::ListNode* ret = NULL; - for (Raul::List::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) { + Raul::ListNode* ret = NULL; + for (Raul::List::iterator i = _input_ports.begin(); i != _input_ports.end(); ++i) { if ((*i)->name() == name) { ret = _input_ports.erase(i); found = true; @@ -353,7 +353,7 @@ Patch::remove_port(const string& name) } if (!found) - for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) { + for (Raul::List::iterator i = _output_ports.begin(); i != _output_ports.end(); ++i) { if ((*i)->name() == name) { ret = _output_ports.erase(i); found = true; @@ -367,19 +367,19 @@ Patch::remove_port(const string& name) } -Raul::Array* +Raul::Array* Patch::build_ports_array() const { assert(ThreadManager::current_thread_id() == THREAD_PRE_PROCESS); - Raul::Array* const result = new Raul::Array(_input_ports.size() + _output_ports.size()); + Raul::Array* const result = new Raul::Array(_input_ports.size() + _output_ports.size()); size_t i = 0; - for (Raul::List::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i) + for (Raul::List::const_iterator p = _input_ports.begin(); p != _input_ports.end(); ++p,++i) result->at(i) = *p; - for (Raul::List::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i) + for (Raul::List::const_iterator p = _output_ports.begin(); p != _output_ports.end(); ++p,++i) result->at(i) = *p; return result; diff --git a/src/libs/engine/Patch.hpp b/src/libs/engine/Patch.hpp index ddcc1c93..66372c3c 100644 --- a/src/libs/engine/Patch.hpp +++ b/src/libs/engine/Patch.hpp @@ -23,7 +23,7 @@ #include #include "NodeBase.hpp" #include "PluginImpl.hpp" -#include "DataType.hpp" +#include "interface/DataType.hpp" #include "CompiledPatch.hpp" using std::string; @@ -94,22 +94,22 @@ public: uint32_t num_ports() const; - Port* create_port(const string& name, DataType type, size_t buffer_size, bool is_output); - void add_input(Raul::ListNode* port) { _input_ports.push_back(port); } ///< Preprocesser thread - void add_output(Raul::ListNode* port) { _output_ports.push_back(port); } ///< Preprocessor thread - Raul::ListNode* remove_port(const string& name); + PortImpl* create_port(const string& name, DataType type, size_t buffer_size, bool is_output); + void add_input(Raul::ListNode* port) { _input_ports.push_back(port); } ///< Preprocesser thread + void add_output(Raul::ListNode* port) { _output_ports.push_back(port); } ///< Preprocessor thread + Raul::ListNode* remove_port(const string& name); void add_connection(Raul::ListNode* c) { _connections.push_back(c); } - Raul::ListNode* remove_connection(const Port* src_port, const Port* dst_port); + Raul::ListNode* remove_connection(const PortImpl* src_port, const PortImpl* dst_port); CompiledPatch* compiled_patch() { return _compiled_patch; } void compiled_patch(CompiledPatch* cp) { _compiled_patch = cp; } - Raul::Array* external_ports() { return _ports; } - void external_ports(Raul::Array* pa) { _ports = pa; } + Raul::Array* external_ports() { return _ports; } + void external_ports(Raul::Array* pa) { _ports = pa; } - CompiledPatch* compile() const; - Raul::Array* build_ports_array() const; + CompiledPatch* compile() const; + Raul::Array* build_ports_array() const; /** Whether to run this patch's DSP bits in the audio thread */ bool enabled() const { return _process; } @@ -127,8 +127,8 @@ private: uint32_t _internal_poly; CompiledPatch* _compiled_patch; ///< Accessed in audio thread only Raul::List _connections; ///< Accessed in audio thread only - Raul::List _input_ports; ///< Accessed in preprocessing thread only - Raul::List _output_ports; ///< Accessed in preprocessing thread only + Raul::List _input_ports; ///< Accessed in preprocessing thread only + Raul::List _output_ports; ///< Accessed in preprocessing thread only Raul::List _nodes; ///< Accessed in preprocessing thread only bool _process; }; diff --git a/src/libs/engine/Port.cpp b/src/libs/engine/Port.cpp deleted file mode 100644 index 2e0c362e..00000000 --- a/src/libs/engine/Port.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 - */ - -#include -#include -#include -#include "Port.hpp" -#include "NodeImpl.hpp" -#include "DataType.hpp" -#include "AudioBuffer.hpp" -#include "MidiBuffer.hpp" -#include "BufferFactory.hpp" -#include "ProcessContext.hpp" -#include "SendPortActivityEvent.hpp" - -using namespace std; - -namespace Ingen { - - -// FIXME: Make these actually URIs.. -const char* const DataType::type_uris[4] = { "UNKNOWN", "FLOAT", "MIDI", "OSC" }; - - -Port::Port(NodeImpl* const node, const string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size) - : GraphObjectImpl(node, name, true) - , _index(index) - , _poly(poly) - , _buffer_size(buffer_size) - , _type(type) - , _fixed_buffers(false) - , _broadcast(false) - , _last_broadcasted_value(0.0f) // default? - , _buffers(new Raul::Array(poly)) -{ - assert(node != NULL); - assert(_poly > 0); - - allocate_buffers(); - clear_buffers(); - - if (node->parent() == NULL) - _polyphonic = false; - - if (type == DataType::MIDI) - _broadcast = true; // send activity blips - - assert(_buffers->size() > 0); -} - - -Port::~Port() -{ - for (uint32_t i=0; i < _poly; ++i) - delete _buffers->at(i); - - delete _buffers; -} - - -bool -Port::prepare_poly(uint32_t poly) -{ - if (!_polyphonic || !_parent->polyphonic()) - return true; - - /* FIXME: poly never goes down, harsh on memory.. */ - if (poly > _poly) { - _prepared_buffers = new Raul::Array(poly, *_buffers); - for (uint32_t i = _poly; i < _prepared_buffers->size(); ++i) - _prepared_buffers->at(i) = BufferFactory::create(_type, _buffer_size); - } - - return true; -} - - -bool -Port::apply_poly(Raul::Maid& maid, uint32_t poly) -{ - if (!_polyphonic || !_parent->polyphonic()) - return true; - - assert(poly <= _prepared_buffers->size()); - - // Apply a new set of buffers from a preceding call to prepare_poly - if (_prepared_buffers && _buffers != _prepared_buffers) { - maid.push(_buffers); - _buffers = _prepared_buffers; - } - - _poly = poly; - - connect_buffers(); - - return true; -} - - -void -Port::allocate_buffers() -{ - _buffers->alloc(_poly); - - for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i) = BufferFactory::create(_type, _buffer_size); -} - - -void -Port::set_buffer_size(size_t size) -{ - _buffer_size = size; - - for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i)->resize(size); - - connect_buffers(); -} - - -void -Port::connect_buffers() -{ - for (uint32_t i=0; i < _poly; ++i) - Port::parent_node()->set_port_buffer(i, _index, _buffers->at(i)); -} - - -void -Port::clear_buffers() -{ - for (uint32_t i=0; i < _poly; ++i) - _buffers->at(i)->clear(); -} - - -void -Port::broadcast(ProcessContext& context) -{ - if (_broadcast) { - if (_type == DataType::FLOAT && _buffer_size == 1) { - const Sample value = ((AudioBuffer*)(*_buffers)[0])->value_at(0); - if (value != _last_broadcasted_value) { - const SendPortValueEvent ev(context.engine(), context.start(), this, false, 0, value); - context.event_sink().write(sizeof(ev), &ev); - _last_broadcasted_value = value; - } - } else if (_type == DataType::MIDI) { - if (((MidiBuffer*)(*_buffers)[0])->event_count() > 0) { - const SendPortActivityEvent ev(context.engine(), context.start(), this); - context.event_sink().write(sizeof(ev), &ev); - } - } - } -} - - - -} // namespace Ingen diff --git a/src/libs/engine/Port.hpp b/src/libs/engine/Port.hpp deleted file mode 100644 index 2484ea1f..00000000 --- a/src/libs/engine/Port.hpp +++ /dev/null @@ -1,117 +0,0 @@ -/* This file is part of Ingen. - * Copyright (C) 2007 Dave Robillard - * - * 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 PORT_H -#define PORT_H - -#include -#include -#include -#include "types.hpp" -#include "GraphObjectImpl.hpp" -#include "DataType.hpp" - -namespace Raul { class Maid; } - -namespace Ingen { - -class NodeImpl; -class Buffer; -class ProcessContext; - - -/** A port on a Node. - * - * This is a non-template abstract base class, which basically exists so - * things can pass around Port pointers and not have to worry about type, - * templates, etc. - * - * \ingroup engine - */ -class Port : public GraphObjectImpl -{ -public: - virtual ~Port(); - - /** A port's parent is always a node, so static cast should be safe */ - NodeImpl* parent_node() const { return (NodeImpl*)_parent; } - - /** Prepare for a new (external) polyphony value. - * - * Preprocessor thread, poly is actually applied by apply_poly. - */ - virtual bool prepare_poly(uint32_t poly); - - /** Apply a new polyphony value. - * - * Audio thread. - * - * \param poly Must be < the most recent value passed to prepare_poly. - */ - virtual bool apply_poly(Raul::Maid& maid, uint32_t poly); - - Buffer* buffer(uint32_t voice) const { return _buffers->at(voice); } - - /** Called once per process cycle */ - virtual void pre_process(ProcessContext& context) = 0; - virtual void process(ProcessContext& context) {}; - virtual void post_process(ProcessContext& context) = 0; - - /** Empty buffer contents completely (ie silence) */ - virtual void clear_buffers(); - - virtual bool is_input() const = 0; - virtual bool is_output() const = 0; - - uint32_t num() const { return _index; } - uint32_t poly() const { return _poly; } - DataType type() const { return _type; } - size_t buffer_size() const { return _buffer_size; } - - virtual void set_buffer_size(size_t size); - - void fixed_buffers(bool b) { _fixed_buffers = b; } - bool fixed_buffers() { return _fixed_buffers; } - - void broadcast(bool b) { _broadcast = b; } - bool broadcast() { return _broadcast; } - -protected: - Port(NodeImpl* node, const std::string& name, uint32_t index, uint32_t poly, DataType type, size_t buffer_size); - - virtual void allocate_buffers(); - virtual void connect_buffers(); - virtual void broadcast(ProcessContext& context); - - uint32_t _index; - uint32_t _poly; - uint32_t _buffer_size; - DataType _type; - bool _fixed_buffers; - bool _broadcast; - Sample _last_broadcasted_value; - - Raul::Array* _buffers; - - // Dynamic polyphony - Raul::Array* _prepared_buffers; -}; - - -} // namespace Ingen - -#endif // PORT_H diff --git a/src/libs/engine/PortImpl.cpp b/src/libs/engine/PortImpl.cpp new file mode 100644 index 00000000..a6911154 --- /dev/null +++ b/src/libs/engine/PortImpl.cpp @@ -0,0 +1,183 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 + */ + +#include +#include +#include +#include "PortImpl.hpp" +#include "NodeImpl.hpp" +#include "interface/DataType.hpp" +#include "AudioBuffer.hpp" +#include "MidiBuffer.hpp" +#include "BufferFactory.hpp" +#include "ProcessContext.hpp" +#include "SendPortActivityEvent.hpp" + +using namespace std; + +namespace Ingen { + + +PortImpl::PortImpl(NodeImpl* const node, + const string& name, + uint32_t index, + uint32_t poly, + DataType type, + size_t buffer_size) + : GraphObjectImpl(node, name, true) + , _index(index) + , _poly(poly) + , _buffer_size(buffer_size) + , _type(type) + , _fixed_buffers(false) + , _broadcast(false) + , _last_broadcasted_value(0.0f) // default? + , _buffers(new Raul::Array(poly)) +{ + assert(node != NULL); + assert(_poly > 0); + + allocate_buffers(); + clear_buffers(); + + if (node->parent() == NULL) + _polyphonic = false; + + if (type == DataType::MIDI) + _broadcast = true; // send activity blips + + assert(_buffers->size() > 0); +} + + +PortImpl::~PortImpl() +{ + for (uint32_t i=0; i < _poly; ++i) + delete _buffers->at(i); + + delete _buffers; +} + + +bool +PortImpl::prepare_poly(uint32_t poly) +{ + if (!_polyphonic || !_parent->polyphonic()) + return true; + + /* FIXME: poly never goes down, harsh on memory.. */ + if (poly > _poly) { + _prepared_buffers = new Raul::Array(poly, *_buffers); + for (uint32_t i = _poly; i < _prepared_buffers->size(); ++i) + _prepared_buffers->at(i) = BufferFactory::create(_type, _buffer_size); + } + + return true; +} + + +bool +PortImpl::apply_poly(Raul::Maid& maid, uint32_t poly) +{ + if (!_polyphonic || !_parent->polyphonic()) + return true; + + assert(poly <= _prepared_buffers->size()); + + // Apply a new set of buffers from a preceding call to prepare_poly + if (_prepared_buffers && _buffers != _prepared_buffers) { + maid.push(_buffers); + _buffers = _prepared_buffers; + } + + _poly = poly; + + connect_buffers(); + + return true; +} + + +Raul::Atom +PortImpl::value() const +{ + // FIXME: will need this for ingen-side serialization + throw; +} + + +void +PortImpl::allocate_buffers() +{ + _buffers->alloc(_poly); + + for (uint32_t i=0; i < _poly; ++i) + _buffers->at(i) = BufferFactory::create(_type, _buffer_size); +} + + +void +PortImpl::set_buffer_size(size_t size) +{ + _buffer_size = size; + + for (uint32_t i=0; i < _poly; ++i) + _buffers->at(i)->resize(size); + + connect_buffers(); +} + + +void +PortImpl::connect_buffers() +{ + for (uint32_t i=0; i < _poly; ++i) + PortImpl::parent_node()->set_port_buffer(i, _index, _buffers->at(i)); +} + + +void +PortImpl::clear_buffers() +{ + for (uint32_t i=0; i < _poly; ++i) + _buffers->at(i)->clear(); +} + + +void +PortImpl::broadcast(ProcessContext& context) +{ + if (_broadcast) { + if (_type == DataType::CONTROL) { + const Sample value = ((AudioBuffer*)(*_buffers)[0])->value_at(0); + if (value != _last_broadcasted_value) { + const SendPortValueEvent ev(context.engine(), context.start(), this, false, 0, value); + context.event_sink().write(sizeof(ev), &ev); + _last_broadcasted_value = value; + } + } else if (_type == DataType::MIDI) { + if (((MidiBuffer*)(*_buffers)[0])->event_count() > 0) { + const SendPortActivityEvent ev(context.engine(), context.start(), this); + context.event_sink().write(sizeof(ev), &ev); + } + } + } +} + + + +} // namespace Ingen diff --git a/src/libs/engine/PortImpl.hpp b/src/libs/engine/PortImpl.hpp new file mode 100644 index 00000000..c43a79b0 --- /dev/null +++ b/src/libs/engine/PortImpl.hpp @@ -0,0 +1,125 @@ +/* This file is part of Ingen. + * Copyright (C) 2007 Dave Robillard + * + * 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 PORTIMPL_H +#define PORTIMPL_H + +#include +#include +#include +#include "interface/Port.hpp" +#include "types.hpp" +#include "GraphObjectImpl.hpp" +#include "interface/DataType.hpp" + +namespace Raul { class Maid; } + +namespace Ingen { + +class NodeImpl; +class Buffer; +class ProcessContext; + + +/** A port on a Node. + * + * This is a non-template abstract base class, which basically exists so + * things can pass around Port pointers and not have to worry about type, + * templates, etc. + * + * \ingroup engine + */ +class PortImpl : public GraphObjectImpl, public Ingen::Shared::Port +{ +public: + virtual ~PortImpl(); + + /** A port's parent is always a node, so static cast should be safe */ + NodeImpl* parent_node() const { return (NodeImpl*)_parent; } + + /** Prepare for a new (external) polyphony value. + * + * Preprocessor thread, poly is actually applied by apply_poly. + */ + virtual bool prepare_poly(uint32_t poly); + + /** Apply a new polyphony value. + * + * Audio thread. + * + * \param poly Must be < the most recent value passed to prepare_poly. + */ + virtual bool apply_poly(Raul::Maid& maid, uint32_t poly); + + virtual Raul::Atom value() const; + + Buffer* buffer(uint32_t voice) const { return _buffers->at(voice); } + + /** Called once per process cycle */ + virtual void pre_process(ProcessContext& context) = 0; + virtual void process(ProcessContext& context) {}; + virtual void post_process(ProcessContext& context) = 0; + + /** Empty buffer contents completely (ie silence) */ + virtual void clear_buffers(); + + virtual bool is_input() const = 0; + virtual bool is_output() const = 0; + + uint32_t num() const { return _index; } + uint32_t poly() const { return _poly; } + DataType type() const { return _type; } + size_t buffer_size() const { return _buffer_size; } + + virtual void set_buffer_size(size_t size); + + void fixed_buffers(bool b) { _fixed_buffers = b; } + bool fixed_buffers() { return _fixed_buffers; } + + void broadcast(bool b) { _broadcast = b; } + bool broadcast() { return _broadcast; } + +protected: + PortImpl(NodeImpl* node, + const std::string& name, + uint32_t index, + uint32_t poly, + DataType type, + size_t buffer_size); + + virtual void allocate_buffers(); + virtual void connect_buffers(); + virtual void broadcast(ProcessContext& context); + + uint32_t _index; + uint32_t _poly; + uint32_t _buffer_size; + DataType _type; + bool _fixed_buffers; + bool _broadcast; + Sample _last_broadcasted_value; + + Raul::Array* _buffers; + + // Dynamic polyphony + Raul::Array* _prepared_buffers; +}; + + +} // namespace Ingen + +#endif // PORTIMPL_H diff --git a/src/libs/engine/TransportNode.cpp b/src/libs/engine/TransportNode.cpp index 4322f371..dca8eecb 100644 --- a/src/libs/engine/TransportNode.cpp +++ b/src/libs/engine/TransportNode.cpp @@ -20,7 +20,7 @@ #include "OutputPort.hpp" #include "PluginImpl.hpp" #include "JackAudioDriver.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "util.hpp" //#include "Engine.hpp" diff --git a/src/libs/engine/events/ClearPatchEvent.cpp b/src/libs/engine/events/ClearPatchEvent.cpp index 891ca53b..1e6c0748 100644 --- a/src/libs/engine/events/ClearPatchEvent.cpp +++ b/src/libs/engine/events/ClearPatchEvent.cpp @@ -23,7 +23,7 @@ #include "ClientBroadcaster.hpp" #include "util.hpp" #include "ObjectStore.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "NodeImpl.hpp" #include "Connection.hpp" #include "QueuedEventSource.hpp" diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp index d1ec1a89..7f8fa18e 100644 --- a/src/libs/engine/events/ConnectionEvent.cpp +++ b/src/libs/engine/events/ConnectionEvent.cpp @@ -27,7 +27,7 @@ #include "OutputPort.hpp" #include "Patch.hpp" #include "ClientBroadcaster.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectStore.hpp" using std::string; diff --git a/src/libs/engine/events/ConnectionEvent.hpp b/src/libs/engine/events/ConnectionEvent.hpp index eb128660..8fa8c489 100644 --- a/src/libs/engine/events/ConnectionEvent.hpp +++ b/src/libs/engine/events/ConnectionEvent.hpp @@ -35,7 +35,7 @@ class Patch; class NodeImpl; class Connection; class MidiMessage; -class Port; +class PortImpl; class Connection; class InputPort; class OutputPort; @@ -71,8 +71,8 @@ private: Raul::Path _dst_port_path; Patch* _patch; - Port* _src_port; - Port* _dst_port; + PortImpl* _src_port; + PortImpl* _dst_port; OutputPort* _src_output_port; InputPort* _dst_input_port; diff --git a/src/libs/engine/events/CreateNodeEvent.cpp b/src/libs/engine/events/CreateNodeEvent.cpp index df891cd3..3a2715e0 100644 --- a/src/libs/engine/events/CreateNodeEvent.cpp +++ b/src/libs/engine/events/CreateNodeEvent.cpp @@ -28,7 +28,7 @@ #include "NodeFactory.hpp" #include "ClientBroadcaster.hpp" #include "ObjectStore.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" namespace Ingen { diff --git a/src/libs/engine/events/CreateNodeEvent.hpp b/src/libs/engine/events/CreateNodeEvent.hpp index 1452df05..75dfe3d7 100644 --- a/src/libs/engine/events/CreateNodeEvent.hpp +++ b/src/libs/engine/events/CreateNodeEvent.hpp @@ -30,7 +30,6 @@ namespace Ingen { class Patch; class NodeImpl; -class Plugin; class CompiledPatch; diff --git a/src/libs/engine/events/CreatePatchEvent.hpp b/src/libs/engine/events/CreatePatchEvent.hpp index 0b614013..15b67ffb 100644 --- a/src/libs/engine/events/CreatePatchEvent.hpp +++ b/src/libs/engine/events/CreatePatchEvent.hpp @@ -30,8 +30,6 @@ template class TreeNode; namespace Ingen { class Patch; -class NodeImpl; -class Plugin; class CompiledPatch; diff --git a/src/libs/engine/events/CreatePortEvent.cpp b/src/libs/engine/events/CreatePortEvent.cpp index 065ca4a3..21875290 100644 --- a/src/libs/engine/events/CreatePortEvent.cpp +++ b/src/libs/engine/events/CreatePortEvent.cpp @@ -28,7 +28,7 @@ #include "QueuedEventSource.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "AudioDriver.hpp" #include "MidiDriver.hpp" #include "OSCDriver.hpp" @@ -45,10 +45,11 @@ CreatePortEvent::CreatePortEvent(Engine& engine, bool is_output, QueuedEventSource* source) : QueuedEvent(engine, responder, timestamp, true, source), + _error(NO_ERROR), _path(path), _type(type), _is_output(is_output), - _data_type(DataType::UNKNOWN), + _data_type(type), _patch(NULL), _patch_port(NULL), _driver_port(NULL) @@ -61,20 +62,17 @@ CreatePortEvent::CreatePortEvent(Engine& engine, * FIXME: fix this using RCU */ - string type_str; - if (type == "ingen:control" || type == "ingen:audio") - _data_type = DataType::FLOAT; - else if (type == "ingen:midi") - _data_type = DataType::MIDI; - else if (type == "ingen:osc") - _data_type = DataType::OSC; + if (_data_type == DataType::UNKNOWN) { + cerr << "[CreatePortEvent] Unknown port type " << type << endl; + _error = UNKNOWN_TYPE; + } } void CreatePortEvent::pre_process() { - if (_engine.object_store()->find_object(_path) != NULL) { + if (_error == UNKNOWN_TYPE || _engine.object_store()->find_object(_path)) { QueuedEvent::pre_process(); return; } @@ -97,14 +95,14 @@ CreatePortEvent::pre_process() if (_patch_port) { if (_is_output) - _patch->add_output(new Raul::ListNode(_patch_port)); + _patch->add_output(new Raul::ListNode(_patch_port)); else - _patch->add_input(new Raul::ListNode(_patch_port)); + _patch->add_input(new Raul::ListNode(_patch_port)); if (_patch->external_ports()) - _ports_array = new Raul::Array(old_num_ports + 1, *_patch->external_ports()); + _ports_array = new Raul::Array(old_num_ports + 1, *_patch->external_ports()); else - _ports_array = new Raul::Array(old_num_ports + 1, NULL); + _ports_array = new Raul::Array(old_num_ports + 1, NULL); _ports_array->at(_patch->num_ports()-1) = _patch_port; @@ -160,7 +158,7 @@ CreatePortEvent::execute(ProcessContext& context) void CreatePortEvent::post_process() { - if (!_patch_port) { + if (_error != NO_ERROR || !_patch_port) { const string msg = string("Could not create port - ").append(_path); _responder->respond_error(msg); } else { diff --git a/src/libs/engine/events/CreatePortEvent.hpp b/src/libs/engine/events/CreatePortEvent.hpp index adae4892..d7835a25 100644 --- a/src/libs/engine/events/CreatePortEvent.hpp +++ b/src/libs/engine/events/CreatePortEvent.hpp @@ -21,7 +21,7 @@ #include "QueuedEvent.hpp" #include #include -#include "DataType.hpp" +#include "interface/DataType.hpp" #include using std::string; @@ -30,8 +30,7 @@ template class Array; namespace Ingen { class Patch; -class Port; -class Plugin; +class PortImpl; class DriverPort; @@ -49,15 +48,22 @@ public: void post_process(); private: - Raul::Path _path; - string _type; - bool _is_output; - DataType _data_type; - Patch* _patch; - Port* _patch_port; - Raul::Array* _ports_array; ///< New (external) ports array for Patch - DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port - bool _succeeded; + + enum ErrorType { + NO_ERROR, + UNKNOWN_TYPE + }; + + ErrorType _error; + Raul::Path _path; + string _type; + bool _is_output; + DataType _data_type; + Patch* _patch; + PortImpl* _patch_port; + Raul::Array* _ports_array; ///< New (external) ports array for Patch + DriverPort* _driver_port; ///< Driver (eg Jack) port if this is a toplevel port + bool _succeeded; }; diff --git a/src/libs/engine/events/DestroyEvent.cpp b/src/libs/engine/events/DestroyEvent.cpp index 575b1973..7fdda39f 100644 --- a/src/libs/engine/events/DestroyEvent.cpp +++ b/src/libs/engine/events/DestroyEvent.cpp @@ -30,7 +30,7 @@ #include "ClientBroadcaster.hpp" #include "ObjectStore.hpp" #include "QueuedEventSource.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" namespace Ingen { @@ -70,7 +70,7 @@ DestroyEvent::pre_process() _node = dynamic_cast(_store_iterator->second); if (!_node) - _port = dynamic_cast(_store_iterator->second); + _port = dynamic_cast(_store_iterator->second); } if (_store_iterator != _engine.object_store()->objects().end()) { @@ -155,7 +155,7 @@ DestroyEvent::execute(ProcessContext& context) _port->parent_patch()->external_ports(_ports_array); if ( ! _port->parent_patch()->parent()) { - if (_port->type() == DataType::FLOAT) + if (_port->type() == DataType::AUDIO) _driver_port = _engine.audio_driver()->remove_port(_port->path()); else if (_port->type() == DataType::MIDI) _driver_port = _engine.midi_driver()->remove_port(_port->path()); diff --git a/src/libs/engine/events/DestroyEvent.hpp b/src/libs/engine/events/DestroyEvent.hpp index 78ff3d7b..59a932b3 100644 --- a/src/libs/engine/events/DestroyEvent.hpp +++ b/src/libs/engine/events/DestroyEvent.hpp @@ -36,9 +36,8 @@ namespace Ingen { class GraphObjectImpl; class Patch; class NodeImpl; -class Port; +class PortImpl; class DriverPort; -class Plugin; class DisconnectNodeEvent; class DisconnectPortEvent; class CompiledPatch; @@ -63,11 +62,11 @@ private: ObjectStore::Objects::iterator _store_iterator; Table _removed_table; NodeImpl* _node; ///< Same as _object if it is a Node, otherwise NULL - Port* _port; ///< Same as _object if it is a Port, otherwise NULL + PortImpl* _port; ///< Same as _object if it is a Port, otherwise NULL DriverPort* _driver_port; Raul::ListNode* _patch_node_listnode; - Raul::ListNode* _patch_port_listnode; - Raul::Array* _ports_array; ///< New (external) ports array for Patch + Raul::ListNode* _patch_port_listnode; + Raul::Array* _ports_array; ///< New (external) ports array for Patch CompiledPatch* _compiled_patch; ///< Patch's new process order DisconnectNodeEvent* _disconnect_node_event; DisconnectPortEvent* _disconnect_port_event; diff --git a/src/libs/engine/events/DisablePortMonitoringEvent.cpp b/src/libs/engine/events/DisablePortMonitoringEvent.cpp index 3b5950ee..d5b99618 100644 --- a/src/libs/engine/events/DisablePortMonitoringEvent.cpp +++ b/src/libs/engine/events/DisablePortMonitoringEvent.cpp @@ -20,7 +20,7 @@ #include "events/DisablePortMonitoringEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" diff --git a/src/libs/engine/events/DisablePortMonitoringEvent.hpp b/src/libs/engine/events/DisablePortMonitoringEvent.hpp index b2fac41b..7a8e23f7 100644 --- a/src/libs/engine/events/DisablePortMonitoringEvent.hpp +++ b/src/libs/engine/events/DisablePortMonitoringEvent.hpp @@ -26,7 +26,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; namespace Shared { class ClientInterface; } using Shared::ClientInterface; diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp index 3ee93b81..8612d012 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.cpp +++ b/src/libs/engine/events/DisconnectNodeEvent.cpp @@ -29,7 +29,7 @@ #include "ObjectStore.hpp" #include "OutputPort.hpp" #include "Patch.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "Responder.hpp" #include "util.hpp" diff --git a/src/libs/engine/events/DisconnectNodeEvent.hpp b/src/libs/engine/events/DisconnectNodeEvent.hpp index 5decb923..cefe5a25 100644 --- a/src/libs/engine/events/DisconnectNodeEvent.hpp +++ b/src/libs/engine/events/DisconnectNodeEvent.hpp @@ -31,7 +31,7 @@ class DisconnectionEvent; class Patch; class NodeImpl; class Connection; -class Port; +class PortImpl; class InputPort; class OutputPort; diff --git a/src/libs/engine/events/DisconnectPortEvent.cpp b/src/libs/engine/events/DisconnectPortEvent.cpp index 6ed328cf..f7ad9925 100644 --- a/src/libs/engine/events/DisconnectPortEvent.cpp +++ b/src/libs/engine/events/DisconnectPortEvent.cpp @@ -25,7 +25,7 @@ #include "NodeImpl.hpp" #include "Connection.hpp" #include "DisconnectionEvent.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "InputPort.hpp" #include "OutputPort.hpp" #include "Patch.hpp" diff --git a/src/libs/engine/events/DisconnectPortEvent.hpp b/src/libs/engine/events/DisconnectPortEvent.hpp index 85c37ed3..b30151ed 100644 --- a/src/libs/engine/events/DisconnectPortEvent.hpp +++ b/src/libs/engine/events/DisconnectPortEvent.hpp @@ -31,7 +31,7 @@ namespace Ingen { class Patch; class NodeImpl; class Connection; -class Port; +class PortImpl; class DisconnectionEvent; using std::string; diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp index 33dbdeeb..215e0202 100644 --- a/src/libs/engine/events/DisconnectionEvent.cpp +++ b/src/libs/engine/events/DisconnectionEvent.cpp @@ -26,7 +26,7 @@ #include "OutputPort.hpp" #include "Patch.hpp" #include "ClientBroadcaster.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectStore.hpp" using std::string; @@ -50,7 +50,7 @@ DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr resp } -DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port) +DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, PortImpl* const src_port, PortImpl* const dst_port) : QueuedEvent(engine, responder, timestamp), _src_port_path(src_port->path()), _dst_port_path(dst_port->path()), diff --git a/src/libs/engine/events/DisconnectionEvent.hpp b/src/libs/engine/events/DisconnectionEvent.hpp index 46b2c015..aacb5082 100644 --- a/src/libs/engine/events/DisconnectionEvent.hpp +++ b/src/libs/engine/events/DisconnectionEvent.hpp @@ -35,7 +35,7 @@ class Patch; class NodeImpl; class Connection; class MidiMessage; -class Port; +class PortImpl; class Connection; class InputPort; class OutputPort; @@ -50,7 +50,7 @@ class DisconnectionEvent : public QueuedEvent { public: DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path); - DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, Port* const src_port, Port* const dst_port); + DisconnectionEvent(Engine& engine, SharedPtr responder, SampleCount timestamp, PortImpl* const src_port, PortImpl* const dst_port); void pre_process(); void execute(ProcessContext& context); @@ -72,8 +72,8 @@ private: Raul::Path _dst_port_path; Patch* _patch; - Port* _src_port; - Port* _dst_port; + PortImpl* _src_port; + PortImpl* _dst_port; OutputPort* _src_output_port; InputPort* _dst_input_port; diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp index 018fd3cf..dcc09ac4 100644 --- a/src/libs/engine/events/EnablePortBroadcastingEvent.cpp +++ b/src/libs/engine/events/EnablePortBroadcastingEvent.cpp @@ -20,7 +20,7 @@ #include "events/EnablePortBroadcastingEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" diff --git a/src/libs/engine/events/EnablePortBroadcastingEvent.hpp b/src/libs/engine/events/EnablePortBroadcastingEvent.hpp index e24389cb..f9bc4e98 100644 --- a/src/libs/engine/events/EnablePortBroadcastingEvent.hpp +++ b/src/libs/engine/events/EnablePortBroadcastingEvent.hpp @@ -26,7 +26,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; namespace Shared { class ClientInterface; } using Shared::ClientInterface; @@ -50,7 +50,7 @@ public: private: const std::string _port_path; - Port* _port; + PortImpl* _port; bool _enable; }; diff --git a/src/libs/engine/events/LoadPluginsEvent.hpp b/src/libs/engine/events/LoadPluginsEvent.hpp index 966e3275..cd9a2884 100644 --- a/src/libs/engine/events/LoadPluginsEvent.hpp +++ b/src/libs/engine/events/LoadPluginsEvent.hpp @@ -23,8 +23,6 @@ namespace Ingen { -class Plugin; - /** Loads all plugins into the internal plugin database (in NodeFactory). * diff --git a/src/libs/engine/events/MidiLearnEvent.cpp b/src/libs/engine/events/MidiLearnEvent.cpp index 2cb39c0e..c2f2c4e5 100644 --- a/src/libs/engine/events/MidiLearnEvent.cpp +++ b/src/libs/engine/events/MidiLearnEvent.cpp @@ -64,8 +64,8 @@ MidiLearnEvent::execute(ProcessContext& context) QueuedEvent::execute(context); // FIXME: this isn't very good at all. - if (_node != NULL && _node->plugin()->type() == Plugin::Internal - && _node->plugin()->plug_label() == "midi_control_in") { + if (_node != NULL && _node->plugin_impl()->type() == Plugin::Internal + && _node->plugin_impl()->plug_label() == "midi_control_in") { ((MidiControlNode*)_node)->learn(_response_event); } } diff --git a/src/libs/engine/events/NoteEvent.cpp b/src/libs/engine/events/NoteEvent.cpp index 9c69b9df..fb0347af 100644 --- a/src/libs/engine/events/NoteEvent.cpp +++ b/src/libs/engine/events/NoteEvent.cpp @@ -71,14 +71,14 @@ NoteEvent::execute(ProcessContext& context) if (_node != NULL && _node->plugin()->type() == Plugin::Internal) { if (_on) { - if (_node->plugin()->plug_label() == "note_in") + if (_node->plugin_impl()->plug_label() == "note_in") ((MidiNoteNode*)_node)->note_on(_note_num, _velocity, _time, context); - else if (_node->plugin()->plug_label() == "trigger_in") + else if (_node->plugin_impl()->plug_label() == "trigger_in") ((MidiTriggerNode*)_node)->note_on(_note_num, _velocity, _time, context); } else { - if (_node->plugin()->plug_label() == "note_in") + if (_node->plugin_impl()->plug_label() == "note_in") ((MidiNoteNode*)_node)->note_off(_note_num, _time, context); - else if (_node->plugin()->plug_label() == "trigger_in") + else if (_node->plugin_impl()->plug_label() == "trigger_in") ((MidiTriggerNode*)_node)->note_off(_note_num, _time, context); } } diff --git a/src/libs/engine/events/PingQueuedEvent.hpp b/src/libs/engine/events/PingQueuedEvent.hpp index 88c03aaa..08897bfe 100644 --- a/src/libs/engine/events/PingQueuedEvent.hpp +++ b/src/libs/engine/events/PingQueuedEvent.hpp @@ -24,7 +24,7 @@ namespace Ingen { -class Port; +class PortImpl; /** A ping that travels through the pre-processed event queue before responding diff --git a/src/libs/engine/events/RenameEvent.cpp b/src/libs/engine/events/RenameEvent.cpp index edd67fad..72e27ec9 100644 --- a/src/libs/engine/events/RenameEvent.cpp +++ b/src/libs/engine/events/RenameEvent.cpp @@ -105,11 +105,11 @@ RenameEvent::execute(ProcessContext& context) { QueuedEvent::execute(context); - Port* port = dynamic_cast(_store_iterator->second); + PortImpl* port = dynamic_cast(_store_iterator->second); if (port && port->parent()->parent() == NULL) { DriverPort* driver_port = NULL; - if (port->type() == DataType::FLOAT) + if (port->type() == DataType::AUDIO) driver_port = _engine.audio_driver()->driver_port(_new_path); else if (port->type() == DataType::MIDI) driver_port = _engine.midi_driver()->driver_port(_new_path); diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp index 0c46546f..13ad936e 100644 --- a/src/libs/engine/events/RequestObjectEvent.cpp +++ b/src/libs/engine/events/RequestObjectEvent.cpp @@ -24,7 +24,7 @@ #include "ClientBroadcaster.hpp" #include "Patch.hpp" #include "NodeImpl.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectSender.hpp" #include "ProcessContext.hpp" @@ -79,7 +79,7 @@ RequestObjectEvent::post_process() return; } - Port* const port = dynamic_cast(_object); + PortImpl* const port = dynamic_cast(_object); if (port) { _responder->respond_ok(); ObjectSender::send_port(_responder->client(), port); diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp index f2886902..21ad97d4 100644 --- a/src/libs/engine/events/RequestPluginEvent.cpp +++ b/src/libs/engine/events/RequestPluginEvent.cpp @@ -20,7 +20,7 @@ #include "RequestPluginEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" #include "NodeFactory.hpp" diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp index 224c3045..e26b1036 100644 --- a/src/libs/engine/events/RequestPortValueEvent.cpp +++ b/src/libs/engine/events/RequestPortValueEvent.cpp @@ -20,7 +20,7 @@ #include "interface/ClientInterface.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ObjectStore.hpp" #include "ClientBroadcaster.hpp" #include "AudioBuffer.hpp" @@ -55,7 +55,7 @@ RequestPortValueEvent::execute(ProcessContext& context) QueuedEvent::execute(context); assert(_time >= context.start() && _time <= context.end()); - if (_port != NULL && _port->type() == DataType::FLOAT) + if (_port != NULL && (_port->type() == DataType::CONTROL || _port->type() == DataType::AUDIO)) _value = ((AudioBuffer*)_port->buffer(0))->value_at(0/*_time - start*/); else _port = NULL; // triggers error response diff --git a/src/libs/engine/events/RequestPortValueEvent.hpp b/src/libs/engine/events/RequestPortValueEvent.hpp index d3bccfdc..dd52c535 100644 --- a/src/libs/engine/events/RequestPortValueEvent.hpp +++ b/src/libs/engine/events/RequestPortValueEvent.hpp @@ -26,7 +26,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; namespace Shared { class ClientInterface; } using Shared::ClientInterface; @@ -45,9 +45,9 @@ public: void post_process(); private: - string _port_path; - Port* _port; - Sample _value; + const string _port_path; + PortImpl* _port; + Sample _value; }; diff --git a/src/libs/engine/events/SendPortActivityEvent.cpp b/src/libs/engine/events/SendPortActivityEvent.cpp index 9d8f786d..0ab3abdd 100644 --- a/src/libs/engine/events/SendPortActivityEvent.cpp +++ b/src/libs/engine/events/SendPortActivityEvent.cpp @@ -17,7 +17,7 @@ #include "SendPortActivityEvent.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ClientBroadcaster.hpp" namespace Ingen { diff --git a/src/libs/engine/events/SendPortActivityEvent.hpp b/src/libs/engine/events/SendPortActivityEvent.hpp index 565167d3..dfbb8a10 100644 --- a/src/libs/engine/events/SendPortActivityEvent.hpp +++ b/src/libs/engine/events/SendPortActivityEvent.hpp @@ -25,7 +25,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; /** A special event used internally to send port activity notification (e.g. @@ -45,7 +45,7 @@ class SendPortActivityEvent : public Event public: inline SendPortActivityEvent(Engine& engine, SampleCount timestamp, - Port* port) + PortImpl* port) : Event(engine, SharedPtr(), timestamp) , _port(port) { @@ -58,7 +58,7 @@ public: void post_process(); private: - Port* _port; + PortImpl* _port; }; diff --git a/src/libs/engine/events/SendPortValueEvent.cpp b/src/libs/engine/events/SendPortValueEvent.cpp index f663f85c..89e8c9e0 100644 --- a/src/libs/engine/events/SendPortValueEvent.cpp +++ b/src/libs/engine/events/SendPortValueEvent.cpp @@ -18,7 +18,7 @@ #include #include "SendPortValueEvent.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ClientBroadcaster.hpp" using namespace std; diff --git a/src/libs/engine/events/SendPortValueEvent.hpp b/src/libs/engine/events/SendPortValueEvent.hpp index 407f0119..e8505914 100644 --- a/src/libs/engine/events/SendPortValueEvent.hpp +++ b/src/libs/engine/events/SendPortValueEvent.hpp @@ -25,7 +25,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; /** A special event used internally to send port values from the audio thread. @@ -44,7 +44,7 @@ class SendPortValueEvent : public Event public: inline SendPortValueEvent(Engine& engine, SampleCount timestamp, - Port* port, + PortImpl* port, bool omni, uint32_t voice_num, Sample value) @@ -66,10 +66,10 @@ public: void post_process(); private: - Port* _port; - bool _omni; - uint32_t _voice_num; - Sample _value; + PortImpl* _port; + bool _omni; + uint32_t _voice_num; + Sample _value; }; diff --git a/src/libs/engine/events/SetPolyphonicEvent.cpp b/src/libs/engine/events/SetPolyphonicEvent.cpp index 04bdc6aa..8cca2373 100644 --- a/src/libs/engine/events/SetPolyphonicEvent.cpp +++ b/src/libs/engine/events/SetPolyphonicEvent.cpp @@ -23,7 +23,7 @@ #include "ClientBroadcaster.hpp" #include "util.hpp" #include "ObjectStore.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "NodeImpl.hpp" #include "Connection.hpp" #include "QueuedEventSource.hpp" diff --git a/src/libs/engine/events/SetPolyphonyEvent.cpp b/src/libs/engine/events/SetPolyphonyEvent.cpp index a1f03add..8e0d12cd 100644 --- a/src/libs/engine/events/SetPolyphonyEvent.cpp +++ b/src/libs/engine/events/SetPolyphonyEvent.cpp @@ -23,7 +23,7 @@ #include "ClientBroadcaster.hpp" #include "util.hpp" #include "ObjectStore.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "NodeImpl.hpp" #include "Connection.hpp" #include "QueuedEventSource.hpp" diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp index cc7a79e3..f278c083 100644 --- a/src/libs/engine/events/SetPortValueEvent.cpp +++ b/src/libs/engine/events/SetPortValueEvent.cpp @@ -19,7 +19,7 @@ #include "Responder.hpp" #include "SetPortValueEvent.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ClientBroadcaster.hpp" #include "NodeImpl.hpp" #include "ObjectStore.hpp" @@ -34,11 +34,11 @@ namespace Ingen { /** Omni (all voices) control setting */ SetPortValueEvent::SetPortValueEvent(Engine& engine, - SharedPtr responder, - SampleCount timestamp, - const string& port_path, - uint32_t data_size, - const void* data) + SharedPtr responder, + SampleCount timestamp, + const string& port_path, + uint32_t data_size, + const void* data) : Event(engine, responder, timestamp), _omni(true), _voice_num(0), diff --git a/src/libs/engine/events/SetPortValueEvent.hpp b/src/libs/engine/events/SetPortValueEvent.hpp index 0761ed39..c9d46a8e 100644 --- a/src/libs/engine/events/SetPortValueEvent.hpp +++ b/src/libs/engine/events/SetPortValueEvent.hpp @@ -25,7 +25,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; /** An event to change the value of a port. @@ -63,7 +63,7 @@ private: string _port_path; uint32_t _data_size; void* _data; - Port* _port; + PortImpl* _port; ErrorType _error; }; diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp index 026f22b6..7d11b1ae 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp @@ -19,7 +19,7 @@ #include "SetPortValueQueuedEvent.hpp" #include "Responder.hpp" #include "Engine.hpp" -#include "Port.hpp" +#include "PortImpl.hpp" #include "ClientBroadcaster.hpp" #include "PluginImpl.hpp" #include "NodeImpl.hpp" diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.hpp b/src/libs/engine/events/SetPortValueQueuedEvent.hpp index c6a3c0ee..382a574e 100644 --- a/src/libs/engine/events/SetPortValueQueuedEvent.hpp +++ b/src/libs/engine/events/SetPortValueQueuedEvent.hpp @@ -25,7 +25,7 @@ using std::string; namespace Ingen { -class Port; +class PortImpl; /** An event to change the value of a port. @@ -62,7 +62,7 @@ private: string _port_path; uint32_t _data_size; void* _data; - Port* _port; + PortImpl* _port; ErrorType _error; }; -- cgit v1.2.1