summaryrefslogtreecommitdiffstats
path: root/src/engine/ControlBindings.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/ControlBindings.cpp')
-rw-r--r--src/engine/ControlBindings.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/engine/ControlBindings.cpp b/src/engine/ControlBindings.cpp
index 0c31c731..6fb1c6a8 100644
--- a/src/engine/ControlBindings.cpp
+++ b/src/engine/ControlBindings.cpp
@@ -109,16 +109,24 @@ ControlBindings::set_port_value(ProcessContext& context, PortImpl* port, Type ty
}
-void
+bool
ControlBindings::bind(ProcessContext& context, Type type, int16_t num)
{
+ const Shared::LV2URIMap& uris = Shared::LV2URIMap::instance();
assert(_learn_port);
+ if (type == MIDI_NOTE) {
+ bool toggled = _learn_port->has_property(uris.lv2_portProperty, uris.lv2_toggled);
+ if (!toggled)
+ return false;
+ }
+
_bindings->insert(make_pair(Key(type, num), _learn_port));
const Events::SendBinding ev(context.engine(), context.start(), _learn_port, type, num);
context.event_sink().write(sizeof(ev), &ev);
_learn_port = NULL;
+ return true;
}