[Openal] OpenAL-Soft and Changing to new device connected at runtime

Chris Robinson chris.kcat at gmail.com
Mon Mar 9 04:06:22 PDT 2009


On Monday 09 March 2009 3:10:20 am admin at ptrefall.com wrote:
> I added a local fix/hack to make new devices connected at runtime
> available. Having to exit and restart the application if you forgot to
> plug in the USB microphone at startup felt a little unnecessary.
>
> Necessary changes were added to alcGetString and WinMMOpenCapture for the
> requirements I had, though this certainly breaks platform independence in
> Alc.c, by asking mmsystem again for num devices and iterating over those
> devices before continuing.

The big problem with this is I think current apps are allowed to assume the 
strings returned by alcGetString won't change without provocation. For 
example, an app that gets the device list string, and maintains pointers to 
the individual devices from that returned list for displaying to the user at 
various times. If it changes, the app may suddenly have those pointers 
pointing to incorrect strings, or worse pointing to invalid memory.

The spec says the returned string is constant, and doesn't say the pointer 
ever becomes invalidated. If the string changes without the app otherwise 
telling it to, both of those could happen and break apps that rely on it.


More information about the Openal mailing list