WASAPI: Difference between revisions

From wiki.jriver.com
Jump to navigation Jump to search
No edit summary
No edit summary
Line 7: Line 7:
An Interact thread on the original creation of WASAPI can be found here:
An Interact thread on the original creation of WASAPI can be found here:
http://yabb.jriver.com/interact/index.php?topic=48478.0
http://yabb.jriver.com/interact/index.php?topic=48478.0



==WASAPI Modes==
==WASAPI Modes==
Line 19: Line 18:
'''WASAPI - Event Style'''
'''WASAPI - Event Style'''


The output mode lets a sound device pull data from Media Center. This method is not supported by all hardware, but is recommended when it is supported.
The output mode lets a sound device pull data from Media Center. This method is not supported by all hardware, but is recommended when supported.


WASAPI - Event Style has several advantages:
WASAPI - Event Style has several advantages:
Line 31: Line 30:


* The main 'pull loop' uses a lock-free circle buffer (a neat system J. River built for ASIO), meaning fullfilling a pull request is as fast as possible.
* The main 'pull loop' uses a lock-free circle buffer (a neat system J. River built for ASIO), meaning fullfilling a pull request is as fast as possible.



==Problems==
==Problems==

Revision as of 17:35, 27 September 2010

WASAPI is Microsoft's most modern method for talking with sound devices. WASAPI stands for Windows Audio Session API. It is available in Windows Vista, Windows 7, and newer. It allows delivering an unmodified bitstream to a sound device.

WASAPI support was first added to Media Center 13. Media Center 15 added event style WASAPI support.

For XP, ASIO is similar.

An Interact thread on the original creation of WASAPI can be found here: http://yabb.jriver.com/interact/index.php?topic=48478.0

WASAPI Modes

There are two main ways to communicate using WASAPI. Both deliver the same audio data and will sound the same. However, different WASAPI modes will work better with different hardware.

WASAPI

This output mode pushes data from Media Center to the sound device. It works with nearly all hardware.

WASAPI - Event Style

The output mode lets a sound device pull data from Media Center. This method is not supported by all hardware, but is recommended when supported.

WASAPI - Event Style has several advantages:

  • It let's the audio subsystem pull data (when events are set) instead of pushing data to the system. This allows lower latency buffer sizes, and removes an unreliable Microsoft layer documented below.
  • It creates, uses, and destroys all WASAPI interfaces from a single thread.
  • The hardware (or WASAPI interface) never see any pause or flush calls. Instead, on pause or flush, silence is delivered in the pull loop. This removes the need for hacks for cards that circle their buffers on pause, flush, etc. (ATI HDMI, etc.).
  • It allows for a more direct data path to the driver / hardware.
  • The main 'pull loop' uses a lock-free circle buffer (a neat system J. River built for ASIO), meaning fullfilling a pull request is as fast as possible.

Problems

Stuttering

Some devices (most commonly USB DACs) will start stuttering during playback when using WASAPI. This is due to a bug in the WASAPI system or stock Microsoft driver where the circling buffers get out of order. Stopping and restarting playback is required to reset the stuttering.

Using WASAPI - Event Style will fix this problem.

There are more details here: http://yabb.jriver.com/interact/index.php?topic=59460.0


Hiccups using WASAPI - Event Style

The default buffering value for WASAPI - Event Style is 50ms. With some hardware, and especially USB DACs, a larger value is necessary. If you hear hiccups, select 100ms or 250ms for buffering in Options > Audio > Output mode settings...


Playback won't start or stalls

Some hardware is particular about buffer sizes. You may need to experiment with different buffering values using Options > Audio > Output mode settings...


Other Problems For playback problems, please see this thread.