commit 792b3aaf4356381eabd6efa15f9ec48b953f5611
Author: ceski <56656010+ceski-1@users.noreply.github.com>
AuthorDate: Mon Aug 22 06:33:58 2022 -0700
Commit: GitHub <noreply@github.com>
CommitDate: Mon Aug 22 15:33:58 2022 +0200
Fix Windows native MIDI level transitions (#1493)
---
src/i_winmusic.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/src/i_winmusic.c b/src/i_winmusic.c
index 8b085392..a3cd557f 100644
--- a/src/i_winmusic.c
+++ b/src/i_winmusic.c
@@ -411,6 +411,26 @@ void I_WIN_StopSong(void)
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);