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

Documentation bug in Mix_SetSoundFonts regarding FluidSynth #596

Open
cspiegel opened this issue Mar 2, 2024 · 0 comments
Open

Documentation bug in Mix_SetSoundFonts regarding FluidSynth #596

cspiegel opened this issue Mar 2, 2024 · 0 comments

Comments

@cspiegel
Copy link

cspiegel commented Mar 2, 2024

Mix_SetSoundFonts includes this in its documentation:

You may specify multiple paths in a single string by separating them with semicolons; they will be searched in the order listed.

I assume "searched in the order listed" means that the first-listed will be prioritized. However, this is not correct. In fact, the last-listed has the highest priority, when used with FluidSynth. The Mac backend looks like it also uses SoundFonts, but I'm not sure if this applies to it: I don't know what order things are loaded there.

The FluidSynth backend does this:

Mix_EachSoundFont(fluidsynth_load_soundfont, music->synth)

Which iterates over the provided SoundFonts in order, calling fluidsynth_load_soundfont for each one. fluidsynth_load_soundfont calls fluid_synth_sfload, which is documented:

The newly loaded SoundFont will be put on top of the SoundFont stack. Presets are searched starting from the SoundFont on the top of the stack, working the way down the stack until a preset is found.

So, the last added SoundFont goes on the top of the stack, and the stack is searched downward.

Testing agrees with this: the last-listed SoundFont does take priority, i.e. its instruments are used, with earlier-listed SoundFonts only being consulted for missing instruments.

A fix is simple (either change the docs or iterate backward over the list), but I'm not sure which is preferred.

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

No branches or pull requests

1 participant