Exclusive Access: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
{{See Also
{{See Also
| relatedPage=[[WASAPI]] }}
| relatedPage=[[WASAPI]] and [[Audio Output Modes]]}}


Both Microsoft's [[WASAPI]] system and Apple's [[Core Audio]] API provide software with the ability to [http://msdn.microsoft.com/en-us/library/windows/desktop/dd370844%28v=vs.85%29.aspx open audio streams in exclusive mode]. This provides a number of benefits, the primary of which is more direct and lower-latency access to the audio hardware. Media Center enables this option by default when you choose [[WASAPI]] or [[Core Audio]] as your [[Audio Output Mode]]. This setting can be toggled on and off via:
Both Microsoft's [[WASAPI]] system and Apple's [[Core Audio]] API provide software with the ability to [http://msdn.microsoft.com/en-us/library/windows/desktop/dd370844%28v=vs.85%29.aspx open audio streams in exclusive mode]. This provides a number of benefits, the primary of which is more direct and lower-latency access to the audio hardware. Media Center enables this option by default when you choose [[WASAPI]] or [[Core Audio]] as your [[Audio Output Mode]]. This setting can be toggled on and off via:

Revision as of 04:30, 17 April 2014

Both Microsoft's WASAPI system and Apple's Core Audio API provide software with the ability to open audio streams in exclusive mode. This provides a number of benefits, the primary of which is more direct and lower-latency access to the audio hardware. Media Center enables this option by default when you choose WASAPI or Core Audio as your Audio Output Mode. This setting can be toggled on and off via:

Tools > Options > Audio > Audio Device > Device settings > Open device for exclusive access

Open device for exclusive access is recommended, but it is good to understand how it works.

When Exclusive Access is enabled, then:

  • When you start playback, Media Center sends an exclusive-mode stream. If another audio device is currently using the audio hardware, the request for exclusive access is rejected, and playback fails.
  • While playback is active (including while paused) in Media Center, no other application on the system can use the specified audio device. Applications that attempt to play sound (such as system sounds or a web browser) will typically be automatically assigned to an alternate (perhaps disconnected) audio output on the computer, or playback will fail entirely.
  • As soon as playback is stopped in Media Center, the audio device again becomes available to the system for use by other applications.

This allows Media Center to completely control the audio output, set any supported bitdepth and sample rate, and prevent other applications from interfering with the audio output. It is the recommended setting for WASAPI and Core Audio, and it is enabled in Media Center by default.

Requirements

Exclusive Mode requires:

  • An audio device driver that supports this mode.
  • In Windows under WASAPI, that Allow applications to take exclusive control of this device is enabled in the Advanced tab of the device's Properties dialog.

Most standard Windows and OS X drivers for common audio hardware now properly support exclusive mode, though you may have difficulty with older hardware and with virtual sound devices included as part of virtual machines. Windows should default to allowing exclusive access (as described above), but you can verify this by:

  1. Open the Sound control panel in Windows
  2. Select your device and click Properties.
  3. Switch to the Advanced tab.
  4. Ensure that Allow applications to take exclusive control of this device and Give exclusive mode applications priority are both enabled.
Windows-Sound Properties Advanced.png

Benefits and Considerations

With exclusive mode enabled, Media Center can use your audio device's best supported bitdepth (which it does automatically) and it can play files of any sample rate natively, as long as your audio device supports the given sample rate. This means that it does not matter what Default Format is selected in the audio device's properties dialog on Windows (shown above), or in the Audio MIDI Setup utility on OS X. MC can "take control" and play any file supported natively by the audio device without resampling.

Likewise, Media Center can directly control the number of output channels, and can use a multichannel output even if the Speaker Configuration in the OS is set to stereo. This is often convenient when using Media Center with a Home Theater surround system and receiver, because you can set the OS default format to Stereo and allow the receiver to upconvert stereo sources to surround (for web browser audio and other applications). In Exclusive Mode, Media Center will still use the number of channels selected in the Output Format DSP, regardless of the OS's Speaker Configuration setting.

It also allows you to effectively use the Maximize device volume during playback feature to bypass your device's volume control and enable convenient use of MC's Internal Volume control. And, as mentioned earlier it provides a much lower latency and hardware direct method for accessing and controlling the audio device.

However, it does mean that while MC is playing, your audio device will be essentially locked out from use by other applications on the system. This means that you can't, for example:

  • Play a game while listening to music
  • Watch a web video with sound while MC is playing something else.
  • Capture MC's audio output through other software applications like Audio Hijack Pro or Camtasia Studio.

Output Format Considerations

As described above, with Exclusive Mode enabled, Media Center can play any audio file natively without resampling. This means, for example, that audio files sourced from CD will play at their native 44.1kHz and audio from DVD and other video sources will play with their native 48kHz sample rate. It doesn't matter what the Default Format for the audio device is set to, as the OS does not need to resample and can play the file natively. Therefore, you can set MC's Output Format DSP to only resample those audio formats that your particular audio device does not support natively.

On the other hand, unlike in the older Direct Sound API, Shared-mode WASAPI on Windows provides no automatic resampling. Therefore, Media Center must resample all audio output to match the currently selected Default format in Windows. Otherwise, playback will fail, because the audio device can't accept multiple streams in different formats simultaneously without resampling.

If you disable Exclusive Mode in WASAPI on Windows, then you must set Media Center's Output Format DSP to resample all audio to match the format you have selected as the Default Format for the audio device.

This is the error dialog you'll see if you play any format other than the system's Default with Exclusive Mode disabled.
Please Note: Core Audio on OS X does not suffer from this limitation, as it automatically switches the format and resamples as is needed on the fly. However, if you want to be sure to preserve the original format of your audio file and play them natively, Exclusive Mode is still recommended as it prevents other applications from changing the output format.