summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-02-03 07:35:34 +0000
committerDavid Robillard <d@drobilla.net>2010-02-03 07:35:34 +0000
commit38c9341c63c09ded0ad2f69c1948d2da41c416c2 (patch)
tree450cc74ded35a0f844ff9d23aa69ede1821dbdaa /src
parent60968da24dd2b92fc392d1b91e73245770b5a4af (diff)
downloadingen-38c9341c63c09ded0ad2f69c1948d2da41c416c2.tar.gz
ingen-38c9341c63c09ded0ad2f69c1948d2da41c416c2.tar.bz2
ingen-38c9341c63c09ded0ad2f69c1948d2da41c416c2.zip
Only bind notes to toggle controls, so it is possible to bind non-toggle controls to aftertouch.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2413 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-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;
};