shithub: choc

Download patch

ref: 792b3aaf4356381eabd6efa15f9ec48b953f5611
parent: ff3a9a5f3822d54c95e0534195c9155f8e46f229
author: ceski <56656010+ceski-1@users.noreply.github.com>
date: Mon Aug 22 02:33:58 EDT 2022

Fix Windows native MIDI level transitions (#1493)


--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -411,6 +411,26 @@
         midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
         msg = MIDI_EVENT_CONTROLLER | i | 0x65 << 8 | 0x7F << 16;
         midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+
+        // reset all controllers
+        msg = MIDI_EVENT_CONTROLLER | i | 0x79 << 8 | 0x00 << 16;
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+
+        // reset pan to 64 (center)
+        msg = MIDI_EVENT_CONTROLLER | i | 0x0A << 8 | 0x40 << 16;
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+
+        // reset reverb to 40 and other effect controllers to 0
+        msg = MIDI_EVENT_CONTROLLER | i | 0x5B << 8 | 0x28 << 16; // reverb
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+        msg = MIDI_EVENT_CONTROLLER | i | 0x5C << 8 | 0x00 << 16; // tremolo
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+        msg = MIDI_EVENT_CONTROLLER | i | 0x5D << 8 | 0x00 << 16; // chorus
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+        msg = MIDI_EVENT_CONTROLLER | i | 0x5E << 8 | 0x00 << 16; // detune
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
+        msg = MIDI_EVENT_CONTROLLER | i | 0x5F << 8 | 0x00 << 16; // phaser
+        midiOutShortMsg((HMIDIOUT)hMidiStream, msg);
     }
 
     mmr = midiStreamStop(hMidiStream);