diff options
author | David Robillard <d@drobilla.net> | 2012-05-23 02:21:53 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-05-23 02:21:53 +0000 |
commit | 5f11a5b2d3e040739bdebada9bab387075e1e177 (patch) | |
tree | 19760aaa06d2c7999b17c99c15ba86c8b63b2a2e /src/server | |
parent | 1fda196ac1ad416d39531c52724cec287756c385 (diff) | |
download | ingen-5f11a5b2d3e040739bdebada9bab387075e1e177.tar.gz ingen-5f11a5b2d3e040739bdebada9bab387075e1e177.tar.bz2 ingen-5f11a5b2d3e040739bdebada9bab387075e1e177.zip |
Fix copying of audio buffers and polyphonic audio output.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4445 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/server')
-rw-r--r-- | src/server/AudioBuffer.cpp | 9 | ||||
-rw-r--r-- | src/server/Buffer.cpp | 2 | ||||
-rw-r--r-- | src/server/JackDriver.cpp | 4 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/server/AudioBuffer.cpp b/src/server/AudioBuffer.cpp index 16a79bc0..a3c87fea 100644 --- a/src/server/AudioBuffer.cpp +++ b/src/server/AudioBuffer.cpp @@ -45,9 +45,12 @@ AudioBuffer::AudioBuffer(BufferFactory& bufs, LV2_URID type, uint32_t size) if (type == bufs.uris().atom_Sound) { // Audio port (Vector of float) - LV2_Atom_Vector* body = (LV2_Atom_Vector*)atom(); - body->body.child_size = sizeof(float); - body->body.child_type = bufs.uris().atom_Float; + LV2_Atom_Vector* vec = (LV2_Atom_Vector*)_atom; + vec->body.child_size = sizeof(float); + vec->body.child_type = bufs.uris().atom_Float; + _atom->size = size - sizeof(LV2_Atom_Vector); + } else { + _atom->size = size - sizeof(LV2_Atom); } _atom->type = type; diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index 4bc39c12..30a0781c 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -89,7 +89,7 @@ void Buffer::copy(Context& context, const Buffer* src) { // Copy only if src is a POD object that fits - if (src->_atom->type != 0 && sizeof(LV2_Atom) + src->_atom->size <= capacity()) { + if (src->_atom->type != 0 && sizeof(LV2_Atom) + src->_atom->size <= capacity()) { memcpy(_atom, src->_atom, sizeof(LV2_Atom) + src->_atom->size); } assert(_atom->type != 1); diff --git a/src/server/JackDriver.cpp b/src/server/JackDriver.cpp index 30673316..45b168f9 100644 --- a/src/server/JackDriver.cpp +++ b/src/server/JackDriver.cpp @@ -113,6 +113,7 @@ JackPort::pre_process(ProcessContext& context) _buffer = jack_port_get_buffer(_jack_port, nframes); if (!is_input()) { + ((AudioBuffer*)_patch_port->buffer(0).get())->clear(); return; } @@ -149,10 +150,11 @@ JackPort::post_process(ProcessContext& context) } if (!_buffer) { - // First cycle for a new outputs, so pre_process wasn't called + // First cycle for a new output, so pre_process wasn't called _buffer = jack_port_get_buffer(_jack_port, nframes); } + _patch_port->post_process(context); if (_patch_port->is_a(PortType::AUDIO)) { AudioBuffer* patch_buf = (AudioBuffer*)_patch_port->buffer(0).get(); |