aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2018-03-24 20:26:29 +0100
committerDavid Robillard <d@drobilla.net>2018-04-07 15:08:08 +0200
commit728196c9d55100b63b74b2f118bd80d451636a6c (patch)
treea16b8946dc5d8c285064846420bd8ca606a3374b
parentc7fc25e43978c0c584e2e01498ff69df700320a3 (diff)
downloadlv2-728196c9d55100b63b74b2f118bd80d451636a6c.tar.xz
eg-midigate: Respond to "all notes off" MIDI message
-rw-r--r--lv2/lv2plug.in/ns/lv2core/meta.ttl2
-rw-r--r--plugins/eg-midigate.lv2/midigate.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/lv2/lv2plug.in/ns/lv2core/meta.ttl b/lv2/lv2plug.in/ns/lv2core/meta.ttl
index 5246758..0b655fd 100644
--- a/lv2/lv2plug.in/ns/lv2core/meta.ttl
+++ b/lv2/lv2plug.in/ns/lv2core/meta.ttl
@@ -44,6 +44,8 @@ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH R
dcs:item [
rdfs:label "eg-sampler: Add waveform display to UI."
] , [
+ rdfs:label "eg-midigate: Respond to \"all notes off\" MIDI message."
+ ] , [
rdfs:label "Add lv2_validate utility."
]
]
diff --git a/plugins/eg-midigate.lv2/midigate.c b/plugins/eg-midigate.lv2/midigate.c
index 3070660..a967384 100644
--- a/plugins/eg-midigate.lv2/midigate.c
+++ b/plugins/eg-midigate.lv2/midigate.c
@@ -165,7 +165,14 @@ run(LV2_Handle instance, uint32_t sample_count)
++self->n_active_notes;
break;
case LV2_MIDI_MSG_NOTE_OFF:
- --self->n_active_notes;
+ if (self->n_active_notes > 0) {
+ --self->n_active_notes;
+ }
+ break;
+ case LV2_MIDI_MSG_CONTROLLER:
+ if (msg[1] == LV2_MIDI_CTL_ALL_NOTES_OFF) {
+ self->n_active_notes = 0;
+ }
break;
case LV2_MIDI_MSG_PGM_CHANGE:
if (msg[1] == 0 || msg[1] == 1) {