summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/ControlBindings.cpp10
-rw-r--r--src/engine/ControlBindings.hpp2
2 files changed, 10 insertions, 2 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;
}
diff --git a/src/engine/ControlBindings.hpp b/src/engine/ControlBindings.hpp
index 092a2730..1227df09 100644
--- a/src/engine/ControlBindings.hpp
+++ b/src/engine/ControlBindings.hpp
@@ -76,7 +76,7 @@ private:
PortImpl* _learn_port;
void set_port_value(ProcessContext& context, PortImpl* port, Type type, int16_t value);
- void bind(ProcessContext& context, Type type, int16_t num=0);
+ bool bind(ProcessContext& context, Type type, int16_t num=0);
SharedPtr<Bindings> _bindings;
};