summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2007-06-14 21:45:50 +0000
committerSimon Howard2007-06-14 21:45:50 +0000
commit0480c925192df4f60416f3676ff4a295e2bc9e27 (patch)
tree85e0b6a6834ade2bcf6a1d367831860eb718516e
parent5aa5e1fed5f7245a942bbfee43935d58a990deb5 (diff)
downloadchocolate-doom-0480c925192df4f60416f3676ff4a295e2bc9e27.tar.gz
chocolate-doom-0480c925192df4f60416f3676ff4a295e2bc9e27.tar.bz2
chocolate-doom-0480c925192df4f60416f3676ff4a295e2bc9e27.zip
Add configuration file variable to change the sound sample rate
(snd_samplerate) Subversion-branch: /trunk/chocolate-doom Subversion-revision: 906
-rw-r--r--setup/configfile.c1
-rw-r--r--setup/sound.c2
-rw-r--r--setup/sound.h2
-rw-r--r--src/i_sound.c4
-rw-r--r--src/m_misc.c2
5 files changed, 10 insertions, 1 deletions
diff --git a/setup/configfile.c b/setup/configfile.c
index 96f8bdd3..0a1e9e5f 100644
--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -258,6 +258,7 @@ static default_t extra_defaults_list[] =
{"novert", &novert, DEFAULT_INT, 0, 0},
{"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT, 0, 0},
{"mouse_threshold", &mouse_threshold, DEFAULT_INT, 0, 0},
+ {"snd_samplerate", &snd_samplerate, DEFAULT_INT, 0, 0},
{"show_endoom", &show_endoom, DEFAULT_INT, 0, 0},
{"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0},
{"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0},
diff --git a/setup/sound.c b/setup/sound.c
index 6cc3970d..6b427d58 100644
--- a/setup/sound.c
+++ b/setup/sound.c
@@ -72,6 +72,8 @@ int sfxVolume = 15;
int snd_musicdevice = DEFAULT_MUSIC_DEVICE;
int musicVolume = 15;
+int snd_samplerate = 22050;
+
static int snd_sfxmode;
static int snd_musicenabled;
diff --git a/setup/sound.h b/setup/sound.h
index 8a039f68..5ef0702e 100644
--- a/setup/sound.h
+++ b/setup/sound.h
@@ -29,6 +29,8 @@ extern int sfxVolume;
extern int snd_musicdevice;
extern int musicVolume;
+extern int snd_samplerate;
+
void ConfigSound(void);
#endif /* #ifndef SETUP_SOUND_H */
diff --git a/src/i_sound.c b/src/i_sound.c
index a6e5995f..0eb64980 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -67,6 +67,8 @@ static int mixer_freq;
static Uint16 mixer_format;
static int mixer_channels;
+int snd_samplerate = MIX_DEFAULT_FREQUENCY;
+
// When a sound stops, check if it is still playing. If it is not,
// we can mark the sound data as CACHE to be freed back for other
// means.
@@ -570,7 +572,7 @@ I_InitSound()
return;
}
- if (Mix_OpenAudio(22050, AUDIO_S16SYS, 2, 1024) < 0)
+ if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, 1024) < 0)
{
fprintf(stderr, "Error initialising SDL_mixer: %s\n", Mix_GetError());
return;
diff --git a/src/m_misc.c b/src/m_misc.c
index ee3aae95..2d59675e 100644
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -284,6 +284,7 @@ extern int vanilla_demo_limit;
extern int snd_musicdevice;
extern int snd_sfxdevice;
+extern int snd_samplerate;
// dos specific options: these are unused but should be maintained
// so that the config file can be shared between chocolate
@@ -406,6 +407,7 @@ static default_t extra_defaults_list[] =
{"novert", &novert, DEFAULT_INT, 0, 0},
{"mouse_acceleration", &mouse_acceleration, DEFAULT_FLOAT, 0, 0},
{"mouse_threshold", &mouse_threshold, DEFAULT_INT, 0, 0},
+ {"snd_samplerate", &snd_samplerate, DEFAULT_INT, 0, 0},
{"show_endoom", &show_endoom, DEFAULT_INT, 0, 0},
{"vanilla_savegame_limit", &vanilla_savegame_limit, DEFAULT_INT, 0, 0},
{"vanilla_demo_limit", &vanilla_demo_limit, DEFAULT_INT, 0, 0},