summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-12 03:24:54 +0000
committerDavid Robillard <d@drobilla.net>2012-08-12 03:24:54 +0000
commit5fae80a1340441467ec03ad34f39cfd3273f7099 (patch)
tree664ec4d22e62506828f6fee377e9f01e553a75af
parentcaea04d25727267349b43a17b5b0bd99c7dc6af4 (diff)
downloadingen-5fae80a1340441467ec03ad34f39cfd3273f7099.tar.gz
ingen-5fae80a1340441467ec03ad34f39cfd3273f7099.tar.bz2
ingen-5fae80a1340441467ec03ad34f39cfd3273f7099.zip
Faster control input as LV2.
Control and sequence output for LV2. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4664 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/server/ingen_lv2.cpp31
1 files changed, 20 insertions, 11 deletions
diff --git a/src/server/ingen_lv2.cpp b/src/server/ingen_lv2.cpp
index e5b0c658..43b8503d 100644
--- a/src/server/ingen_lv2.cpp
+++ b/src/server/ingen_lv2.cpp
@@ -98,18 +98,18 @@ public:
return;
}
+ Buffer* const patch_buf = _patch_port->buffer(0).get();
if (_patch_port->is_a(PortType::AUDIO) ||
_patch_port->is_a(PortType::CV)) {
- Buffer* patch_buf = _patch_port->buffer(0).get();
- memcpy(patch_buf->samples(), _buffer, context.nframes() * sizeof(float));
+ memcpy(patch_buf->samples(),
+ _buffer,
+ context.nframes() * sizeof(float));
} else if (_patch_port->is_a(PortType::CONTROL)) {
- Buffer* patch_buf = _patch_port->buffer(0).get();
- memcpy(patch_buf->samples(), _buffer, sizeof(float));
+ patch_buf->samples()[0] = ((float*)_buffer)[0];
} else {
- LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_buffer;
- bool enqueued = false;
- Buffer* patch_buf = _patch_port->buffer(0).get();
- URIs& uris = _patch_port->bufs().uris();
+ LV2_Atom_Sequence* seq = (LV2_Atom_Sequence*)_buffer;
+ bool enqueued = false;
+ URIs& uris = _patch_port->bufs().uris();
patch_buf->prepare_write(context);
LV2_ATOM_SEQUENCE_FOREACH(seq, ev) {
if (!patch_buf->append_event(
@@ -135,9 +135,18 @@ public:
return;
}
- if (_patch_port->is_a(PortType::AUDIO)) {
- Buffer* patch_buf = _patch_port->buffer(0).get();
- memcpy((Sample*)_buffer, patch_buf->samples(), context.nframes() * sizeof(Sample));
+ Buffer* patch_buf = _patch_port->buffer(0).get();
+ if (_patch_port->is_a(PortType::AUDIO) ||
+ _patch_port->is_a(PortType::CV)) {
+ memcpy(_buffer,
+ patch_buf->samples(),
+ context.nframes() * sizeof(float));
+ } else if (_patch_port->is_a(PortType::CONTROL)) {
+ ((float*)_buffer)[0] = patch_buf->samples()[0];
+ } else {
+ memcpy(patch_buf->atom(),
+ _buffer,
+ sizeof(LV2_Atom) + ((LV2_Atom*)_buffer)->size);
}
}