[Openal] What if a machine doesn't have sound card? How do I do a fail-safe enumeration?

Garin Hiebert garinh at cheesetoast.net
Mon Aug 8 12:42:19 PDT 2005


> What is the best and safest way to handle enumerations on a machine that
> doesn't have a sound card installed?

As Dan indicated, this was a bug in the router.  We've updated the code 
in CVS to handle this now, and I've temporarily put a build of the new 
router in a zip file at 
ftp://opensource.creative.com/pub/temp/AL11Win_080805.zip if you want a 
precompiled build.

Now, enumeration on a system with no sound devices will no longer result 
in a crash.  Enumeration may still come back with generic devices that 
can't really be used, though (alcOpenDevice won't crash, but will fail).

The easiest way to detect that there are no audio devices which can 
really be used is to do a default device call:

defaultDevice = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);

If defaultDevice comes back NULL or as an empty string, then there are 
no audio devices and there isn't really any need to do any more enumeration.

I've updated the OpenALDemo and ALTest code to reflect the above as well.

Thanks for the bug report...

Garin



More information about the Openal mailing list