summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-09 19:21:14 +0000
committerDavid Robillard <d@drobilla.net>2010-02-09 19:21:14 +0000
commitcbed8ff4b83526eec34d07c478952e1738f4c8ed (patch)
tree9f1986ea9a6ede0bcaddcaabb31dfac22c414d4e /src/engine
parented7ea1eb71d1cc4f68e31cd4815c6cbc04fd7818 (diff)
downloadingen-cbed8ff4b83526eec34d07c478952e1738f4c8ed.tar.gz
ingen-cbed8ff4b83526eec34d07c478952e1738f4c8ed.tar.bz2
ingen-cbed8ff4b83526eec34d07c478952e1738f4c8ed.zip
Make control bindings actually (audibly) take effect.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2436 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/ControlBindings.cpp14
-rw-r--r--src/engine/events/SetPortValue.cpp2
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) {