]> git.jsancho.org Git - lugaru.git/blobdiff - Source/openal_wrapper.cpp
Fixed audio playback on PowerPC systems.
[lugaru.git] / Source / openal_wrapper.cpp
index 379b5b2db920dd559259e000c239725fb279e44c..be2a72a409c8907189c3f72508f43dc75af230c6 100644 (file)
@@ -298,6 +298,12 @@ int F_API OPENAL_PlaySoundEx(int channel, FSOUND_SAMPLE *sptr, FSOUND_DSPUNIT *d
 
 static void *decode_to_pcm(const char *_fname, ALenum &format, ALsizei &size, ALuint &freq)
 {
+#ifdef __POWERPC__
+    const int bigendian = 1;
+#else
+    const int bigendian = 0;
+#endif
+
     // !!! FIXME: if it's not Ogg, we don't have a decoder. I'm lazy.  :/
     char *fname = (char *) alloca(strlen(_fname) + 16);
     strcpy(fname, _fname);
@@ -313,6 +319,7 @@ static void *decode_to_pcm(const char *_fname, ALenum &format, ALsizei &size, AL
 
     ALubyte *retval = NULL;
 
+    #if 0  // untested, so disable this!
     // Can we just feed it to the AL compressed?
     if (alIsExtensionPresent((const ALubyte *) "AL_EXT_vorbis"))
     {
@@ -331,6 +338,7 @@ static void *decode_to_pcm(const char *_fname, ALenum &format, ALsizei &size, AL
         }
         return retval;
     }
+    #endif
 
     // Uncompress and feed to the AL.
     OggVorbis_File vf;
@@ -353,7 +361,7 @@ static void *decode_to_pcm(const char *_fname, ALenum &format, ALsizei &size, AL
         long rc = 0;
         size_t allocated = 64 * 1024;
         retval = (ALubyte *) malloc(allocated);
-        while ( (rc = ov_read(&vf, buf, sizeof (buf), 0, 2, 1, &bitstream)) != 0 )
+        while ( (rc = ov_read(&vf, buf, sizeof (buf), bigendian, 2, 1, &bitstream)) != 0 )
         {
             if (rc > 0)
             {