From 63ad2b2cb8d2bc5ab8034606b50e975e4382891a Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Mon, 11 Apr 2022 15:56:33 +0200 Subject: [PATCH] Parse redundant CLAP MIDI events just in case --- src/wrapper/clap/wrapper.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/wrapper/clap/wrapper.rs b/src/wrapper/clap/wrapper.rs index 11e73e36..f398a6ee 100644 --- a/src/wrapper/clap/wrapper.rs +++ b/src/wrapper/clap/wrapper.rs @@ -982,6 +982,33 @@ impl Wrapper

{ let event_type = event.data[0] & midi::EVENT_TYPE_MASK; let channel = event.data[0] & midi::MIDI_CHANNEL_MASK; match event_type { + // Hosts shouldn't be sending this, bu twe'll handle it just in case + midi::NOTE_ON => { + input_events.push_back(NoteEvent::NoteOn { + timing: raw_event.time - current_sample_idx as u32, + channel, + note: event.data[1], + velocity: event.data[2] as f32 / 127.0, + }); + } + // Hosts shouldn't be sending this, bu twe'll handle it just in case + midi::NOTE_OFF => { + input_events.push_back(NoteEvent::NoteOff { + timing: raw_event.time - current_sample_idx as u32, + channel, + note: event.data[1], + velocity: event.data[2] as f32 / 127.0, + }); + } + // Hosts shouldn't be sending this, bu twe'll handle it just in case + midi::POLYPHONIC_KEY_PRESSURE => { + input_events.push_back(NoteEvent::PolyPressure { + timing: raw_event.time - current_sample_idx as u32, + channel, + note: event.data[1], + pressure: event.data[2] as f32 / 127.0, + }); + } midi::CHANNEL_KEY_PRESSURE => { input_events.push_back(NoteEvent::MidiChannelPressure { timing: raw_event.time - current_sample_idx as u32,