Windows 8.1 Audio streaming – Part 4: Background playback, Volume policy, Routing
In the last post of this series, I will describe the last 3 types of stream behaviors/capabilities that are controlled by a stream's audio category:
- Background Audio Playback
- Volume/Ducking
- Routing
1. Background Audio Playback
This policy defines, if the application will keep playing audio when the application goes to the background (e.g. because it is minimized). The application's behavior will differ based on whether it is a Win32 or a Store app. Also, Store apps have different behavior, if they are running on the desktop or on the phone. The following matrix explains the differences:
Desktop | Phone | |
Win32 app | Always plays and captures audio from the background | N/A |
Store App | Only render streams that use the BackgroundCapableMedia or Communications categories will play audio when the app is in the background. No support for background capture | Background capability not affected by audio categories. Instead, background-capable apps use the Background Audio Player API. |
2. Volume/Ducking Policy
At any given point in time, there might be lots of streams running in a system. Each stream could have a different audio category. For example, let's assume that a user receives a Skype call, as he is listening to music.
- Xbox Music stream is using the BackgroundCapableMedia category
- Skype stream is using the Communications category
In order to make sure that the user can listen to the other party in the Skype call, Windows decides to attenuate (i.e. lower the volume) of the Xbox Music stream. These decisions are made based on internal audio stream policies that are based on the audio stream categories. Due to high number of combinations in the system (there are 8 audio categories in Windows 8.1), it would not be practical for Windows to allow the user to define the behavior for all potential stream combinations. However, users do have the option to control system behavior in the case of Communication streams by going to:
Control Panel -> Sound -> Communications tab
There is additional information about ducking policies in this MSDN page.
3. Routing
Stream routing is the mechanism that is used to switch streams between different endpoints with minimal interruption to the playback or the capture section. For example, if the user is listening to music from the internal speakers and plugs in a headphone, then audio is expected to switch to the headphone. Since there are multiple endpoints for audio render (internal speakers, external speakers that use the 3.5mm audio jack, USB speakers, HDMI speakers, BT speakers, etc) and for audio capture, Windows determines which endpoint is expected to be used. However, the mechanisms for audio routing and stream switching are different between the Destop SKU and the Mobile SKU:
- In the Desktop SKU, Windows notifies all applications that render/capture audio that they should switch to a different endpoint (e.g. because the user plugged/unplugged a headset). However, it up to the application to listen to these notifications, tear down the existing streams in the old endpoint and re-create them in the new endpoint
- For more information, please visit this page.
- In the Mobile SKU, all the work is done by the audio driver. Applications always render/capture from the same virtual endpoint. The driver switches the physical input/output between internal speakers, external speakers, etc.
- For more information, please visit this page.