We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3057

Summary: allow to set distribution-specific set of default soundfonts
Product: SDL_mixer Reporter: Fabian Greffrath <fabian+debian>
Component: miscAssignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.0   
Hardware: x86_64   
OS: Linux   
Attachments: no sf2 sound fonts loaded by default

Description Fabian Greffrath 2015-07-10 18:16:48 UTC
Created attachment 2217 [details]
no sf2 sound fonts loaded by default

Hi there,

it is possible for quite some time to render music with fluidsynth using sf2 soundfonts, and actually, this should always be preferred to rendering with timidity and freepats. However, for this to work you have to either set the actual path to the sf2 soundfont file with Mix_SetSoundFonts() in-game or specify some paths in the SDL_SOUNDFONTS environment variable and additionally enforce their usage with the SDL_FORCE_SOUNDFONTS variable.

However, in Debian we have packaged two separate sf2 soundfonts that can be used with fluidsynth and that actually should be used if they are found installed - even without the need to specify two environment variables. My attached patch allows to specify the path to the soundfont files at build time by means of a #defines.

Second, if there is more than one soundfont path specified in the soundfont_paths variable, the Mix_EachSoundFont() function currently errors out when the first one in the list cannot be found. For my approach, however, it should return success if at least one of the specified soundfonts is found. This is because we know we could have two soundfonts installed on the system, but we don't know which one or if both.

We have applied this patch successfully since SDL_mixer 1.2.12-6 (11 Jul 2013) and it works flawlessly, i.e. music is rendered with fluidsynth if at least one of the two soundfonts specified at build time are found at runtime.


Thank you for considering!

 - Fabian
Comment 1 Fabian Greffrath 2015-07-10 18:18:55 UTC
This is th part in debian/rules that sets the paths to the soundfont files:

export DEB_CPPFLAGS_MAINT_APPEND := -DMIX_INIT_SOUNDFONT_PATHS=\"/usr/share/sounds/sf2/TimGM6mb.sf2:/usr/share/sounds/sf2/FluidR3_GM.sf2\"

The soundfonts can be found in the musescore-soundfont-gm and fluid-soundfont-gm packages, respectively.
Comment 2 Sam Lantinga 2017-10-13 06:05:35 UTC
Patch is added, thanks!
https://hg.libsdl.org/SDL_mixer/rev/6c6adcc85536