Skip to content

Commit

Permalink
- Remove alext.h dependency and manually add the required macros
Browse files Browse the repository at this point in the history
- Use ALC_DEFAULT_ALL_DEVICES_SPECIFIER instead of ALC_DEFAULT_DEVICE_SPECIFIER if extension exists
  • Loading branch information
Thilo Schulz committed Mar 14, 2011
1 parent 1b27ae2 commit 182b344
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion code/client/qal.h
Expand Up @@ -44,10 +44,16 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#else
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.h>
#endif
#endif

/* Hack to enable compiling both on OpenAL SDK and OpenAL-soft. */
#ifndef ALC_ENUMERATE_ALL_EXT
# define ALC_ENUMERATE_ALL_EXT 1
# define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
# define ALC_ALL_DEVICES_SPECIFIER 0x1013
#endif

#ifdef USE_OPENAL_DLOPEN
extern LPALENABLE qalEnable;
extern LPALDISABLE qalDisable;
Expand Down
6 changes: 4 additions & 2 deletions code/client/snd_openal.c
Expand Up @@ -2397,16 +2397,18 @@ qboolean S_AL_Init( soundInterface_t *si )

// get all available devices + the default device name.
if(enumeration_ext)
{
devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
defaultdevice = qalcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
}
else
{
// We don't have ALC_ENUMERATE_ALL_EXT but normal enumeration.
devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER);
defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
enumeration_ext = qtrue;
}

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.
Expand Down

0 comments on commit 182b344

Please sign in to comment.