[openal] Runtime devices management

alberto box alberto.box66 at gmail.com
Mon Sep 12 06:44:20 EDT 2016


Hi Chris, thank you for answering.

The latest line of your mail changed everything :)

I got rid of the original OpenAL.dll, substituing it with openAL Soft dll,
and now I can detect capture device disconnection (and reconnection) just
regenerating the devices list runtime, when, with the original dll, devices
were always 'freezed' at the status they had at application launch time
(even a full reinitialization of openal).

The extension "ALC_EXT_disconnect" results available, but it doesn't work
in my environment: ... it keeps on telling me the capture device is present
even when I unplug it, and even after the dll replacement. Well, anyway I
think I can replace it with a periodic scan of devices list.

Are you aware of any sideffect/issues that can be raised by the dll
substitution and that can affect the application behavior?

Thank you very much, again.

Il 09/set/2016 18:53, "Chris Robinson" <chris.kcat at gmail.com> ha scritto:

> On 09/09/2016 05:38 AM, alberto box wrote:
>
>> Moreover, the device change is not recognized even re-initializing openal
>> at runtime.
>>
>
> Currently, OpenAL Soft does not implement any preferred-device tracking.
> When a device is opened, the returned ALCdevice is tied to that output or
> input device.
>
> Part of the problem is that the OpenAL API has no method to deal with such
> behavior. The best it could do is secretly move playback or capture to a
> different device and continue to report the old device's name, but that
> could cause unintended consequences. The alternative is to simply not
> report the name of the device being used, so if it moves it won't need to
> change anything... but then the app can't tell the user what device is
> actually being used.
>
> 2. Is there a way to be notified when a device status changes at runtime?
>>
>
> You can check to see if a device has been disconnected using the
> ALC_EXT_disconnect extension:
>
> https://icculus.org/alextreg/wiki/ALC_EXT_disconnect
>
> Essentially, you periodically check the device's connection status:
>
> ALCint connected;
> alcGetIntegerv(device, ALC_CONNECTED, 1, &connected);
> if(!connected)
> {
>    /* We've been lost! */
> }
>
> When the device has been disconnected, it will not play or record any more
> samples, and it will never reconnect on its own, even if the device is
> reconnected. You'll need to close the device handle and open a new one if
> you want to keep playing/recording (there has been talk about allowing
> alcResetDeviceSOFT to try to restore playback/capture from a
> previously-disconnected device, although this behavior is not currently
> implemented).
>
> 3. Is there a way to make openal initialization (following the first one)
>> aware of new devices status?
>>
>
> This is ultimately down to the system. At least when using OpenAL Soft
> directly, every enumeration request is passed on to the underlying API
> (mmdevapi, dsound) to get a fresh list of device names each time. If the
> underlying API doesn't update its internal list of available devices,
> OpenAL Soft won't know about any changes either.
>
> If you're using the router (the OpenAL32.dll provided by Creative's
> installer, with soft_oal.dll to provide the OpenAL Soft devices), then that
> may be caching the device list so it never asks OpenAL Soft to recheck the
> devices. You'll have to use the OpenAL Soft DLL directly to work around
> that, if that's what's happening.
> _______________________________________________
> openal mailing list
> openal at openal.org
> http://openal.org/mailman/listinfo/openal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openal.org/pipermail/openal/attachments/20160912/374c76b9/attachment.html>


More information about the openal mailing list