[Openal-devel] ALC_ENUMERATE_ALL_EXT and pluggable sound devices

Stefanos A. stapostol at gmail.com
Fri Sep 18 06:59:37 PDT 2009


On Fri, 2009-09-18 at 00:43 -0400, Ryan C. Gordon wrote:
> > I think this could be a good option, but the ALX_EXT_disconnect 
> > extension does not explicitly require this behavior, and so the 
> > implementors can't trust on it... It should be implemented in a more 
> > robust way, in such a way the implementors don't get confused about what 
> > will happen after this OpenAL call.
> 
> ALC_EXT_disconnect says that you find out about new devices by 
> reenumerating.
> 
> I don't really know that we need to set a flag to alert apps (or the 
> router) that the device list has changed. This code isn't really a 
> killer if you run it once once every five seconds (or even once a frame)...

Yes it *is* a killer, because string allocations engage the GC in
managed languages  (yes, there is stuff other than C/C++ that relies on
OpenAL). Such an approach would be completely unsuitable for such
environments.

Besides, why allocate a new string every 5 seconds when you could just
say:

if (alcGetBoolean(NULL, ALC_DEVICE_LIST_CHANGED))
{
    // retrieve device list
}

?

> 
>    // ignore that C string funcs fail on the null-separated list for now.
>    current_devices = alcGetString(NULL,ALC_DEVICE_SPECIFIER);
>    if (strcmp(current_devices, previous_devices) != 0) {
>       // handle device list change here, if for some reason you need to.
>       free(previous_devices);
>       previous_devices = strdup(current_devices);
>    }
> 
> 
> --ryan.
> _______________________________________________
> Openal-devel mailing list
> Openal-devel at opensource.creative.com
> http://opensource.creative.com/mailman/listinfo/openal-devel



More information about the Openal-devel mailing list