[Openal-devel] ALC_ENUMERATE_ALL_EXT and pluggable sound devices
Ryan C. Gordon
icculus at icculus.org
Mon Sep 21 12:51:03 PDT 2009
> We have two solutions until now:
>
> 1) alcGetString always returns a "fresh" list of the available
> devices, in a way opposite to the current Router behavior that is to
> save a list in static memory and return the same list for every
> subsequent call;
> 2) The application must call ALC_EXT_disconnect to force the list to
> be cleaned up.
ALC_EXT_disconnect isn't a function, it's an extension name that, among
other things, specifies behaviour #1. So this is an easy solution. :)
The router will need to be fixed to support ALC_EXT_disconnect, if it is
caching device names on behalf of the lower-level implementation.
> Another case is when you disconnect the USB device. If this device was
> selected by the OpenAL library, I think it is expected by the user that
> the application stops to play sounds, and some kind of intervention
> should be executed to adjust the sound playing again.
That's what ALC_EXT_disconnect is for: it specifies that this is what
happens.
http://icculus.org/alextreg/wiki/ALC_EXT_disconnect
Basically, this use case is totally covered by this extension. The app
can poll for the specific device (without using alcGetString()) to see
if it was disconnected, to decide if they need to stop the game and ask
the user to pick a new device:
ALint connected = 0;
alcGetIntegerv(myDevice, ALC_CONNECTED, &connected);
if (!connected) {
alcCloseDevice(myDevice);
ask_user_to_pick_a_new_device_or_whatever();
}
No parsing of device lists required.
What we're talking about, really, is the opposite: how to know when new
hardware shows up (although it could be used to know when something
disconnected, too).
--ryan.
More information about the Openal-devel
mailing list