From cbed8ff4b83526eec34d07c478952e1738f4c8ed Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 9 Feb 2010 19:21:14 +0000 Subject: Make control bindings actually (audibly) take effect. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2436 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/ControlBindings.cpp | 14 ++++++++++++-- src/engine/events/SetPortValue.cpp | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp index 7f58c057..ac8deca5 100644 --- a/src/engine/ControlBindings.cpp +++ b/src/engine/ControlBindings.cpp @@ -21,6 +21,7 @@ #include "raul/IntrusivePtr.hpp" #include "events/SendPortValue.hpp" #include "events/SendBinding.hpp" +#include "AudioBuffer.hpp" #include "ControlBindings.hpp" #include "Engine.hpp" #include "EventBuffer.hpp" @@ -230,8 +231,17 @@ ControlBindings::port_value_to_control(PortImpl* port, Type type) void ControlBindings::set_port_value(ProcessContext& context, PortImpl* port, Type type, int16_t value) { - const Events::SendPortValue ev(context.engine(), context.start(), port, true, 0, - control_to_port_value(port, type, value)); + const Raul::Atom port_value(control_to_port_value(port, type, value)); + port->set_value(port_value); + + assert(port_value.type() == Atom::FLOAT); + assert(dynamic_cast(port->buffer(0).get())); + + for (uint32_t v = 0; v < port->poly(); ++v) + reinterpret_cast(port->buffer(v).get())->set_value( + port_value.get_float(), context.start(), context.start()); + + const Events::SendPortValue ev(context.engine(), context.start(), port, true, 0, port_value); context.event_sink().write(sizeof(ev), &ev); } diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp index 892abb67..8f8f331e 100644 --- a/src/engine/events/SetPortValue.cpp +++ b/src/engine/events/SetPortValue.cpp @@ -162,7 +162,7 @@ SetPortValue::apply(Context& context) /*} else if (_port->buffer(0)->capacity() < _data_size) { _error = NO_SPACE;*/ } else { - Buffer* const buf = _port->buffer(0).get(); + Buffer* const buf = _port->buffer(0).get(); AudioBuffer* const abuf = dynamic_cast(buf); if (abuf) { if (_value.type() != Atom::FLOAT) { -- cgit v1.2.1