Fix Vorbisfile on big-endian archs

This commit is contained in:
Glenn Maynard
2003-09-13 20:25:59 +00:00
parent 13da8dffcb
commit a8bb248ed2
@@ -4,6 +4,7 @@
#include "RageUtil.h"
#include "SDL_utils.h"
#include "SDL_endian.h"
#include "RageSoundReader_Vorbisfile.h"
#include "RageLog.h"
@@ -183,6 +184,13 @@ int RageSoundReader_Vorbisfile::Read(char *buf, unsigned len)
bytes_read += size;
}
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
/* I can't imagine why, but Vorbisfile returns data in little endian, not system-endian. */
Sint16 *sbuf = (Sint16 *) buf;
for( int i = 0; i < bytes_read/2; ++i )
sbuf[i] = SDL_Swap16(sbuf[i]);
#endif
return bytes_read;
}