From 254b434f0a79fea54bd963e8ff2e845a5b0cd3a6 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 19 Mar 2012 20:16:46 +0000 Subject: Partially functioning communication between Ingen LV2 plugin and UI. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4078 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/AudioBuffer.cpp | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'src/server/AudioBuffer.cpp') diff --git a/src/server/AudioBuffer.cpp b/src/server/AudioBuffer.cpp index fc73f9d7..2b837d0b 100644 --- a/src/server/AudioBuffer.cpp +++ b/src/server/AudioBuffer.cpp @@ -35,46 +35,31 @@ using namespace Raul; namespace Ingen { namespace Server { -AudioBuffer::AudioBuffer(BufferFactory& bufs, PortType type, size_t size) - : ObjectBuffer(bufs, size) +AudioBuffer::AudioBuffer(BufferFactory& bufs, LV2_URID type, uint32_t size) + : Buffer(bufs, type, size) , _state(OK) , _set_value(0) , _set_time(0) { assert(size >= sizeof(LV2_Atom) + sizeof(Sample)); - assert(this->size() >= size); + assert(this->capacity() >= size); assert(data()); - _type = type; - // Control port / Single float object - if (type == PortType::CONTROL) { - atom()->type = 0;//map->float_type; - - // Audio port / Vector of float - } else { - assert(type == PortType::AUDIO || type == PortType::CV); - atom()->type = 0;//map->vector_type; + if (type == bufs.uris().atom_Sound) { + // Audio port (Vector of float) LV2_Atom_Vector* body = (LV2_Atom_Vector*)atom(); - body->body.child_size = sizeof(Sample); - body->body.child_type = 0;//map->float_type; + body->body.child_size = sizeof(float); + body->body.child_type = bufs.uris().atom_Float; } - /*debug << "Created Audio Buffer" << endl - << "\tobject @ " << (void*)atom() << endl - << "\tbody @ " << (void*)atom()->body - << "\t(offset " << (char*)atom()->body - (char*)atom() << ")" << endl - << "\tdata @ " << (void*)data() - << "\t(offset " << (char*)data() - (char*)atom() << ")" - << endl;*/ + _atom->type = type; clear(); } void -AudioBuffer::resize(size_t size) +AudioBuffer::resize(uint32_t size) { - if (_type == PortType::AUDIO) { - ObjectBuffer::resize(size + sizeof(LV2_Atom_Vector)); - } + Buffer::resize(size); clear(); } @@ -164,7 +149,7 @@ AudioBuffer::copy(Context& context, const Buffer* src) // Control => Control if (src_abuf->is_control() == is_control()) { - ObjectBuffer::copy(context, src); + Buffer::copy(context, src); // Audio => Audio } else if (!src_abuf->is_control() && !is_control()) { -- cgit v1.2.1