Skip to content

Commit

Permalink
Fixed building with some audio support disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
slouken committed Nov 8, 2009
1 parent 2944433 commit da4949a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 48 deletions.
12 changes: 0 additions & 12 deletions dynamic_flac.c
Expand Up @@ -176,16 +176,4 @@ void Mix_QuitFLAC()
}
#endif /* FLAC_DYNAMIC */

#else

int Mix_InitFLAC()
{
Mix_SetError("FLAC audio is not supported");
return -1;
}

void Mix_QuitFLAC()
{
}

#endif /* FLAC_MUSIC */
12 changes: 0 additions & 12 deletions dynamic_mod.c
Expand Up @@ -273,16 +273,4 @@ void Mix_QuitMOD()
}
#endif /* MOD_DYNAMIC */

#else

int Mix_InitMOD()
{
Mix_SetError("MOD audio is not supported");
return -1;
}

void Mix_QuitMOD()
{
}

#endif /* MOD_MUSIC */
12 changes: 0 additions & 12 deletions dynamic_mp3.c
Expand Up @@ -177,16 +177,4 @@ void Mix_QuitMP3()
}
#endif /* MP3_DYNAMIC */

#else

int Mix_InitMP3()
{
Mix_SetError("MP3 audio is not supported");
return -1;
}

void Mix_QuitMP3()
{
}

#endif /* MP3_MUSIC */
12 changes: 0 additions & 12 deletions dynamic_ogg.c
Expand Up @@ -125,16 +125,4 @@ void Mix_QuitOgg()
}
#endif /* OGG_DYNAMIC */

#else

int Mix_InitOgg()
{
Mix_SetError("Ogg Vorbis audio is not supported");
return -1;
}

void Mix_QuitOgg()
{
}

#endif /* OGG_MUSIC */
24 changes: 24 additions & 0 deletions mixer.c
Expand Up @@ -145,24 +145,40 @@ int Mix_Init(int flags)
int result = 0;

if ((flags & MIX_INIT_FLAC) && !(initialized & MIX_INIT_FLAC)) {
#ifdef FLAC_MUSIC
if (Mix_InitFLAC() == 0) {
result |= MIX_INIT_FLAC;
}
#else
Mix_SetError("Mixer not built with FLAC support");
#endif
}
if ((flags & MIX_INIT_MOD) && !(initialized & MIX_INIT_MOD)) {
#ifdef MOD_MUSIC
if (Mix_InitMOD() == 0) {
result |= MIX_INIT_MOD;
}
#else
Mix_SetError("Mixer not built with MOD support");
#endif
}
if ((flags & MIX_INIT_MP3) && !(initialized & MIX_INIT_MP3)) {
#ifdef MP3_MUSIC
if (Mix_InitMP3() == 0) {
result |= MIX_INIT_MP3;
}
#else
Mix_SetError("Mixer not built with MP3 support");
#endif
}
if ((flags & MIX_INIT_OGG) && !(initialized & MIX_INIT_OGG)) {
#ifdef OGG_MUSIC
if (Mix_InitOgg() == 0) {
result |= MIX_INIT_OGG;
}
#else
Mix_SetError("Mixer not built with Ogg Vorbis support");
#endif
}
initialized |= result;

Expand All @@ -171,18 +187,26 @@ int Mix_Init(int flags)

void Mix_Quit()
{
#ifdef FLAC_MUSIC
if (initialized & MIX_INIT_FLAC) {
Mix_QuitFLAC();
}
#endif
#ifdef MOD_MUSIC
if (initialized & MIX_INIT_MOD) {
Mix_QuitMOD();
}
#endif
#ifdef MP3_MUSIC
if (initialized & MIX_INIT_MP3) {
Mix_QuitMP3();
}
#endif
#ifdef OGG_MUSIC
if (initialized & MIX_INIT_OGG) {
Mix_QuitOgg();
}
#endif
initialized = 0;
}

Expand Down

0 comments on commit da4949a

Please sign in to comment.