diff options
author | Simon Howard | 2009-11-19 21:49:13 +0000 |
---|---|---|
committer | Simon Howard | 2009-11-19 21:49:13 +0000 |
commit | 43b0dbd272da1d590797d2974e94413971131129 (patch) | |
tree | a4deab2b5fe6a50d66966a792a103563a4464103 /src | |
parent | e62fdd771f01ef7b50fe3cb8f456eae5d7db3748 (diff) | |
download | chocolate-doom-43b0dbd272da1d590797d2974e94413971131129.tar.gz chocolate-doom-43b0dbd272da1d590797d2974e94413971131129.tar.bz2 chocolate-doom-43b0dbd272da1d590797d2974e94413971131129.zip |
Rework the OS X MIDI disabling code, as SDL_mixer 1.2.11 fixes the
crash. Check and disable MIDI by default if using an older version of
SDL on OS X.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1730
Diffstat (limited to 'src')
-rw-r--r-- | src/i_sdlmusic.c | 32 | ||||
-rw-r--r-- | src/m_config.c | 19 | ||||
-rw-r--r-- | src/s_sound.c | 10 |
3 files changed, 41 insertions, 20 deletions
diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c index 81f492b5..7f9bd8ec 100644 --- a/src/i_sdlmusic.c +++ b/src/i_sdlmusic.c @@ -81,18 +81,28 @@ static boolean SDLIsInitialized(void) // Initialize music subsystem static boolean I_SDL_InitMusic(void) -{ - // When trying to run with music enabled on OSX, display - // a warning message. - -#ifdef __APPLE__ - printf("\n" - " *** WARNING ***\n" - " Music playback on OSX may cause crashes and\n" - " is disabled by default.\n" - "\n"); +{ + // SDL_mixer prior to v1.2.11 has a bug that causes crashes + // with MIDI playback. Print a warning message if we are + // using an old version. + +#ifdef __MACOSX__ + { + const SDL_version *v = Mix_Linked_Version(); + + if (SDL_VERSIONNUM(v->major, v->minor, v->patch) + < SDL_VERSIONNUM(1, 2, 11)) + { + printf("\n" + " *** WARNING ***\n" + " You are using an old version of SDL_mixer.\n" + " Music playback on this version may cause crashes\n" + " under OS X and is disabled by default.\n" + "\n"); + } + } #endif - + // If SDL_mixer is not initialized, we have to initialize it // and have the responsibility to shut it down later on. diff --git a/src/m_config.c b/src/m_config.c index 4f789845..73f0da2c 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -36,6 +36,8 @@ #include <windows.h> #endif +#include "SDL_mixer.h" + #include "config.h" #include "deh_main.h" #include "doomdef.h" @@ -53,6 +55,7 @@ #include "i_swap.h" #include "i_system.h" #include "i_video.h" +#include "s_sound.h" #include "v_video.h" #include "hu_stuff.h" @@ -1456,5 +1459,21 @@ void M_ApplyPlatformDefaults(void) #ifdef _WIN32_WCE M_ApplyWindowsCEDefaults(); #endif + + // Before SDL_mixer version 1.2.11, MIDI music caused the game + // to crash when it looped. If this is an old SDL_mixer version, + // disable MIDI. + +#ifdef __MACOSX__ + { + const SDL_version *v = Mix_Linked_Version(); + + if (SDL_VERSIONNUM(v->major, v->minor, v->patch) + < SDL_VERSIONNUM(1, 2, 11)) + { + snd_musicdevice = SNDDEVICE_NONE; + } + } +#endif } diff --git a/src/s_sound.c b/src/s_sound.c index 9b4f71aa..1c56efb2 100644 --- a/src/s_sound.c +++ b/src/s_sound.c @@ -69,14 +69,6 @@ #define NORM_PRIORITY 64 #define NORM_SEP 128 -// Disable music on OSX by default; there are problems with SDL_mixer. - -#ifndef __APPLE__ -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB -#else -#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE -#endif - typedef struct { // sound information (if null, channel avail.) @@ -128,7 +120,7 @@ static musicinfo_t *mus_playing = NULL; int numChannels = 8; -int snd_musicdevice = DEFAULT_MUSIC_DEVICE; +int snd_musicdevice = SNDDEVICE_SB; int snd_sfxdevice = SNDDEVICE_SB; // Sound modules |