[Openal] Handling device changes on Vista
Armand Postma
lion.tiger at versatel.nl
Tue Apr 14 03:34:32 PDT 2009
I'm not sure if it helps but there's a Windows event called
WM_DEVICECHANGE, which is called when the hardware configuration
changes, I know it exists and did a quick search on MSDN and it might do
what you're looking for... I've never used the event myself however.
MSDN WM_DEVICECHANGE page:
http://msdn.microsoft.com/en-us/library/aa363480(VS.85).aspx
Another article using it to sense a CD/DVD eject/insert:
http://support.microsoft.com/kb/163503
The funny thing is that Microsoft mentions requiring a minimum of
Win2000 Pro in the first article and they mention a minimum of Win95 in
the other article, then again I've found more overstated requirements in
the API lately...
Sincerely,
Armand Postma
P.S. Apologies for sending the mail to your e-mail adress first Daniel,
I just hit the reply button and didn't check the address! Doh! :)
Daniel PEACOCK wrote:
>
>
> Hi Niklas,
>
>
>> What is the recommended way of handling sound device changes (new
>> devices being created, old devices being removed) when using OpenAL?
>>
>
> I don't think we have a recommending way of handling this.
>
>
>> This issue is especially important on Windows Vista where new devices
>> can appear when a uses plugs in his headphones. (I.e. a game may start
>> with headphones unplugged and find no devices, then when the headphones
>> are plugged in a new device appears.)
>>
>
> True.
>
>
>> As far as I can tell, there is no mechanism for detecting "device
>> creation" or "device loss" within OpenAL. Should I try to detect these
>> events using Windows functionality? Or regularily poll the system by
>> enumerating the devices? And then re-initialize the sound system with a
>> new device if detected.
>>
>
> That's correct, there are no mechanisms in OpenAL for detecting these
> events. I think an extension that handles this has been proposed.
>
> I'm not aware of a way to get a notification from Windows that an audio
> device has been added, removed, or become the new default playback device.
> That doesn't mean it doesn't exist - I just haven't encountered it before.
> Assuming it doesn't, then you would need to poll Windows to find out what
> audio devices are available. If you detect that something has changed -
> and you consider that something that should be acted upon - then I think
> you may have to shutdown the OpenAL system, and unload openal32.dll, then
> re-load openal32.dll and request the new lists of devices. This is because
> the OpenAL32.dll router only enumerates devices once. NOTE : I've not
> tested this scenario ... there may be other issues.
>
> Dan
>
> _______________________________________________
> Openal mailing list
> Openal at opensource.creative.com
> http://opensource.creative.com/mailman/listinfo/openal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://opensource.creative.com/pipermail/openal/attachments/20090414/d22dd9b2/attachment.html
More information about the Openal
mailing list