Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8122 in orxonox.OLD for branches/osx/src/lib/sound/sound_buffer.cc


Ignore:
Timestamp:
Jun 2, 2006, 5:46:11 PM (18 years ago)
Author:
ponder
Message:

Md2loader seems to work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/osx/src/lib/sound/sound_buffer.cc

    r7460 r8122  
    2222#include "sdlincl.h"
    2323#include <cassert>
    24 
     24#ifdef HAVE_SDL_SDL_H
     25#include <SDL/SDL.h>
     26#include <SDL/SDL_endian.h>
     27#else
     28#include <SDL.h>
     29#include <SDL_endian.h>
     30#endif
    2531namespace OrxSound
    2632{
     
    6773      return false;
    6874    }
    69 
    70     alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec), wavBuffer, wavLength, wavSpec.freq);
     75#ifdef SDL_BIG_ENDIAN
     76                if ( !( wavSpec.format == AUDIO_U8 || wavSpec.format == AUDIO_S8 ) ) {
     77                        int cnt = wavLength/2;
     78                        Uint16* wavBufferAsShorts = ( Uint16* )wavBuffer;
     79                        for ( int i = 0; i < cnt; ++i, ++wavBufferAsShorts )
     80                                *wavBufferAsShorts = SDL_Swap16( *wavBufferAsShorts );
     81                }
     82#endif
     83    alBufferData(this->bufferID, SoundBuffer::sdlAudioSpecToAlFormat(&wavSpec),
     84                        wavBuffer, wavLength, wavSpec.freq);
     85                       
    7186    SDL_FreeWAV(wavBuffer);
    7287    if (SoundEngine::checkError("Could not load Wave file", __LINE__))
Note: See TracChangeset for help on using the changeset viewer.