change preprocessor symbols controlling SDL MIXER min version

Previously, the code that requires SDL_mixer v 1.2.12 was guarded
by #ifdef PANDORA, since this was the only platform intended to
use this. However, it turns out that OS X < 10.5 has a hard time
getting this library as well.

Instead of branching by platform, here we just check the version
defind by the SDL_mixer header, and include the code appropriate.

We rely on the scons / cmake / project file to fail any build which
should be done with the recent version.
This commit is contained in:
Chris Beck 2014-10-30 23:11:43 -04:00
parent 673f609558
commit 264dc08e91

View file

@ -34,6 +34,11 @@ static lg::log_domain log_audio("audio");
#define LOG_AUDIO LOG_STREAM(info, log_audio)
#define ERR_AUDIO LOG_STREAM(err, log_audio)
#if (MIX_MAJOR_VERSION < 1) || (MIX_MAJOR_VERSION == 1) && ((MIX_MINOR_VERSION < 2) || (MIX_MINOR_VERSION == 2) && (MIX_PATCHLEVEL <= 11))
#define SDL_MIXER_OLD_VERSION
#endif
namespace sound {
// Channel-chunk mapping lets us know, if we can safely free a given chunk
std::vector<Mix_Chunk*> channel_chunks;
@ -490,7 +495,7 @@ static void play_new_music()
if(itor == music_cache.end()) {
LOG_AUDIO << "attempting to insert track '" << filename << "' into cache\n";
#ifndef PANDORA
#ifndef SDL_MIXER_OLD_VERSION
SDL_RWops *rwops = filesystem::load_RWops(filename);
Mix_Music* const music = Mix_LoadMUSType_RW(rwops, MUS_NONE, true); // SDL takes ownership of rwops
#else
@ -718,7 +723,7 @@ 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
#ifndef SDL_MIXER_OLD_VERSION
SDL_RWops *rwops = filesystem::load_RWops(filename);
temp_chunk.set_data(Mix_LoadWAV_RW(rwops, true)); // SDL takes ownership of rwops
#else