From 6f34ea985bc389605b9e03645ab258259ba49c81 Mon Sep 17 00:00:00 2001 From: wyatt8740 Date: Tue, 19 Jan 2021 14:40:32 -0500 Subject: SDL2 audio backend, retrofitted from quakespasm (Music still requires either a CD drive with analogue audio playback or CD drive emulator software like cdemu, but SFX no longer require OSS DMA for playback and Quake no longer inherently prevents other software from making sound while running) --- WinQuake/snd_dma.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'WinQuake/snd_dma.c') diff --git a/WinQuake/snd_dma.c b/WinQuake/snd_dma.c index accb617..adb5504 100644 --- a/WinQuake/snd_dma.c +++ b/WinQuake/snd_dma.c @@ -74,6 +74,11 @@ cvar_t volume = {"volume", "0.7", true}; cvar_t nosound = {"nosound", "0"}; cvar_t precache = {"precache", "1"}; cvar_t loadas8bit = {"loadas8bit", "0"}; +/* for sdl */ +#if defined(USE_SDL2) +cvar_t sndspeed = {"sndspeed", "11025", CVAR_NONE}; +cvar_t snd_mixspeed = {"snd_mixspeed", "44100", CVAR_NONE}; +#endif cvar_t bgmbuffer = {"bgmbuffer", "4096"}; cvar_t ambient_level = {"ambient_level", "0.3"}; cvar_t ambient_fade = {"ambient_fade", "100"}; @@ -143,8 +148,14 @@ void S_Startup (void) if (!fakedma) { +#if defined(USE_SDL2) + /* Since I borrowed a lot of the SDL2 code from Quakespasm, I + found this to be the easiest way to retrofit it: */ + rc = SNDDMA_Init(&sn); +#else + /* in the original code from Id, no argument is used here: */ rc = SNDDMA_Init(); - +#endif if (!rc) { #ifndef _WIN32 -- cgit v1.2.3