[Openal] Detecting sound cards

nic at weartronics.com nic at weartronics.com
Wed Oct 11 16:40:50 PDT 2006


Hi Jeremy,

You can enumerate all the available devices using alcGetString as you
suggest: alcGetString(NULL, ALC_DEVICE_SPECIFIER). Use NULL for the device
specifier for this command. This returns a string containing all the
available devices, each separated by a null character and terminated with
two null characters.

Yes ALC_DEFAULT_DEVICE_SPECIFIER is the correct way to find the default
sound card.

Kind regards,

Nic

p.s. unrelated to your problem, the device specifier string makes it
impossible to directly interop the enumeration function from .NET
languages. This is because when the string is converted to the managed
string type it is truncated at the first null character (unsurprising).
This is possible to work around by writing a managed wrapper in C++/CLI,
but it would be very useful if an alternative enumeration function could
be introduced which would allow this function to be interop directly. for
example alcGetString(NULL, ALC_NEXT_DEVICE_SPECIFIER) which could be
called repeatedly to return the name of the next device, and returns a
NULL before returning to the first device again (this technique would
allow you to continue to use alcGetString).

> I need to detect the attributes of the user's sound card or specifically
> the
> number of channels the sound card has.  Right now I am using a hard coded
> 32
> channel limit on sounds but we want to be able to detect the limit
> instead.
> Is this supported?  In the programmer's guide it looks like I am supposed
> to
> use alcGetString to get the device's name but I am not sure how to use it.
> For the first parameter should I pass it an ALC device (or array of them)
> I
> declare to access the parameters of each device?  Can I pass
> ALC_DEFAULT_DEVICE_SPECIFIER to get my default sound card to get that
> information if this is the correct function?
>
> Thanks,
> Jeremy
>
>
> _______________________________________________
> Openal mailing list
> Openal at opensource.creative.com
> http://opensource.creative.com/mailman/listinfo/openal
>



More information about the Openal mailing list