Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed 2 bugs that prevented GS banks from being selected. #55

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

RoqueDeicide
Copy link
Contributor

I initially noticed that the Reverse Cymbal was being played instead of Reverse Snare at the beginning of "One Night in Neo Kobe City" track featured in DBP37: AUGER;ZENITH megawad. This was happening with both internal and external FluidSynth instances, as well as with Microsoft GS Wavetable Synth. I realized that they weren't reacting to Bank Select ControlChange MIDI messages.

After a lot of digging, I finally found out, what was causing it: a SysEx message sent by MIDIStreamer::FillBuffer function. It appears, there was a misunderstanding of its purpose: in the comment it's referred to as a "GS System Reset", but it's actually a "GM System Enable" message. It's primary effect is to switch the synth to a pure GM mode, with a system reset as a side effect.

I've decided to keep the message, so that any pure GM synth can perform a system reset, but I've changed the comment to properly reflect its identity. I've also added another SysEx message, called "GS DT1 MODE SET" to instruct the synth to switch to GS mode, if one is supported.

The change worked, but only with MSGSWS and external FluidSynth, not with internal FluidSynth. After more digging, I chanced upon a bug from all the way back in August 2010: the number of bytes reported to FluidSynth as comprising the SysEx message was 1 too big, as both first and last bytes needed to be excluded, not just the first one. This didn't matter for "GM System Enable" message, as when processing it, FluidSynth doesn't check the byte count. I've fixed the bug and added a clarifying comment.

These changes were only tested with internal and external FluidSynth and MSGSWS.

@coelckers coelckers merged commit 7476a18 into ZDoom:master Feb 29, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants