summaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorSimon Howard2009-11-19 21:49:13 +0000
committerSimon Howard2009-11-19 21:49:13 +0000
commit43b0dbd272da1d590797d2974e94413971131129 (patch)
treea4deab2b5fe6a50d66966a792a103563a4464103 /setup
parente62fdd771f01ef7b50fe3cb8f456eae5d7db3748 (diff)
downloadchocolate-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 'setup')
-rw-r--r--setup/Makefile.am3
-rw-r--r--setup/configfile.c18
-rw-r--r--setup/sound.c25
-rw-r--r--setup/sound.h14
4 files changed, 35 insertions, 25 deletions
diff --git a/setup/Makefile.am b/setup/Makefile.am
index af80d525..92b4e394 100644
--- a/setup/Makefile.am
+++ b/setup/Makefile.am
@@ -1,7 +1,7 @@
gamesdir = $(prefix)/games
-AM_CFLAGS = -I../textscreen -I../src
+AM_CFLAGS = -I../textscreen -I../src @SDLMIXER_CFLAGS@
games_PROGRAMS = chocolate-setup
@@ -34,6 +34,7 @@ endif
chocolate_setup_LDADD = \
../wince/libc_wince.a \
../textscreen/libtextscreen.a \
+ @SDLMIXER_LIBS@ \
@LDFLAGS@
.rc.o:
diff --git a/setup/configfile.c b/setup/configfile.c
index fe3c13de..6d57a107 100644
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -42,6 +42,8 @@
#include <sys/types.h>
#endif
+#include "SDL_mixer.h"
+
#include "config.h"
#include "doomfeatures.h"
@@ -721,5 +723,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/setup/sound.c b/setup/sound.c
index 72414c83..9e02aeec 100644
--- a/setup/sound.c
+++ b/setup/sound.c
@@ -27,20 +27,6 @@
#include "sound.h"
-enum
-{
- SNDDEVICE_NONE = 0,
- SNDDEVICE_PCSPEAKER = 1,
- SNDDEVICE_ADLIB = 2,
- SNDDEVICE_SB = 3,
- SNDDEVICE_PAS = 4,
- SNDDEVICE_GUS = 5,
- SNDDEVICE_WAVEBLASTER = 6,
- SNDDEVICE_SOUNDCANVAS = 7,
- SNDDEVICE_GENMIDI = 8,
- SNDDEVICE_AWE32 = 9,
-};
-
typedef enum
{
SFXMODE_DISABLED,
@@ -56,20 +42,11 @@ static char *sfxmode_strings[] =
"Digital",
};
-// Disable MIDI music on OSX: there are problems with the native
-// MIDI code in SDL_mixer.
-
-#ifdef __MACOSX__
-#define DEFAULT_MUSIC_DEVICE SNDDEVICE_NONE
-#else
-#define DEFAULT_MUSIC_DEVICE SNDDEVICE_SB
-#endif
-
int snd_sfxdevice = SNDDEVICE_SB;
int numChannels = 8;
int sfxVolume = 15;
-int snd_musicdevice = DEFAULT_MUSIC_DEVICE;
+int snd_musicdevice = SNDDEVICE_SB;
int musicVolume = 15;
int snd_samplerate = 22050;
diff --git a/setup/sound.h b/setup/sound.h
index 170dda0a..6c366151 100644
--- a/setup/sound.h
+++ b/setup/sound.h
@@ -22,6 +22,20 @@
#ifndef SETUP_SOUND_H
#define SETUP_SOUND_H
+enum
+{
+ SNDDEVICE_NONE = 0,
+ SNDDEVICE_PCSPEAKER = 1,
+ SNDDEVICE_ADLIB = 2,
+ SNDDEVICE_SB = 3,
+ SNDDEVICE_PAS = 4,
+ SNDDEVICE_GUS = 5,
+ SNDDEVICE_WAVEBLASTER = 6,
+ SNDDEVICE_SOUNDCANVAS = 7,
+ SNDDEVICE_GENMIDI = 8,
+ SNDDEVICE_AWE32 = 9,
+};
+
extern int snd_sfxdevice;
extern int numChannels;
extern int sfxVolume;