fixed audio on big endian systems

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2051 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2008-05-25 18:00:16 +00:00
parent a91079c6f6
commit 182a40b8e0

View File

@ -30,6 +30,7 @@
#endif
#include <SDL/SDL.h>
#include <SDL/SDL_endian.h>
#include "sfx_openal.hpp"
#include "file_manager.hpp"
@ -101,6 +102,17 @@ bool SFXImpl::load(const char* filename)
case AUDIO_S16MSB:
if( spec.channels == 2 ) format = AL_FORMAT_STEREO16;
else format = AL_FORMAT_MONO16;
#ifdef WORDS_BIGENDIAN
// swap bytes around for big-endian systems
for(unsigned int n=0; n<size-1; n+=2)
{
Uint8 temp = data[n+1];
data[n+1] = data[n];
data[n] = temp;
}
#endif
break;
}