From 3d89115a67a9c947a28539ffdd2399808a53279b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 16 Nov 2009 00:30:35 +0000 Subject: Rework objects extension to have "value ports" and "message ports". Make audio and control buffers in ingen actually object buffers (towards interop). Overhaul the hell out of ingen buffer and mixing stuff. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2266 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/events/Connect.cpp | 2 +- src/engine/events/CreateNode.cpp | 2 +- src/engine/events/CreatePort.cpp | 2 +- src/engine/events/RequestMetadata.cpp | 4 ++-- src/engine/events/SetMetadata.cpp | 2 +- src/engine/events/SetPortValue.cpp | 16 ++++++++-------- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src/engine/events') diff --git a/src/engine/events/Connect.cpp b/src/engine/events/Connect.cpp index 6c7bf2fe..62e32916 100644 --- a/src/engine/events/Connect.cpp +++ b/src/engine/events/Connect.cpp @@ -133,7 +133,7 @@ Connect::pre_process() return; } - _connection = SharedPtr(new ConnectionImpl(_src_port, _dst_port)); + _connection = SharedPtr(new ConnectionImpl(*_engine.buffer_factory(), _src_port, _dst_port)); _patch_listnode = new PatchImpl::Connections::Node(_connection); _port_listnode = new InputPort::Connections::Node(_connection); diff --git a/src/engine/events/CreateNode.cpp b/src/engine/events/CreateNode.cpp index 6c70d481..9a9e0826 100644 --- a/src/engine/events/CreateNode.cpp +++ b/src/engine/events/CreateNode.cpp @@ -90,7 +90,7 @@ CreateNode::pre_process() if (_patch && _plugin) { - _node = _plugin->instantiate(_path.name(), _polyphonic, _patch, _engine); + _node = _plugin->instantiate(*_engine.buffer_factory(), _path.name(), _polyphonic, _patch, _engine); if (_node != NULL) { _node->properties().insert(_properties.begin(), _properties.end()); diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp index 5ea78fb0..848092b1 100644 --- a/src/engine/events/CreatePort.cpp +++ b/src/engine/events/CreatePort.cpp @@ -98,7 +98,7 @@ CreatePort::pre_process() const uint32_t old_num_ports = _patch->num_ports(); - _patch_port = _patch->create_port(_path.name(), _data_type, buffer_size, _is_output); + _patch_port = _patch->create_port(*_engine.buffer_factory(), _path.name(), _data_type, buffer_size, _is_output); if (_patch->parent()) _patch_port->set_property("rdf:instanceOf", Atom(Atom::URI, _patch_port->meta_uri().str())); diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp index e6ba7f5d..2ef3edda 100644 --- a/src/engine/events/RequestMetadata.cpp +++ b/src/engine/events/RequestMetadata.cpp @@ -95,10 +95,10 @@ RequestMetadata::execute(ProcessContext& context) PortImpl* port = dynamic_cast(_resource); if (port) { if (port->type() == DataType::CONTROL || port->type() == DataType::AUDIO) - _value = ((AudioBuffer*)port->buffer(0))->value_at(0); // TODO: offset + _value = ((AudioBuffer*)port->buffer(0).get())->value_at(0); // TODO: offset else if (port->type() == DataType::VALUE) LV2Object::to_atom(context.engine().world(), - ((ObjectBuffer*)port->buffer(0))->data(), _value); + ((ObjectBuffer*)port->buffer(0).get())->object(), _value); } else { _resource = 0; } diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp index 3d62781d..caed4909 100644 --- a/src/engine/events/SetMetadata.cpp +++ b/src/engine/events/SetMetadata.cpp @@ -162,7 +162,7 @@ SetMetadata::pre_process() } else if (key.str() == "ingen:polyphony") { if (value.type() == Atom::INT) { op = POLYPHONY; - _patch->prepare_internal_poly(value.get_int32()); + _patch->prepare_internal_poly(*_engine.buffer_factory(), value.get_int32()); } else { _error = BAD_TYPE; } diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp index 6b9d8d9e..2a33b798 100644 --- a/src/engine/events/SetPortValue.cpp +++ b/src/engine/events/SetPortValue.cpp @@ -151,7 +151,7 @@ SetPortValue::apply(Context& context) /*} else if (_port->buffer(0)->capacity() < _data_size) { _error = NO_SPACE;*/ } else { - Buffer* const buf = _port->buffer(0); + Buffer* const buf = _port->buffer(0).get(); AudioBuffer* const abuf = dynamic_cast(buf); if (abuf) { if (_value.type() != Atom::FLOAT) { @@ -160,12 +160,12 @@ SetPortValue::apply(Context& context) } if (_omni) { - for (uint32_t i=0; i < _port->poly(); ++i) - ((AudioBuffer*)_port->buffer(i))->set_value( + for (uint32_t v = 0; v < _port->poly(); ++v) + ((AudioBuffer*)_port->buffer(v).get())->set_value( _value.get_float(), start, _time); } else { if (_voice_num < _port->poly()) - ((AudioBuffer*)_port->buffer(_voice_num))->set_value( + ((AudioBuffer*)_port->buffer(_voice_num).get())->set_value( _value.get_float(), start, _time); else _error = ILLEGAL_VOICE; @@ -198,10 +198,10 @@ SetPortValue::apply(Context& context) ObjectBuffer* const obuf = dynamic_cast(buf); if (obuf) { - obuf->data()->size = obuf->size() - sizeof(LV2_Object); - if (LV2Object::from_atom(_engine.world(), _value, obuf->data())) { - cout << "Converted atom " << _value << " :: " << obuf->data()->type - << " * " << obuf->data()->size << " @ " << obuf->data() << endl; + obuf->object()->size = obuf->size() - sizeof(LV2_Object); + if (LV2Object::from_atom(_engine.world(), _value, obuf->object())) { + cout << "Converted atom " << _value << " :: " << obuf->object()->type + << " * " << obuf->object()->size << " @ " << obuf->object() << endl; return; } else { cerr << "WARNING: Failed to convert atom to LV2 object" << endl; -- cgit v1.2.1