From 62bf2128fff4e6411be0d3890b49b6a26607cbf5 Mon Sep 17 00:00:00 2001 From: MrDham <32593747+MrDham@users.noreply.github.com> Date: Sun, 8 Oct 2017 20:35:46 +0200 Subject: [PATCH] Add files via upload --- Open_Theremin_V3/application.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Open_Theremin_V3/application.cpp b/Open_Theremin_V3/application.cpp index f3bfaff..0caf8ca 100644 --- a/Open_Theremin_V3/application.cpp +++ b/Open_Theremin_V3/application.cpp @@ -600,8 +600,12 @@ void Application::midi_application () switch (_midistate) { case MIDI_SILENT: - - // Always refresh midi volume value (synth sound could be in Release phase of ADSR) + // Synth sound could be in Release phase of ADSR or may have some delay or reverb effect so... + + // ... don't refresh pitch bend: + // Instruction "midi_key_follow = 0.5;" and unrefreshed notes would make pitch bend verry messy. + + // ... but always refresh midi volume value. if (new_midi_volume != old_midi_volume) { midi_msg_send(midi_channel, 0xB0, 0x07, new_midi_volume); @@ -679,10 +683,6 @@ void Application::midi_application () // Send note off midi_msg_send(midi_channel, 0x90, old_midi_note, 0); - // Don't refresh pitch bend: - // the following instruction "midi_key_follow = 0.5;" would make pitch bend verry messy - // and it simulates the impossibility of a vibrato on a mutted string (ok... theremin has no string) - // Set key follow to the minimum in order to use closest note played as the center note for pitch bend next time midi_key_follow = 0.5; @@ -694,6 +694,10 @@ void Application::midi_application () // Send all note off midi_msg_send(midi_channel, 0xB0, 0x7B, 0x00); + // Mute long release notes + midi_msg_send(midi_channel, 0xB0, 0x07, 0); + old_midi_volume = 0; + _midistate = MIDI_MUTE; break;