Reputation: 1619
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?
Upvotes: 5
Views: 3778
Reputation: 17
There is no "Generic Hardware" device on Vista: http://connect.creativelabs.com/openal/OpenAL%20Wiki/OpenAL%C2%AE%20and%20Windows%20Vista%E2%84%A2.aspx
Cheers!
Upvotes: -1
Reputation: 11
for those who are still looking for a way to get all devices //except output - stil generic, works for input well//
public:int* CHECK_DEVICES_IN(int MAX_DEVICES) { int devices=0; char* device[MAX_DEVICES]; int checked=0; while(devices<=MAX_DEVICES&&checked } checked++; } return devices; /* int returned=0; while(returned
public:ALchar* DEVICES_IN(int REQUIRED)
{ ALchar* result="0";
ALchar* device=(ALchar*)alcGetString(NULL,ALC_CAPTURE_DEVICE_SPECIFIER);
int POS=0;
while(device && device!=NULL && strlen(device)>0 && POS<=REQUIRED)
{ if(POS==REQUIRED)
{ result=device; }
device+=strlen(device)+1;
POS++;
}
return result;
}
Upvotes: 1
Reputation: 1619
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));
Upvotes: 2
Reputation: 11572
are you sure you check the next string, because alcGetString(NULL, ALC_DEVICE_SPECIFIER)
returns string array, try like this:
char* devices = (char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
while(devices && *devices !=NULL)
{
ALCdevice* device = alcOpenDevice(devices);
...
...
devices += strlen(devices) + 1; //next device
}
Upvotes: 1