From b2b17e334ef2f14f181feece76acaec904db5fe8 Mon Sep 17 00:00:00 2001 From: Thilo Schulz Date: Sat, 19 Aug 2006 13:44:10 +0000 Subject: [PATCH] - tweak enumeration support, remove win32 dependency - fix two typos in status message in snd_main.c --- code/client/snd_main.c | 4 ++-- code/client/snd_openal.c | 21 ++++----------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/code/client/snd_main.c b/code/client/snd_main.c index 2e739da9..ea6bbeb0 100644 --- a/code/client/snd_main.c +++ b/code/client/snd_main.c @@ -404,9 +404,9 @@ void S_Init( void ) } S_SoundInfo( ); - Com_Printf( "Sound intialization successful.\n" ); + Com_Printf( "Sound initialization successful.\n" ); } else { - Com_Printf( "Sound intialization failed.\n" ); + Com_Printf( "Sound initialization failed.\n" ); } } diff --git a/code/client/snd_openal.c b/code/client/snd_openal.c index fc7a31aa..54f446d9 100644 --- a/code/client/snd_openal.c +++ b/code/client/snd_openal.c @@ -38,10 +38,8 @@ cvar_t *s_alDopplerSpeed; cvar_t *s_alMinDistance; cvar_t *s_alRolloff; cvar_t *s_alDriver; -#ifdef _WIN32 cvar_t *s_alDevice; cvar_t *s_alAvailableDevices; -#endif cvar_t *s_alMaxSpeakerDistance; /* @@ -1677,10 +1675,8 @@ void S_AL_SoundInfo( void ) Com_Printf( " Vendor: %s\n", qalGetString( AL_VENDOR ) ); Com_Printf( " Version: %s\n", qalGetString( AL_VERSION ) ); Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) ); -#ifdef _WIN32 if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) Com_Printf( " Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER) ); -#endif Com_Printf( " Extensions: %s\n", qalGetString( AL_EXTENSIONS ) ); } @@ -1723,9 +1719,7 @@ qboolean S_AL_Init( soundInterface_t *si ) { #if USE_OPENAL -#ifdef _WIN32 qboolean enumsupport, founddev = qfalse; -#endif if( !si ) { return qfalse; @@ -1750,11 +1744,10 @@ qboolean S_AL_Init( soundInterface_t *si ) return qfalse; } -#ifdef _WIN32 - // Device enumeration support on windows. + // Device enumeration support (extension currently only exists for windows). if((enumsupport = qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))) { - char *devicelist, devicenames[8192] = ""; + char *devicelist, devicenames[1024] = ""; char *defaultdevice; int curlen; qboolean hasbegun = qfalse; @@ -1763,6 +1756,7 @@ qboolean S_AL_Init( soundInterface_t *si ) devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER); defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); +#ifdef _WIN32 // check whether the default device is generic hardware. If it is, change to // Generic Software as that one works more reliably with various sound systems. // If it's not, use OpenAL's default selection as we don't want to ignore @@ -1770,6 +1764,7 @@ qboolean S_AL_Init( soundInterface_t *si ) if(!strcmp(defaultdevice, "Generic Hardware")) s_alDevice = Cvar_Get("s_alDevice", ALDEVICE_DEFAULT, CVAR_ARCHIVE | CVAR_LATCH); else +#endif s_alDevice = Cvar_Get("s_alDevice", defaultdevice, CVAR_ARCHIVE | CVAR_LATCH); // dump a list of available devices to a cvar for the user to see. @@ -1785,7 +1780,6 @@ qboolean S_AL_Init( soundInterface_t *si ) if(!strcmp(s_alDevice->string, devicelist)) founddev = qtrue; - s_alDevice->string; devicelist += curlen + 1; } @@ -1802,11 +1796,6 @@ qboolean S_AL_Init( soundInterface_t *si ) alDevice = qalcOpenDevice(s_alDevice->string); else alDevice = qalcOpenDevice(NULL); -#else // _WIN32 - - // Open default device - alDevice = qalcOpenDevice( NULL ); -#endif if( !alDevice ) { @@ -1815,10 +1804,8 @@ qboolean S_AL_Init( soundInterface_t *si ) return qfalse; } -#ifdef _WIN32 if(enumsupport) Cvar_Set("s_alDevice", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER)); -#endif // Create OpenAL context alContext = qalcCreateContext( alDevice, NULL );