summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events
diff options
context:
space:
mode:
Diffstat (limited to 'src/libs/engine/events')
-rw-r--r--src/libs/engine/events/AddPortEvent.cpp4
-rw-r--r--src/libs/engine/events/ConnectionEvent.cpp146
-rw-r--r--src/libs/engine/events/ConnectionEvent.h62
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.cpp2
-rw-r--r--src/libs/engine/events/DisconnectNodeEvent.h5
-rw-r--r--src/libs/engine/events/DisconnectionEvent.cpp123
-rw-r--r--src/libs/engine/events/DisconnectionEvent.h63
-rw-r--r--src/libs/engine/events/RequestObjectEvent.cpp4
-rw-r--r--src/libs/engine/events/RequestPluginEvent.cpp4
-rw-r--r--src/libs/engine/events/RequestPortValueEvent.cpp7
-rw-r--r--src/libs/engine/events/SetPortValueEvent.cpp13
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.cpp14
12 files changed, 128 insertions, 319 deletions
diff --git a/src/libs/engine/events/AddPortEvent.cpp b/src/libs/engine/events/AddPortEvent.cpp
index 8ca2f85f..c9f22cd1 100644
--- a/src/libs/engine/events/AddPortEvent.cpp
+++ b/src/libs/engine/events/AddPortEvent.cpp
@@ -113,10 +113,10 @@ AddPortEvent::pre_process()
if (!_patch->parent()) {
if (_type == "ingen:audio")
_driver_port = _engine.audio_driver()->create_port(
- dynamic_cast<DuplexPort<Sample>*>(_patch_port));
+ dynamic_cast<DuplexPort*>(_patch_port));
else if (_type == "ingen:midi")
_driver_port = _engine.midi_driver()->create_port(
- dynamic_cast<DuplexPort<MidiMessage>*>(_patch_port));
+ dynamic_cast<DuplexPort*>(_patch_port));
}
assert(_ports_array->size() == _patch->num_ports());
diff --git a/src/libs/engine/events/ConnectionEvent.cpp b/src/libs/engine/events/ConnectionEvent.cpp
index da723a8c..af35265b 100644
--- a/src/libs/engine/events/ConnectionEvent.cpp
+++ b/src/libs/engine/events/ConnectionEvent.cpp
@@ -22,7 +22,7 @@
#include "Responder.h"
#include "types.h"
#include "Engine.h"
-#include "TypedConnection.h"
+#include "Connection.h"
#include "InputPort.h"
#include "OutputPort.h"
#include "Patch.h"
@@ -34,9 +34,6 @@ using std::string;
namespace Ingen {
-//// ConnectionEvent ////
-
-
ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path)
: QueuedEvent(engine, responder, timestamp),
_src_port_path(src_port_path),
@@ -44,18 +41,15 @@ ConnectionEvent::ConnectionEvent(Engine& engine, SharedPtr<Responder> responder,
_patch(NULL),
_src_port(NULL),
_dst_port(NULL),
- _typed_event(NULL),
+ _process_order(NULL),
+ _connection(NULL),
+ _patch_listnode(NULL),
+ _port_listnode(NULL),
_error(NO_ERROR)
{
}
-ConnectionEvent::~ConnectionEvent()
-{
- delete _typed_event;
-}
-
-
void
ConnectionEvent::pre_process()
{
@@ -67,14 +61,6 @@ ConnectionEvent::pre_process()
return;
}
- /*_patch = _engine.object_store()->find_patch(_src_port_path.parent().parent());
-
- if (_patch == NULL) {
- _error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }*/
-
_src_port = _engine.object_store()->find_port(_src_port_path);
_dst_port = _engine.object_store()->find_port(_dst_port_path);
@@ -84,96 +70,33 @@ ConnectionEvent::pre_process()
return;
}
- if (_src_port->type() != _dst_port->type() || _src_port->buffer_size() != _dst_port->buffer_size()) {
+ if (_src_port->type() != _dst_port->type()) {
_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
}
-
- /*if (port1->is_output() && port2->is_input()) {
- _src_port = port1;
- _dst_port = port2;
- } else if (port2->is_output() && port1->is_input()) {
- _src_port = port2;
- _dst_port = port1;
- } else {
+
+ // FIXME: MIDI buffer size is a kluge all around
+ if (_src_port->type() == DataType::FLOAT
+ && _src_port->buffer_size() != _dst_port->buffer_size()) {
_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
- }*/
-
- // Create the typed event to actually do the work
- const DataType type = _src_port->type();
- if (type == DataType::FLOAT) {
- _typed_event = new TypedConnectionEvent<Sample>(_engine, _responder, _time,
- dynamic_cast<OutputPort<Sample>*>(_src_port), dynamic_cast<InputPort<Sample>*>(_dst_port));
- } else if (type == DataType::MIDI) {
- _typed_event = new TypedConnectionEvent<MidiMessage>(_engine, _responder, _time,
- dynamic_cast<OutputPort<MidiMessage>*>(_src_port), dynamic_cast<InputPort<MidiMessage>*>(_dst_port));
- } else {
+ }
+
+ /*if ( !( _src_port->is_output() && _dst_port->is_input() ) ) {
_error = TYPE_MISMATCH;
QueuedEvent::pre_process();
return;
- }
-
- assert(_typed_event);
- _typed_event->pre_process();
- assert(_typed_event->is_prepared());
-
- QueuedEvent::pre_process();
-}
-
-
-void
-ConnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
-{
- QueuedEvent::execute(nframes, start, end);
-
- if (_error == NO_ERROR)
- _typed_event->execute(nframes, start, end);
-}
-
-
-void
-ConnectionEvent::post_process()
-{
- if (_error == NO_ERROR) {
- _typed_event->post_process();
- } else {
- // FIXME: better error messages
- string msg = "Unable to make connection ";
- msg.append(_src_port_path + " -> " + _dst_port_path);
- _responder->respond_error(msg);
- }
-}
-
-
-
-//// TypedConnectionEvent ////
-
-
-template <typename T>
-TypedConnectionEvent<T>::TypedConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
-: QueuedEvent(engine, responder, timestamp),
- _src_port(src_port),
- _dst_port(dst_port),
- _patch(NULL),
- _process_order(NULL),
- _connection(NULL),
- _port_listnode(NULL),
- _succeeded(true)
-{
- assert(src_port != NULL);
- assert(dst_port != NULL);
-}
+ }*/
+ _dst_input_port = dynamic_cast<InputPort*>(_dst_port);
+ _src_output_port = dynamic_cast<OutputPort*>(_src_port);
+ assert(_src_output_port);
+ assert(_dst_input_port);
-template <typename T>
-void
-TypedConnectionEvent<T>::pre_process()
-{
- if (_dst_port->is_connected_to(_src_port)) {
- _succeeded = false;
+ if (_dst_input_port->is_connected_to(_src_output_port)) {
+ _error = ALREADY_CONNECTED;
QueuedEvent::pre_process();
return;
}
@@ -202,19 +125,19 @@ TypedConnectionEvent<T>::pre_process()
assert(_patch);
if (src_node == NULL || dst_node == NULL) {
- _succeeded = false;
+ _error = PARENTS_NOT_FOUND;
QueuedEvent::pre_process();
return;
}
if (_patch != src_node && src_node->parent() != _patch && dst_node->parent() != _patch) {
- _succeeded = false;
+ _error = PARENTS_NOT_FOUND;
QueuedEvent::pre_process();
return;
}
- _connection = new TypedConnection<T>(_src_port, _dst_port);
- _port_listnode = new Raul::ListNode<TypedConnection<T>*>(_connection);
+ _connection = new Connection(_src_port, _dst_port);
+ _port_listnode = new Raul::ListNode<Connection*>(_connection);
_patch_listnode = new Raul::ListNode<Connection*>(_connection);
// Need to be careful about patch port connections here and adding a node's
@@ -227,20 +150,18 @@ TypedConnectionEvent<T>::pre_process()
if (_patch->enabled())
_process_order = _patch->build_process_order();
- _succeeded = true;
QueuedEvent::pre_process();
}
-template <typename T>
void
-TypedConnectionEvent<T>::execute(SampleCount nframes, FrameTime start, FrameTime end)
+ConnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
QueuedEvent::execute(nframes, start, end);
- if (_succeeded) {
+ if (_error == NO_ERROR) {
// These must be inserted here, since they're actually used by the audio thread
- _dst_port->add_connection(_port_listnode);
+ _dst_input_port->add_connection(_port_listnode);
_patch->add_connection(_patch_listnode);
if (_patch->process_order() != NULL)
_engine.maid()->push(_patch->process_order());
@@ -249,18 +170,17 @@ TypedConnectionEvent<T>::execute(SampleCount nframes, FrameTime start, FrameTime
}
-template <typename T>
void
-TypedConnectionEvent<T>::post_process()
+ConnectionEvent::post_process()
{
- if (_succeeded) {
- assert(_connection != NULL);
-
+ if (_error == NO_ERROR) {
_responder->respond_ok();
-
_engine.broadcaster()->send_connection(_connection);
} else {
- _responder->respond_error("Unable to make connection.");
+ // FIXME: better error messages
+ string msg = "Unable to make connection ";
+ msg.append(_src_port_path + " -> " + _dst_port_path);
+ _responder->respond_error(msg);
}
}
diff --git a/src/libs/engine/events/ConnectionEvent.h b/src/libs/engine/events/ConnectionEvent.h
index 79ffeaa3..8f5e1cc2 100644
--- a/src/libs/engine/events/ConnectionEvent.h
+++ b/src/libs/engine/events/ConnectionEvent.h
@@ -36,10 +36,9 @@ class Node;
class Connection;
class MidiMessage;
class Port;
-template <typename T> class TypedConnection;
-template <typename T> class InputPort;
-template <typename T> class OutputPort;
-template <typename T> class TypedConnectionEvent; // helper, defined below
+class Connection;
+class InputPort;
+class OutputPort;
/** Make a Connection between two Ports.
@@ -50,7 +49,6 @@ class ConnectionEvent : public QueuedEvent
{
public:
ConnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
- ~ConnectionEvent();
void pre_process();
void execute(SampleCount nframes, FrameTime start, FrameTime end);
@@ -58,52 +56,34 @@ public:
private:
- enum ErrorType { NO_ERROR, PARENT_PATCH_DIFFERENT, PORT_NOT_FOUND, TYPE_MISMATCH };
+ enum ErrorType {
+ NO_ERROR,
+ PARENT_PATCH_DIFFERENT,
+ PORT_NOT_FOUND,
+ TYPE_MISMATCH,
+ ALREADY_CONNECTED,
+ PARENTS_NOT_FOUND
+ };
Raul::Path _src_port_path;
Raul::Path _dst_port_path;
- Patch* _patch;
- Port* _src_port;
- Port* _dst_port;
-
- QueuedEvent* _typed_event;
-
- ErrorType _error;
-};
+ Patch* _patch;
+ Port* _src_port;
+ Port* _dst_port;
+ OutputPort* _src_output_port;
+ InputPort* _dst_input_port;
-
-/** Templated ConnectionEvent.
- *
- * Intended to be called from ConnectionEvent so callers (ie OSCReceiver)
- * can use ConnectionEvent without knowing anything about types (which
- * they can't, since all they have is Port paths).
- */
-template <typename T>
-class TypedConnectionEvent : public QueuedEvent
-{
-public:
- TypedConnectionEvent(Engine& engine, SharedPtr<Responder> responder, FrameTime time, OutputPort<T>* src_port, InputPort<T>* dst_port);
+ Raul::Array<Node*>* _process_order; ///< New process order for Patch
- void pre_process();
- void execute(SampleCount nframes, FrameTime start, FrameTime end);
- void post_process();
+ Connection* _connection;
+ Raul::ListNode<Connection*>* _patch_listnode;
+ Raul::ListNode<Connection*>* _port_listnode;
-private:
- OutputPort<T>* _src_port;
- InputPort<T>* _dst_port;
-
- Patch* _patch;
- Raul::Array<Node*>* _process_order; ///< New process order for Patch
- TypedConnection<T>* _connection;
- Raul::ListNode<Connection*>* _patch_listnode;
- Raul::ListNode<TypedConnection<T>*>* _port_listnode;
-
- bool _succeeded;
+ ErrorType _error;
};
-
} // namespace Ingen
#endif // CONNECTIONEVENT_H
diff --git a/src/libs/engine/events/DisconnectNodeEvent.cpp b/src/libs/engine/events/DisconnectNodeEvent.cpp
index 916c1045..8f2a90f2 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.cpp
+++ b/src/libs/engine/events/DisconnectNodeEvent.cpp
@@ -23,7 +23,7 @@
#include "Responder.h"
#include "Engine.h"
#include "Node.h"
-#include "TypedConnection.h"
+#include "Connection.h"
#include "DisconnectionEvent.h"
#include "Port.h"
#include "InputPort.h"
diff --git a/src/libs/engine/events/DisconnectNodeEvent.h b/src/libs/engine/events/DisconnectNodeEvent.h
index bf4644ad..270fa960 100644
--- a/src/libs/engine/events/DisconnectNodeEvent.h
+++ b/src/libs/engine/events/DisconnectNodeEvent.h
@@ -31,10 +31,9 @@ class DisconnectionEvent;
class Patch;
class Node;
class Connection;
-template <typename T> class TypedConnection;
class Port;
-template <typename T> class InputPort;
-template <typename T> class OutputPort;
+class InputPort;
+class OutputPort;
/** An event to disconnect all connections to a Node.
diff --git a/src/libs/engine/events/DisconnectionEvent.cpp b/src/libs/engine/events/DisconnectionEvent.cpp
index d5e788ef..aef271f4 100644
--- a/src/libs/engine/events/DisconnectionEvent.cpp
+++ b/src/libs/engine/events/DisconnectionEvent.cpp
@@ -21,7 +21,7 @@
#include <raul/Path.h>
#include "Responder.h"
#include "Engine.h"
-#include "TypedConnection.h"
+#include "Connection.h"
#include "InputPort.h"
#include "OutputPort.h"
#include "Patch.h"
@@ -44,7 +44,7 @@ DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> resp
_src_port(NULL),
_dst_port(NULL),
_lookup(true),
- _typed_event(NULL),
+ _process_order(NULL),
_error(NO_ERROR)
{
}
@@ -58,7 +58,7 @@ DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> resp
_src_port(src_port),
_dst_port(dst_port),
_lookup(false),
- _typed_event(NULL),
+ _process_order(NULL),
_error(NO_ERROR)
{
// FIXME: These break for patch ports.. is that ok?
@@ -69,11 +69,6 @@ DisconnectionEvent::DisconnectionEvent(Engine& engine, SharedPtr<Responder> resp
== dst_port->parent_node()->parent_patch()); */
}
-DisconnectionEvent::~DisconnectionEvent()
-{
- delete _typed_event;
-}
-
void
DisconnectionEvent::pre_process()
@@ -87,14 +82,6 @@ DisconnectionEvent::pre_process()
return;
}
- /*_patch = _engine.object_store()->find_patch(_src_port_path.parent().parent());
-
- if (_patch == NULL) {
- _error = PORT_NOT_FOUND;
- QueuedEvent::pre_process();
- return;
- }*/
-
_src_port = _engine.object_store()->find_port(_src_port_path);
_dst_port = _engine.object_store()->find_port(_dst_port_path);
}
@@ -111,76 +98,13 @@ DisconnectionEvent::pre_process()
return;
}
- // Create the typed event to actually do the work
- const DataType type = _src_port->type();
- if (type == DataType::FLOAT) {
- _typed_event = new TypedDisconnectionEvent<Sample>(_engine, _responder, _time,
- dynamic_cast<OutputPort<Sample>*>(_src_port), dynamic_cast<InputPort<Sample>*>(_dst_port));
- } else if (type == DataType::MIDI) {
- _typed_event = new TypedDisconnectionEvent<MidiMessage>(_engine, _responder, _time,
- dynamic_cast<OutputPort<MidiMessage>*>(_src_port), dynamic_cast<InputPort<MidiMessage>*>(_dst_port));
- } else {
- _error = TYPE_MISMATCH;
- QueuedEvent::pre_process();
- return;
- }
-
- assert(_typed_event);
- _typed_event->pre_process();
- assert(_typed_event->is_prepared());
-
- QueuedEvent::pre_process();
-}
-
-
-void
-DisconnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
-{
- QueuedEvent::execute(nframes, start, end);
-
- if (_error == NO_ERROR)
- _typed_event->execute(nframes, start, end);
-}
-
-
-void
-DisconnectionEvent::post_process()
-{
- if (_error == NO_ERROR) {
- _typed_event->post_process();
- } else {
- // FIXME: better error messages
- string msg = "Unable to disconnect ";
- msg.append(_src_port_path + " -> " + _dst_port_path);
- _responder->respond_error(msg);
- }
-}
-
-
-
-//// TypedDisconnectionEvent ////
-
-
-template <typename T>
-TypedDisconnectionEvent<T>::TypedDisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port)
-: QueuedEvent(engine, responder, timestamp),
- _src_port(src_port),
- _dst_port(dst_port),
- _patch(NULL),
- _process_order(NULL),
- _succeeded(true)
-{
- assert(src_port != NULL);
- assert(dst_port != NULL);
-}
-
+ _dst_input_port = dynamic_cast<InputPort*>(_dst_port);
+ _src_output_port = dynamic_cast<OutputPort*>(_src_port);
+ assert(_src_output_port);
+ assert(_dst_input_port);
-template <typename T>
-void
-TypedDisconnectionEvent<T>::pre_process()
-{
- if (!_dst_port->is_connected_to(_src_port)) {
- _succeeded = false;
+ if (!_dst_input_port->is_connected_to(_src_output_port)) {
+ _error = NOT_CONNECTED;
QueuedEvent::pre_process();
return;
}
@@ -209,7 +133,7 @@ TypedDisconnectionEvent<T>::pre_process()
assert(_patch);
if (src_node == NULL || dst_node == NULL) {
- _succeeded = false;
+ _error = PARENTS_NOT_FOUND;
QueuedEvent::pre_process();
return;
}
@@ -229,21 +153,18 @@ TypedDisconnectionEvent<T>::pre_process()
if (_patch->enabled())
_process_order = _patch->build_process_order();
- _succeeded = true;
- QueuedEvent::pre_process();
+ QueuedEvent::pre_process();
}
-template <typename T>
void
-TypedDisconnectionEvent<T>::execute(SampleCount nframes, FrameTime start, FrameTime end)
+DisconnectionEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
{
QueuedEvent::execute(nframes, start, end);
- if (_succeeded) {
-
- Raul::ListNode<TypedConnection<T>*>* const port_connection
- = _dst_port->remove_connection(_src_port);
+ if (_error == NO_ERROR) {
+ Raul::ListNode<Connection*>* const port_connection
+ = _dst_input_port->remove_connection(_src_output_port);
if (port_connection != NULL) {
Raul::ListNode<Connection*>* const patch_connection
@@ -261,23 +182,23 @@ TypedDisconnectionEvent<T>::execute(SampleCount nframes, FrameTime start, FrameT
_engine.maid()->push(_patch->process_order());
_patch->process_order(_process_order);
} else {
- _succeeded = false; // Ports weren't connected
+ _error = CONNECTION_NOT_FOUND;
}
}
}
-template <typename T>
void
-TypedDisconnectionEvent<T>::post_process()
+DisconnectionEvent::post_process()
{
- if (_succeeded) {
-
+ if (_error == NO_ERROR) {
_responder->respond_ok();
-
_engine.broadcaster()->send_disconnection(_src_port->path(), _dst_port->path());
} else {
- _responder->respond_error("Unable to disconnect ports.");
+ // FIXME: better error messages
+ string msg = "Unable to disconnect ";
+ msg.append(_src_port_path + " -> " + _dst_port_path);
+ _responder->respond_error(msg);
}
}
diff --git a/src/libs/engine/events/DisconnectionEvent.h b/src/libs/engine/events/DisconnectionEvent.h
index 01a72e85..3faeb23e 100644
--- a/src/libs/engine/events/DisconnectionEvent.h
+++ b/src/libs/engine/events/DisconnectionEvent.h
@@ -36,10 +36,9 @@ class Node;
class Connection;
class MidiMessage;
class Port;
-template <typename T> class TypedConnection;
-template <typename T> class InputPort;
-template <typename T> class OutputPort;
-template <typename T> class TypedDisconnectionEvent; // helper, defined below
+class Connection;
+class InputPort;
+class OutputPort;
/** Make a Connection between two Ports.
@@ -51,7 +50,6 @@ class DisconnectionEvent : public QueuedEvent
public:
DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, const string& src_port_path, const string& dst_port_path);
DisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, Port* const src_port, Port* const dst_port);
- ~DisconnectionEvent();
void pre_process();
void execute(SampleCount nframes, FrameTime start, FrameTime end);
@@ -59,50 +57,33 @@ public:
private:
- enum ErrorType { NO_ERROR, PARENT_PATCH_DIFFERENT, PORT_NOT_FOUND, TYPE_MISMATCH };
-
- Path _src_port_path;
- Path _dst_port_path;
+ enum ErrorType {
+ NO_ERROR,
+ PARENT_PATCH_DIFFERENT,
+ PORT_NOT_FOUND,
+ TYPE_MISMATCH,
+ NOT_CONNECTED,
+ PARENTS_NOT_FOUND,
+ CONNECTION_NOT_FOUND
+ };
- Patch* _patch;
- Port* _src_port;
- Port* _dst_port;
-
- bool _lookup;
- QueuedEvent* _typed_event;
+ Path _src_port_path;
+ Path _dst_port_path;
- ErrorType _error;
-};
+ Patch* _patch;
+ Port* _src_port;
+ Port* _dst_port;
+ OutputPort* _src_output_port;
+ InputPort* _dst_input_port;
-
-/** Templated DisconnectionEvent.
- *
- * Intended to be called from DisconnectionEvent so callers (ie OSCReceiver)
- * can use DisconnectionEvent without knowing anything about types (which
- * they can't, since all they have is Port paths).
- */
-template <typename T>
-class TypedDisconnectionEvent : public QueuedEvent
-{
-public:
- TypedDisconnectionEvent(Engine& engine, SharedPtr<Responder> responder, SampleCount timestamp, OutputPort<T>* src_port, InputPort<T>* dst_port);
+ bool _lookup;
- void pre_process();
- void execute(SampleCount nframes, FrameTime start, FrameTime end);
- void post_process();
-
-private:
- OutputPort<T>* _src_port;
- InputPort<T>* _dst_port;
-
- Patch* _patch;
- Raul::Array<Node*>* _process_order; ///< New process order for Patch
+ Raul::Array<Node*>* _process_order; ///< New process order for Patch
- bool _succeeded;
+ ErrorType _error;
};
-
} // namespace Ingen
#endif // DISCONNECTIONEVENT_H
diff --git a/src/libs/engine/events/RequestObjectEvent.cpp b/src/libs/engine/events/RequestObjectEvent.cpp
index d383fdbd..bd25f514 100644
--- a/src/libs/engine/events/RequestObjectEvent.cpp
+++ b/src/libs/engine/events/RequestObjectEvent.cpp
@@ -17,14 +17,14 @@
#include "RequestObjectEvent.h"
#include <string>
+#include "interface/ClientInterface.h"
#include "Responder.h"
#include "Engine.h"
-#include "interface/ClientInterface.h"
-#include "TypedPort.h"
#include "ObjectStore.h"
#include "ClientBroadcaster.h"
#include "Patch.h"
#include "Node.h"
+#include "Port.h"
#include "ObjectSender.h"
using std::string;
diff --git a/src/libs/engine/events/RequestPluginEvent.cpp b/src/libs/engine/events/RequestPluginEvent.cpp
index 9035cbc5..64a63aea 100644
--- a/src/libs/engine/events/RequestPluginEvent.cpp
+++ b/src/libs/engine/events/RequestPluginEvent.cpp
@@ -17,10 +17,10 @@
#include "RequestPluginEvent.h"
#include <string>
+#include "interface/ClientInterface.h"
#include "Responder.h"
#include "Engine.h"
-#include "interface/ClientInterface.h"
-#include "TypedPort.h"
+#include "Port.h"
#include "ObjectStore.h"
#include "ClientBroadcaster.h"
#include "NodeFactory.h"
diff --git a/src/libs/engine/events/RequestPortValueEvent.cpp b/src/libs/engine/events/RequestPortValueEvent.cpp
index 3155e72f..533cac38 100644
--- a/src/libs/engine/events/RequestPortValueEvent.cpp
+++ b/src/libs/engine/events/RequestPortValueEvent.cpp
@@ -17,12 +17,13 @@
#include "RequestPortValueEvent.h"
#include <string>
+#include "interface/ClientInterface.h"
#include "Responder.h"
#include "Engine.h"
-#include "interface/ClientInterface.h"
-#include "TypedPort.h"
+#include "Port.h"
#include "ObjectStore.h"
#include "ClientBroadcaster.h"
+#include "AudioBuffer.h"
using std::string;
@@ -55,7 +56,7 @@ RequestPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime e
assert(_time >= start && _time <= end);
if (_port != NULL && _port->type() == DataType::FLOAT)
- _value = ((TypedPort<Sample>*)_port)->buffer(0)->value_at(0/*_time - start*/);
+ _value = ((AudioBuffer*)_port->buffer(0))->value_at(0/*_time - start*/);
else
_port = NULL; // triggers error response
}
diff --git a/src/libs/engine/events/SetPortValueEvent.cpp b/src/libs/engine/events/SetPortValueEvent.cpp
index 4924caa0..5d8127e6 100644
--- a/src/libs/engine/events/SetPortValueEvent.cpp
+++ b/src/libs/engine/events/SetPortValueEvent.cpp
@@ -18,10 +18,11 @@
#include "SetPortValueEvent.h"
#include "Responder.h"
#include "Engine.h"
-#include "TypedPort.h"
+#include "Port.h"
#include "ClientBroadcaster.h"
#include "Node.h"
#include "ObjectStore.h"
+#include "AudioBuffer.h"
namespace Ingen {
@@ -64,11 +65,13 @@ SetPortValueEvent::execute(SampleCount nframes, FrameTime start, FrameTime end)
} else if (!(_port->type() == DataType::FLOAT)) {
_error = TYPE_MISMATCH;
} else {
- if (_voice_num == -1)
- ((TypedPort<Sample>*)_port)->set_value(_val, _time - start);
+ AudioBuffer* const buf = (AudioBuffer*)_port->buffer(0);
+ const size_t offset = (buf->size() == 1) ? 0 : _time - start;
+ if (_voice_num == -1)
+ for (size_t i=0; i < _port->poly(); ++i)
+ ((AudioBuffer*)_port->buffer(i))->set(_val, offset);
else
- ((TypedPort<Sample>*)_port)->set_value(_voice_num, _val, _time - start);
- //((TypedPort<Sample>*)_port)->buffer(_voice_num)->set(_val, offset); // FIXME: check range
+ ((AudioBuffer*)_port->buffer(_voice_num))->set(_val, offset);
}
}
diff --git a/src/libs/engine/events/SetPortValueQueuedEvent.cpp b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
index 139d63a2..1eaa33cb 100644
--- a/src/libs/engine/events/SetPortValueQueuedEvent.cpp
+++ b/src/libs/engine/events/SetPortValueQueuedEvent.cpp
@@ -18,11 +18,12 @@
#include "SetPortValueQueuedEvent.h"
#include "Responder.h"
#include "Engine.h"
-#include "TypedPort.h"
+#include "Port.h"
#include "ClientBroadcaster.h"
#include "Plugin.h"
#include "Node.h"
#include "ObjectStore.h"
+#include "AudioBuffer.h"
namespace Ingen {
@@ -74,11 +75,14 @@ SetPortValueQueuedEvent::execute(SampleCount nframes, FrameTime start, FrameTime
assert(_time >= start && _time <= end);
if (_error == NO_ERROR) {
- assert(_port != NULL);
- if (_voice_num == -1)
- ((TypedPort<Sample>*)_port)->set_value(_val, _time - start);
+ assert(_port);
+ AudioBuffer* const buf = (AudioBuffer*)_port->buffer(0);
+ const size_t offset = (buf->size() == 1) ? 0 : _time - start;
+ if (_voice_num == -1)
+ for (size_t i=0; i < _port->poly(); ++i)
+ ((AudioBuffer*)_port->buffer(i))->set(_val, offset);
else
- ((TypedPort<Sample>*)_port)->buffer(_voice_num)->set(_val, _time - start); // FIXME: check range
+ ((AudioBuffer*)_port->buffer(_voice_num))->set(_val, offset);
}
}