OpenAL and Vista: Device is always 'Generic Software'
audio, c++, drivers, hardware, openal
Solution
OpenAL should always return the default audio device, unless you are using a Creative audio card. The extensions are all Creative-specific. It's the same as expecting to get Intel-specific OpenGL extension on an NVIDIA videocard.
For the record, here's how you set up OpenAL:
// create a default device
ALCdevice* device = alcOpenDevice("");
if (!device)
{
LOG_ERROR("Could not create OpenAL device.");
return false;
}
// context attributes, 2 zeros to terminate
ALint attribs[6] = {
0, 0
};
ALCcontext* context = alcCreateContext(device, attribs);
if (!context)
{
LOG_ERROR("Could not create OpenAL context.");
alcCloseDevice(device);
return false;
}
if (!alcMakeContextCurrent(context))
{
LOG_ERROR("Could not enable OpenAL context.");
alcDestroyContext(context);
alcCloseDevice(device);
return false;
}
LOG_INFO("[OpenAL] Version: %s", alGetString(AL_VERSION));
LOG_INFO("[OpenAL] Vendor: %s", alGetString(AL_VENDOR));
LOG_INFO("[OpenAL] Renderer: %s", alGetString(AL_RENDERER));
Problem
I'm writing the audio part of a game, and I'm using OpenAL. I want to use some extensions, but the tests always fail: ``` TRACE: AudioManager - Sound device: 'Generic Software' TRACE: AudioManager - Enabling OpenAL extensions... TRACE: AudioManager - Compressor support: NO TRACE: AudioManager - Reverb support: YES TRACE: AudioManager - Chorus support: NO TRACE: AudioManager - Distortion support: NO TRACE: AudioManager - Echo support: NO TRACE: AudioManager - Flanger support: NO TRACE: AudioManager - Frequency shifter support: NO TRACE: AudioManager - Vocal morpher support: NO TRACE: AudioManager - Pitch shifter support: NO TRACE: AudioManager - Ring modulator support: NO TRACE: AudioManager - AutoWAH support: NO TRACE: AudioManager - Equalizer support: NO TRACE: AudioManager - EAX Reverb support: YES ``` This is because I only get the Generic Software driver, which only supports reverb and EAX reverb. And not just on my machine, but others as well. Here's how I detect the drivers for OpenAL to use: ``` ALchar device[256]; ZeroMemory(device, 256); if (alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT")) { strcpy_s(device, 256, alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER)); } else if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) { strcpy_s(device, 256, alcGetString(NULL, ALC_DEVICE_SPECIFIER)); } TRACE_AUDIOMANAGER("Sound device: '%s'", device); g_System = alcOpenDevice(device); ``` According to the specification, the device specifier should return two drivers: 'Generic Hardware' and 'Generic Software', separated by a NULL terminator. My sound card is an "NVIDIA High Definition Audio" device which is using the nvhda32v.sys driver (version 1.0.0.63, updated on 11-11-2009). Why doesn't OpenAL detect my hardware?