Do not use mixer initialization constant if they are not defined.

[GB.SDL2.AUDIO]
* BUG: Do not use mixer initialization constant if they are not defined.
This commit is contained in:
gambas 2018-01-14 23:23:19 +01:00
parent 319fb7175d
commit caf54c5b75

View file

@ -40,7 +40,7 @@ bool AUDIO_initialized = FALSE;
//-------------------------------------------------------------------------
static void init_mixer(int flag, const char *name)
static void init_mixer(int flag)
{
if ((Mix_Init(flag) & flag) != flag)
fprintf(stderr, "gb.sdl2.audio: warning: %s\n", Mix_GetError());
@ -54,11 +54,16 @@ bool AUDIO_init()
if (AUDIO_initialized)
return FALSE;
init_mixer(MIX_INIT_MP3, "MP3");
init_mixer(MIX_INIT_OGG, "OGG");
init_mixer(MIX_INIT_MOD, "MOD");
init_mixer(MIX_INIT_FLAC, "FLAC");
init_mixer(MIX_INIT_FLUIDSYNTH, "FLUIDSYNTH");
init_mixer(MIX_INIT_MP3);
init_mixer(MIX_INIT_OGG);
init_mixer(MIX_INIT_MOD);
init_mixer(MIX_INIT_FLAC);
#ifdef MIX_INIT_FLUIDSYNTH
init_mixer(MIX_INIT_FLUIDSYNTH);
#endif
#ifdef MIX_INIT_MID
init_mixer(MIX_INIT_MID);
#endif
if (Mix_OpenAudio(AUDIO_frequency, MIX_DEFAULT_FORMAT, 2, AUDIO_buffer_size))
{