diff options
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/ControlBindings.cpp | 14 | ||||
-rw-r--r-- | src/engine/events/SetPortValue.cpp | 2 |
2 files changed, 13 insertions, 3 deletions
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<AudioBuffer*>(port->buffer(0).get())); + + for (uint32_t v = 0; v < port->poly(); ++v) + reinterpret_cast<AudioBuffer*>(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<AudioBuffer*>(buf); if (abuf) { if (_value.type() != Atom::FLOAT) { |