Skip to content

Commit

Permalink
Wii: Fix libsndfile audio
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Jul 12, 2016
1 parent 0dd2171 commit 57cf41b
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/audio_sdl.cpp
Expand Up @@ -108,9 +108,18 @@ namespace {
case AudioDecoder::Format::S8:
return AUDIO_S8;
case AudioDecoder::Format::U16:
#ifdef WORDS_BIGENDIAN
return AUDIO_U16MSB;
#else
return AUDIO_U16;
#endif
case AudioDecoder::Format::S16:
#ifdef WORDS_BIGENDIAN
return AUDIO_S16MSB;
#else
return AUDIO_S16;
#endif

#if SDL_MIXER_MAJOR_VERSION>1
case AudioDecoder::Format::S32:
return AUDIO_S32;
Expand All @@ -130,9 +139,17 @@ namespace {
return AudioDecoder::Format::U8;
case AUDIO_S8:
return AudioDecoder::Format::S8;
#ifdef WORDS_BIGENDIAN
case AUDIO_U16MSB:
#else
case AUDIO_U16:
#endif
return AudioDecoder::Format::U16;
#ifdef WORDS_BIGENDIAN
case AUDIO_S16MSB:
#else
case AUDIO_S16:
#endif
return AudioDecoder::Format::S16;
#if SDL_MIXER_MAJOR_VERSION>1
case AUDIO_S32:
Expand Down Expand Up @@ -180,7 +197,13 @@ SdlAudio::SdlAudio() :
if (Mix_OpenAudioDevice(frequency, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 2048,
NULL, SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) < 0)
#else
if (Mix_OpenAudio(frequency, MIX_DEFAULT_FORMAT, MIX_DEFAULT_CHANNELS, 2048) < 0)
# ifdef WORDS_BIGENDIAN
int format = AUDIO_S16MSB;
# else
int format = MIX_DEFAULT_FORMAT;
# endif

if (Mix_OpenAudio(frequency, format, MIX_DEFAULT_CHANNELS, 2048) < 0)
#endif
Output::Error("Couldn't initialize audio mixer.\n%s", Mix_GetError());

Expand Down

0 comments on commit 57cf41b

Please sign in to comment.