From 5bd7a09d9f8afc06d99cfd5c5e908daba4d39ddb Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 1 Dec 2025 02:10:31 +0100 Subject: [PATCH] force 44100khz sample rate sounds better to me honestly --- src/sdl/sdl_sound.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index c7339bc82..ef7c131bb 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -464,18 +464,25 @@ void I_StartupSound(void) return; } - audio_device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, NULL); + // supposedly you would be able to get this with SDL_GetAudioDeviceFormat before opening the audio device + // but that doesent work for some strange reason + // assume 16bit, stereo device and force 44.1khz since it sounds the best to me + actual_spec.format = SDL_AUDIO_S16; + actual_spec.channels = 2; + actual_spec.freq = 44100; + + audio_device = SDL_OpenAudioDevice(SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK, &actual_spec); if (audio_device == 0) { CONS_Alert(CONS_ERROR, "Error opening audio device: %s\n", SDL_GetError()); return; } - if (!SDL_GetAudioDeviceFormat(audio_device, &actual_spec, NULL)) - { - CONS_Alert(CONS_ERROR, "Error retrieving audio format: %s\n", SDL_GetError()); - return; - } + /*if (!SDL_GetAudioDeviceFormat(audio_device, &actual_spec, NULL)) + { * + CONS_Alert(CONS_ERROR, "Error retrieving audio format: %s\n", SDL_GetError()); + return; + }*/ audio_stream = SDL_OpenAudioDeviceStream(audio_device, &actual_spec, StreamCallback, NULL); if (audio_stream == NULL)