Skip to content

Commit

Permalink
fixup pandora compilation with SDL < 1.2.12
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cbeck88 committed Oct 26, 2014
1 parent cef5e2e commit 5f0cfd8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/sound.cpp
Expand Up @@ -501,8 +501,14 @@ static void play_new_music()
std::map<std::string,Mix_Music*>::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";
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 5f0cfd8

Please sign in to comment.