diff --git a/src/audio/music_ogg.cpp b/src/audio/music_ogg.cpp index 09143267a..81a499e22 100644 --- a/src/audio/music_ogg.cpp +++ b/src/audio/music_ogg.cpp @@ -33,7 +33,7 @@ MusicOggStream::MusicOggStream() { //m_oggStream= NULL; - m_soundBuffers[0]= m_soundBuffers[1]= 0; + m_soundBuffers[0] = m_soundBuffers[1]= 0; m_soundSource= 0; m_pausedMusic= true; } // MusicOggStream diff --git a/src/audio/sfx_manager.cpp b/src/audio/sfx_manager.cpp index e9eab02f7..c485aa0a2 100644 --- a/src/audio/sfx_manager.cpp +++ b/src/audio/sfx_manager.cpp @@ -140,11 +140,15 @@ void SFXManager::loadSfx() } // loadSfx //---------------------------------------------------------------------------- -#if defined(WORDS_BIGENDIAN) -#define OGG_ENDIAN 1 -#else -#define OGG_ENDIAN 0 -#endif +// the ogg loader needs to know about endianness so do a simple test. +// 0 : little endian +// 1 : big endian +// I'm doing it at runtime rather than at compile-time to be friendly with +// cross-compilation (universal binaries on mac, namely) +static const int endianness_test = 0x01000000; +static const char* endianness_test_ptr = (const char*)&endianness_test; +// in little-endian, byte 0 will be 0. in big endian, byte 0 will be 1 +static const int ogg_endianness = endianness_test_ptr[0]; // Load a vorbis file into an OpenAL buffer // based on a routine by Peter Mulholland, used with permission (quote : "Feel free to use") @@ -181,7 +185,7 @@ bool loadVorbisBuffer(const char *name, ALuint buffer) while (todo) { - int read = ov_read(&oggFile, bufpt, todo, OGG_ENDIAN, 2, 1, &bs); + int read = ov_read(&oggFile, bufpt, todo, ogg_endianness, 2, 1, &bs); todo -= read; bufpt += read; } diff --git a/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj b/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj index 467d7cc40..a17c1b976 100644 --- a/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj +++ b/src/ide/Xcode/STK_XCode.xcodeproj/project.pbxproj @@ -2035,7 +2035,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# copy data files\n\necho \"Copying Data Files\"\n\nif [ \"${CONFIGURATION}\" = \"Release\" ]\nthen\n\nmkdir -p ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/data\ncp -rf ${PROJECT_DIR}/../../../data ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/\nfind ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/. -name \".svn\" -exec rm -rf '{}' > /dev/null \\; 2> /dev/null\n\nfi"; + shellScript = "# copy data files\n\necho \"Copying Data Files\"\n\nif [ \"${CONFIGURATION}\" = \"Release\" ]\nthen\n\nmkdir -p ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/data\ncp -rf ${PROJECT_DIR}/../../../data ${CONFIGURATION_BUILD_DIR}/${CONTENTS_FOLDER_PATH}/Resources/\n\nfi"; }; /* End PBXShellScriptBuildPhase section */