diff options
author | Simon Howard | 2009-05-07 21:59:38 +0000 |
---|---|---|
committer | Simon Howard | 2009-05-07 21:59:38 +0000 |
commit | cc93c797921f08d48ac8dfc64fefcf7725a84517 (patch) | |
tree | e7cc9351488dff129417e3cc50444bfec9ffaecc /src | |
parent | 5859134e1c81d15e49cab4c1971ed2bce5781845 (diff) | |
download | chocolate-doom-cc93c797921f08d48ac8dfc64fefcf7725a84517.tar.gz chocolate-doom-cc93c797921f08d48ac8dfc64fefcf7725a84517.tar.bz2 chocolate-doom-cc93c797921f08d48ac8dfc64fefcf7725a84517.zip |
Calculate SDL buffer size automatically based on sample rate.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1511
Diffstat (limited to 'src')
-rw-r--r-- | src/i_sdlsound.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c index f3af667e..34adf9de 100644 --- a/src/i_sdlsound.c +++ b/src/i_sdlsound.c @@ -49,6 +49,7 @@ #include "doomdef.h" #define LOW_PASS_FILTER +#define SOUND_SLICE_TIME 100 /* ms */ #define NUM_CHANNELS 16 static boolean sound_initialised = false; @@ -666,10 +667,10 @@ static void I_SDL_ShutdownSound(void) sound_initialised = false; } - static boolean I_SDL_InitSound(void) { int i; + int slicesize; // No sounds yet @@ -689,7 +690,9 @@ static boolean I_SDL_InitSound(void) return false; } - if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, 1024) < 0) + slicesize = (snd_samplerate * SOUND_SLICE_TIME) / 1000; + + if (Mix_OpenAudio(snd_samplerate, AUDIO_S16SYS, 2, slicesize) < 0) { fprintf(stderr, "Error initialising SDL_mixer: %s\n", Mix_GetError()); return false; |