- I accidentally committed patch by slacker from (#4915) in r1916. Patch adds input device selection support

- Add check for ALC_ENUMERATE_ALL_EXT before using ALC_ALL_DEVICES_SPECIFIER in device enumeration
- Patch readme for new cvars by Zack Middleton
This commit is contained in:
Thilo Schulz 2011-03-09 12:59:25 +00:00
parent 37727b892c
commit 7ca1dc6f8b
2 changed files with 18 additions and 4 deletions

2
README
View file

@ -132,6 +132,8 @@ New cvars
s_alDriver - which OpenAL library to use
s_alDevice - which OpenAL device to use
s_alAvailableDevices - list of available OpenAL devices
s_alInputDevice - which OpenAL input device to use
s_alAvailableInputDevices - list of available OpenAL input devices
s_sdlBits - SDL bit resolution
s_sdlSpeed - SDL sample rate
s_sdlChannels - SDL number of channels

View file

@ -45,6 +45,8 @@ cvar_t *s_alInputDevice;
cvar_t *s_alAvailableDevices;
cvar_t *s_alAvailableInputDevices;
static enumeration_ext = qfalse;
/*
=================
S_AL_Format
@ -2278,7 +2280,7 @@ void S_AL_SoundInfo( void )
Com_Printf( " Renderer: %s\n", qalGetString( AL_RENDERER ) );
Com_Printf( " AL Extensions: %s\n", qalGetString( AL_EXTENSIONS ) );
Com_Printf( " ALC Extensions: %s\n", qalcGetString( alDevice, ALC_EXTENSIONS ) );
if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
if(enumeration_ext)
{
Com_Printf(" Device: %s\n", qalcGetString(alDevice, ALC_DEVICE_SPECIFIER));
Com_Printf("Available Devices:\n%s", s_alAvailableDevices->string);
@ -2383,8 +2385,10 @@ qboolean S_AL_Init( soundInterface_t *si )
if(inputdevice && !*inputdevice)
inputdevice = NULL;
// Device enumeration support (extension is implemented reasonably only on Windows right now).
if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT"))
// Device enumeration support
if(qalcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT") ||
(enumeration_ext = qalcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT"))
)
{
char devicenames[1024] = "";
const char *devicelist;
@ -2392,7 +2396,15 @@ qboolean S_AL_Init( soundInterface_t *si )
int curlen;
// get all available devices + the default device name.
devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
if(enumeration_ext)
devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
else
{
// We don't have ALC_ENUMERATE_ALL_EXT but normal enumeration.
devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER);
enumeration_ext = qtrue;
}
defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
#ifdef _WIN32