From 10d483417fa70bb4c357d598f3bdfcf4f0b75f21 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 1 Apr 2019 20:22:14 +0200 Subject: Add midi aftertouch choke for plugins. --- plugin/drumgizmo_plugin.cc | 32 +++++++++++++++++++++++++------- plugin/plugingizmo | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'plugin') diff --git a/plugin/drumgizmo_plugin.cc b/plugin/drumgizmo_plugin.cc index 3328f6b..67436af 100644 --- a/plugin/drumgizmo_plugin.cc +++ b/plugin/drumgizmo_plugin.cc @@ -372,15 +372,33 @@ void DrumGizmoPlugin::Input::run(size_t pos, size_t len, std::vector& e for(auto& event : *plugin.input_events) { - if(event.type != MidiEventType::NoteOn) + switch(event.type) { - continue; - } + case MidiEventType::NoteOn: + { + int i = mmap.lookup(event.key); + if(event.velocity != 0 && (i != -1)) + { + events.push_back({EventType::OnSet, (size_t)i, + (size_t)event.getTime(), event.velocity / 127.0f}); + } + } + break; - int i = mmap.lookup(event.key); - if(event.velocity && (i != -1)) - { - events.push_back({EventType::OnSet, (size_t)i, (size_t)event.getTime(), event.velocity / 127.0f}); + case MidiEventType::Aftertouch: + { + int i = mmap.lookup(event.key); + if(event.velocity == 0 && i != -1) + { + events.push_back({EventType::Choke, (size_t)i, + (size_t)event.getTime(), .0f}); + } + } + break; + + case MidiEventType::NoteOff: + case MidiEventType::Unknown: + break; } } } diff --git a/plugin/plugingizmo b/plugin/plugingizmo index cf2311b..34bfc50 160000 --- a/plugin/plugingizmo +++ b/plugin/plugingizmo @@ -1 +1 @@ -Subproject commit cf2311b09f788447d1c079274405477992eee9e8 +Subproject commit 34bfc5046bd297311a38dace8914c51905ca9d2e -- cgit v1.2.3