Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
backport default/2.0 commits 6c6adcc and 1e215d1 for fluidsynth support:
- soundfont API functions are public and should always be available
(bugs 3071 and 3088)
- no sf2 sound fonts loaded by default (http://bugs.debian.org/715461 )
Loading branch information
Showing
2 changed files
with
10 additions
and
15 deletions .
+5
−4
mixer.c
+5
−11
music.c
@@ -107,9 +107,7 @@ static const char **chunk_decoders = NULL;
static int num_decoders = 0 ;
/* Semicolon-separated SoundFont paths */
#ifdef MID_MUSIC
extern char * soundfont_paths;
#endif
int Mix_GetNumChunkDecoders (void )
{
@@ -148,6 +146,11 @@ int Mix_Init(int flags)
{
int result = 0 ;
#ifdef MIX_INIT_SOUNDFONT_PATHS
if (!soundfont_paths)
soundfont_paths = SDL_strdup (MIX_INIT_SOUNDFONT_PATHS);
#endif
if (flags & MIX_INIT_FLUIDSYNTH) {
#ifdef USE_FLUIDSYNTH_MIDI
if ((initialized & MIX_INIT_FLUIDSYNTH) || Mix_InitFluidSynth () == 0 ) {
@@ -227,12 +230,10 @@ void Mix_Quit(void)
Mix_QuitOgg ();
}
#endif
#ifdef MID_MUSIC
if (soundfont_paths) {
SDL_free (soundfont_paths);
soundfont_paths=NULL ;
}
#endif
initialized = 0 ;
}
@@ -145,9 +145,7 @@ static const char **music_decoders = NULL;
static int num_decoders = 0 ;
/* Semicolon-separated SoundFont paths */
#ifdef MID_MUSIC
char * soundfont_paths = NULL ;
#endif
int Mix_GetNumMusicDecoders (void )
{
@@ -1527,7 +1525,6 @@ void close_music(void)
int Mix_SetSoundFonts (const char *paths)
{
#ifdef MID_MUSIC
if (soundfont_paths) {
SDL_free (soundfont_paths);
soundfont_paths = NULL ;
@@ -1539,26 +1536,24 @@ int Mix_SetSoundFonts(const char *paths)
return 0 ;
}
}
#endif
return 1 ;
}
#ifdef MID_MUSIC
const char * Mix_GetSoundFonts (void )
{
const char * force = getenv (" SDL_FORCE_SOUNDFONTS" );
if (!soundfont_paths || (force && force[0 ] == ' 1' )) {
return getenv (" SDL_SOUNDFONTS" );
} else {
return soundfont_paths;
}
return soundfont_paths;
}
int Mix_EachSoundFont (int (SDLCALL *function)(const char *, void *), void *data)
{
char *context, *path, *paths;
const char * cpaths = Mix_GetSoundFonts ();
int soundfonts_found = 0 ;
if (!cpaths) {
Mix_SetError (" No SoundFonts have been requested" );
@@ -1578,12 +1573,11 @@ int Mix_EachSoundFont(int (SDLCALL *function)(const char*, void*), void *data)
for (path = strtok_r (paths, " :;" , &context); path; path = strtok_r (NULL , " :;" , &context)) {
#endif
if (!function (path, data)) {
SDL_free (paths);
return 0 ;
continue ;
}
soundfonts_found++;
}
SDL_free (paths);
return 1 ;
return (soundfonts_found > 0 ) ;
}
#endif
Toggle all file notes
Toggle all file annotations