qbool SNDDMA_Init(void) { Cvar_Get ("s_noalsa", "0", CVAR_ARCHIVE); int retval; // Give user the option to force OSS... if( COM_CheckParm("-noalsa") || Cvar_VariableValue("s_noalsa") ) { // User wants us to use OSS... Sys_Printf("sound: Using OSS at user's request...\n"); retval = SNDDMA_Init_OSS(); } else { // Try ALSA first... Sys_Printf("sound: Attempting to initialise ALSA...\n"); retval = SNDDMA_Init_ALSA(); if( retval ) { SNDDMA_ALSA = true; } else { // Fall back to OSS... SNDDMA_ALSA = false; Sys_Printf("sound: Falling back to OSS...\n"); retval = SNDDMA_Init_OSS(); } } snd_inited = retval; return retval; }
// Main functions qbool SNDDMA_Init(void) { int retval; #ifdef __FreeBSD__ Com_Printf("sound: Initializing OSS...\n"); retval = SNDDMA_Init_OSS(); #else // Give user the option to force OSS... if (Cvar_Value("s_noalsa")) { // User wants us to use OSS... SNDDMA_ALSA = false; Com_Printf("sound: Using OSS at user's request...\n"); retval = SNDDMA_Init_OSS(); } else { // Try ALSA first... Com_Printf("sound: Attempting to initialise ALSA...\n"); retval = SNDDMA_Init_ALSA(); if (retval) { SNDDMA_ALSA = true; } else { // Fall back to OSS... SNDDMA_ALSA = false; Com_Printf("sound: Falling back to OSS...\n"); Cvar_Set(&s_device, "/dev/dsp"); retval = SNDDMA_Init_OSS(); } } #endif return retval; }
qboolean SNDDMA_Init(void) { qboolean retval = false; if (snd_inited) return true; if (!snddevice) { sndbits = Cvar_Get("sndbits", "16", CVAR_ARCHIVE|CVAR_LATCHED); sndspeed = Cvar_Get("sndspeed", "0", CVAR_ARCHIVE|CVAR_LATCHED); sndchannels = Cvar_Get("sndchannels", "2", CVAR_ARCHIVE|CVAR_LATCHED); sndalsa = Cvar_Get("sndalsa", "1", CVAR_ARCHIVE|CVAR_LATCHED); snddevice = Cvar_Get("snddevice", "/dev/dsp", CVAR_ARCHIVE|CVAR_LATCHED); } if(sndalsa->integer) { Com_Printf("Attempting to initialise ALSA sound.\n"); retval = SNDDMA_Init_ALSA(); if(retval) { snd_inited = SND_ALSA; } else { Com_Printf("Falling back to OSS sound.\n"); retval = SNDDMA_Init_OSS(); if(retval) snd_inited = SND_OSS; } } else { Com_Printf("Attempting to initialize OSS sound.\n"); retval = SNDDMA_Init_OSS(); if(retval) snd_inited = SND_OSS; } return retval; }