summaryrefslogtreecommitdiffstats
path: root/src/libs/engine/events/SetPortValueQueuedEvent.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-04-08 06:04:32 +0000
committerDavid Robillard <d@drobilla.net>2007-04-08 06:04:32 +0000
commite96c36c1a7abb062e36efc0ac95c35fedcef922e (patch)
tree826d5caa0392201472d12c02a1c3df4cf7b275be /src/libs/engine/events/SetPortValueQueuedEvent.cpp
parent7d69e89f22304e37fa325ce4f39a374a02072a69 (diff)
downloadingen-e96c36c1a7abb062e36efc0ac95c35fedcef922e.tar.gz
ingen-e96c36c1a7abb062e36efc0ac95c35fedcef922e.tar.bz2
ingen-e96c36c1a7abb062e36efc0ac95c35fedcef922e.zip
De-template-ification of port types (req. for LV2 MIDI, but nice code size reduction).
LV2 MIDI patching support (LV2 style MIDI throughout, inc. internal plugins). git-svn-id: http://svn.drobilla.net/lad/ingen@415 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/engine/events/SetPortValueQueuedEvent.cpp')
-rw-r--r--src/libs/engine/events/SetPortValueQueuedEvent.cpp14
1 files changed, 9 insertions, 5 deletions
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);
}
}