diff --git a/lv2/sfizz.c b/lv2/sfizz.c index b0b9ab5d..67501d85 100644 --- a/lv2/sfizz.c +++ b/lv2/sfizz.c @@ -495,28 +495,27 @@ sfizz_lv2_process_midi_event(sfizz_plugin_t *self, const LV2_Atom_Event *ev) switch (lv2_midi_message_type(msg)) { case LV2_MIDI_MSG_NOTE_ON: - // LV2_DEBUG("[process_midi] Received note on %d/%d at time %ld\n", msg[0], msg[1], ev->time.frames); + if (msg[2] == 0) + goto noteoff; // 0 velocity note-ons should be forbidden but just in case... + sfizz_send_note_on(self->synth, (int)ev->time.frames, (int)msg[1], msg[2]); break; - case LV2_MIDI_MSG_NOTE_OFF: - // LV2_DEBUG("[process_midi] Received note off %d/%d at time %ld\n", msg[0], msg[1], ev->time.frames); + case LV2_MIDI_MSG_NOTE_OFF: noteoff: sfizz_send_note_off(self->synth, (int)ev->time.frames, (int)msg[1], msg[2]); break; case LV2_MIDI_MSG_CONTROLLER: - // LV2_DEBUG("[process_midi] Received CC %d/%d at time %ld\n", msg[0], msg[1], ev->time.frames); sfizz_send_cc(self->synth, (int)ev->time.frames, (int)msg[1], msg[2]); break; case LV2_MIDI_MSG_BENDER: - // LV2_DEBUG("[process_midi] Received pitch bend %d on channel %d at time %ld\n", PITCH_BUILD_AND_CENTER(msg[1], msg[2]), MIDI_CHANNEL(msg[0]), ev->time.frames); sfizz_send_pitch_wheel(self->synth, (int)ev->time.frames, PITCH_BUILD_AND_CENTER(msg[1], msg[2])); diff --git a/vst/SfizzVstProcessor.cpp b/vst/SfizzVstProcessor.cpp index 46fab205..56aef12a 100644 --- a/vst/SfizzVstProcessor.cpp +++ b/vst/SfizzVstProcessor.cpp @@ -284,7 +284,10 @@ void SfizzVstProcessor::processEvents(Vst::IEventList& events) switch (e.type) { case Vst::Event::kNoteOnEvent: - synth.noteOn(e.sampleOffset, e.noteOn.pitch, convertVelocityFromFloat(e.noteOn.velocity)); + if (e.noteOn.velocity == 0.0f) + synth.noteOff(e.sampleOffset, e.noteOn.pitch, 0); + else + synth.noteOn(e.sampleOffset, e.noteOn.pitch, convertVelocityFromFloat(e.noteOn.velocity)); break; case Vst::Event::kNoteOffEvent: synth.noteOff(e.sampleOffset, e.noteOff.pitch, convertVelocityFromFloat(e.noteOff.velocity));