AudioDeviceDetection » History » Revision 11
« Previous |
Revision 11/14
(diff)
| Next »
Anonymous, 08/14/2010 12:32 PM
= Audio Device Detection =
<abbr title="Design*, AudioDeviceDetection, depth=1">TOC</abbr>
IntroductionThe idea behind audio device detection is to allow SIP users to switch headphones, speakers or microphones as they are plugged or unplugged from the computer.
Many SIP applications allow this. Some require to restart the application, while others can detect it while running. SIP SIMPLE client can currently detect hotplugged devices in Mac OS X platforms.
GoalThe ultimate goal is to enable SIP SIMPLE client applications to detect audio device changes on the fly in all currently supported platforms, with the most immediate priority being [ticket:117 Windows platform].
Schematic Overview[[Image(wiki:AudioDeviceDetection:SipSimpleAudioDevicesChange.png, width=1024)]]
Required ModificationsAfter a first analysis of the SIP SIMPLE client SDK and dependencies, these are the necessary PortAudio code modifications:
First, it's necessary to hook up into the host OS multimedia system in order to get notified when new devices are added or old ones removed. If the OS doesn't provide a notification API, a poll loop with sensible frequency settings will need to be used. * Currently, this is already achieved in Mac OS X through the `AudioHardwareAddPropertyListener` function in Core Audio API. * In Windows platforms (under `WMME` hostapi), `WM_DEVICECHANGE` OS messages are used. * Each of the rest of platforms (or corresponding hostapis) will need their own implementations too.
Second, the hostapi needs to react to the `DevicesChanged` notification, by updating the internal audio devices data (after which PortAudio will proceed to notify upper layers about the availability of a new devices list). This is achieved through the `RescanDevices` function. * Mac OS X hostapi, Core Audio, already updates its internal devices list with `RescanDevices()`. * Windows WMME hostapi includes its own `RescanDevices()` function, based on the [http://osdir.com/ml/audio.portaudio.devel/2007-02/msg00094.html implementation] provided in PortAudio mailing list. * The rest of platforms and hostapis will need their own implementations.
Updated by over 14 years ago · 11 revisions