From 5f0cfd860309a5d1e3a5c2b5ba44ce42c970ed6c Mon Sep 17 00:00:00 2001 From: Chris Beck Date: Sat, 25 Oct 2014 19:34:24 -0400 Subject: [PATCH] fixup pandora compilation with SDL < 1.2.12 This was checked to compile (but not link of course) on my system, using cmake with pandora enabled, and pointed to the SDL_mixer 1.2.0 header. --- src/sound.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/sound.cpp b/src/sound.cpp index fd3428341078..8e85bbccda77 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -501,8 +501,14 @@ static void play_new_music() std::map::const_iterator itor = music_cache.find(filename); if(itor == music_cache.end()) { LOG_AUDIO << "attempting to insert track '" << filename << "' into cache\n"; + +#ifndef PANDORA SDL_RWops *rwops = filesystem::load_RWops(filename); Mix_Music* const music = Mix_LoadMUSType_RW(rwops, MUS_NONE, true); // SDL takes ownership of rwops +#else + Mix_Music* const music = Mix_LoadMUS(filename.c_str()); +#endif + if(music == NULL) { ERR_AUDIO << "Could not load music file '" << filename << "': " << Mix_GetError() << "\n"; @@ -724,8 +730,12 @@ static Mix_Chunk* load_chunk(const std::string& file, channel_group group) std::string const &filename = filesystem::get_binary_file_location("sounds", file); if (!filename.empty()) { +#ifndef PANDORA SDL_RWops *rwops = filesystem::load_RWops(filename); temp_chunk.set_data(Mix_LoadWAV_RW(rwops, true)); // SDL takes ownership of rwops +#else + temp_chunk.set_data(Mix_LoadWAV(filename.c_str())); +#endif } else { ERR_AUDIO << "Could not load sound file '" << file << "'." << std::endl; throw chunk_load_exception();