Windows audio: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
>UNiversal
m (→‎Check drivers: Dont need these to be so wide.)
No edit summary
 
(40 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Frodo updated}}
{{mininav|[[Audio]]}}
{{Navigation
<section begin="intro" />This page describes how to set up audio for the Windows OS. It covers how to set up Kodi when using either Directsound or WASAPI, and when to use one vs the other.<section end="intro" />
| nav name =Audio
| link1 =AudioEngine
| link2 =AudioEngine/HOW-TO: Configure audio
| link2 name = HOW-TO: Configure audio
| link3 =Windows Settings for AudioEngine
| link3 name = Windows Settings
| link4 =Intel Linux Modifications for HD Audio
}}
{{-}}
== XBMC & the Windows Audio API's==
XBMC supports both the Directsound and WASAPI modes.


Since WASAPI performs no mixing or resampling this is the preferred mode for best quality audio.
Since WASAPI performs no mixing or resampling this is the preferred mode for best quality audio.


In XBMC WASAPI only uses the exclusive mode of operation in order that the application gets the exclusive rights to the audio buffers whilst playing audio streams to the exclusion of all other sounds or players. When using WASAPI care must be taken to ensure Windows is configured to allow XBMC to run in exclusive mode, refer to the below '''Configure Windows Sound Settings''' section.
Kodi uses WASAPI only in the Exclusive Mode of operation in order that Kodi gets the exclusive rights to the audio buffers whilst playing audio streams to the exclusion of all other sounds or players, this is a change from previous version of Kodi where Shared Mode was also allowed. When using WASAPI care must be taken to ensure Windows is configured to allow Kodi to run in exclusive mode, refer to the below '''Configure Windows Sound Settings''' section.


In addition XBMC WASAPI also uses the more modern Event driven mode of WASAPI, so both the audio hardware & audio driver need to support the Event mode.
In addition Kodi uses WASAPI in the more modern Event driven mode.  Previously Kodi used the Push mode, so both the audio hardware & audio driver need to support the Event mode for audio to work with WASAPI selected.


{{Note|This is a change from the old audio subsystem used in Eden (Version 11) and earlier, as previously XBMC operated in the push mode.}}


Due to the two updates in how WASAPI works within XBMC Frodo, with it operating in Exclusive & Event only modes, then previously working configurations may not work when upgrading to XBMC Frodo, as Windows may not either be configured for Exclusive mode or the audio driver or hardware may not support Event mode.


== Check drivers ==
= Hardware Vendor Specifics =
== AMD GPU ==
 
If using WASAPI do not use the Realtek HD Audio drivers as they do not work with the event driven mode Kodi uses for WASAPI. To use WASAPI you must use the AMD High Definition Audio drivers.
 
The Realtek HD Audio drivers will however work with the Directsound mode.
== Intel GPU ==
 
To support HD Audio on Windows the Intel Management Engine Interface driver must be installed, it's this driver that provides the HDCP DRM necessary for the HD Audio formats to works. If this driver is not installed then the HD formats will be missing from the Supported Formats tab.
 
In order to verify you have the Intel Management Engine Interface driver installed, follow the relevant step at [http://www.intel.com/support/graphics/sb/CS-031600.htm?wapkw=management+engine+driver Blu-Ray* Disc Playback with Intel® HD Graphics FAQ]
 
= Check drivers =
<gallery widths=500px heights=400px>
<gallery widths=500px heights=400px>
File:Computer management.JPG|'''Step 1:''' Select '''Device Manager''' then go to '''Sound, video and game controllers'''. Select the device you'll be using for audio and right click then select '''Properties'''
File:Computer management.JPG|'''Step 1:''' Select '''Device Manager''' then go to '''Sound, video and game controllers'''. Select the device you'll be using for audio and right click then select '''Properties'''
Line 30: Line 29:
</gallery>
</gallery>


== Configure Windows Sound Settings ==
= Configure Windows Sound Settings =


<gallery widths=550px heights=400px>
The Windows sound settings will only apply if you select an audio device using the Directsound API within Kodi, if you select an audio device using the WASAPI API then these settings will be ignored however it's a good to configure these correctly no matter what type of API you're using.
File:Sound - playback.jpg|'''Step 3:''' Set the audio device to be used for XBMC audio as the default device, Next launch the '''Configure''' wizard to set the speaker layout you have. If operating XBMC in WASAPI mode this isn't strictly needed to be correct but it's good practice to ensure it's correctly set.


File:Speaker setup.jpg|'''Step 4:''' <big>'''<u>For HDMI connections only</u>'''</big> Next select '''Properties''' and go to the '''Supported Formats''' tab. In this tab you'll see the formats that the audio driver is reporting to Windows that you selected hardware is capable of, if audio codecs are missing from '''Encoded Formats''' list then XBMC won't be able to play these formats back. If formats are missing that you know your hardware is capable of then this points to there being either a driver problem or if using HDMI then it maybe a EDID handshaking problem.
<gallery widths=500px heights=400px>
 
File:Sound - playback.jpg|'''Step 3:''' Set the audio device to be used for Kodi audio as the default device,
File:Output Properties - Supported Formats.jpg|'''Step 5:''' Finally go to the '''Advanced Tab''' and ensure the '''Exclusive Mode''' check boxes '''Allow applications to take exclusive control of this device''' and '''Give exclusive mode applications priority''' are ticked. This is a requirement if WASAPI mode is to be used in XBMC.
File:Speaker setup.jpg|'''Step 4:''' Next launch the '''Configure''' wizard to set the speaker layout you have. If operating Kodi in WASAPI mode this isn't strictly needed to be correct but it's good practice to ensure it's correctly set.
 
File:Output Properties - Supported Formats.jpg|'''Step 5:''' <big>'''<u>For HDMI connections only</u>'''</big> Next select '''Properties''' and go to the '''Supported Formats''' tab. In this tab you'll see the formats that the audio driver is reporting to Windows that you selected hardware is capable of, if audio codecs are missing from '''Encoded Formats''' list then Kodi won't be able to play these formats back. If formats are missing that you know your hardware is capable of then this points to there being either a driver problem or if using HDMI then it maybe a EDID handshaking problem. <br /><br />'''IMPORTANT -''' For HD audio to work then '''Max Number of Channels''' must be reported as '''8''' if anything other than 8 is reported then HD audio will not work even if DTS-HD and TrueHD are listed in the Encoded Formats box.
File:Output Properties - Advanced.jpg|'''Step 6:''' Once this is done you should be good to go in setting up audio on XBMC so refer back to [[AudioEngine]]
File:Output Properties - Advanced.jpg|'''Step 6:''' Finally go to the '''Advanced Tab''' and ensure the '''Exclusive Mode''' check boxes '''Allow applications to take exclusive control of this device''' and '''Give exclusive mode applications priority''' are ticked. This is a requirement if WASAPI mode is to be used in Kodi. Once this is done you should be good to go in setting up audio on Kodi so refer back to [[AudioEngine]]
</gallery>
</gallery>


== Windows Audio API's - Background ==
= Windows Audio API's - Background =
Since Windows Vista SP1 there has two primary audio interfaces, DirectSound and WASAPI (Windows Audio Session Application Programming Interface) with WASAPI being a replacement for Windows XP's Kernel Streaming mode.
Since Windows Vista SP1 there has two primary audio interfaces, DirectSound and WASAPI (Windows Audio Session Application Programming Interface) with WASAPI being a replacement for Windows XP's Kernel Streaming mode.


=== Directsound ===
== Directsound ==
DirectSound acts as a program-friendly middle layer between the program and the audio driver, which in turn speaks to the audio hardware. With DirectSound, Windows controls the sample rate, channel layout and other details of the audio stream via an Audio Mixer. Every program using sound passes it's data to DirectSound and the Audio Mixer which then resamples as required so it can mix audio streams from any program together with system sounds.
DirectSound acts as a program-friendly middle layer between the program and the audio driver, which in turn speaks to the audio hardware. With DirectSound, Windows controls the sample rate, channel layout and other details of the audio stream via an Audio Mixer. Every program using sound passes it's data to DirectSound and the Audio Mixer which then resamples as required so it can mix audio streams from any program together with system sounds.


Line 52: Line 50:
The disadvantages are that other programs can play at the same time, and that a program's output gets mixed to whatever the system's settings are. This means the program cannot control the sampling rate, channel count, format, etc. Even more important for this thread is that you cannot pass through encoded formats, as DirectSound will not decode them and it would otherwise bit-mangle them, and there is a loss of sonic quality involved in the mixing and resampling.
The disadvantages are that other programs can play at the same time, and that a program's output gets mixed to whatever the system's settings are. This means the program cannot control the sampling rate, channel count, format, etc. Even more important for this thread is that you cannot pass through encoded formats, as DirectSound will not decode them and it would otherwise bit-mangle them, and there is a loss of sonic quality involved in the mixing and resampling.


===WASAPI===
== WASAPI ==
Partly to allow for cleaner, uncompromised or encoded audio, and for low-latency requirements like mixing and recording, Microsoft re-vamped their Kernel Streaming mode after XP and came up with WASAPI for Vista.
Partly to allow for cleaner, uncompromised or encoded audio, and for low-latency requirements like mixing and recording, Microsoft re-vamped their Kernel Streaming mode after XP and came up with WASAPI for Vista.


WASAPI itself has two modes, Shared and Exclusive.  
WASAPI itself has two modes, Shared and Exclusive.  


Shared mode is in many ways similar to DirectSound as it allows other sounds to be mixed into the currently playing stream, however this mode is not supported on XBMC so won't be covered any further here.
Shared mode is in many ways similar to DirectSound as it allows other sounds to be mixed into the currently playing stream, however this mode is not supported on Kodi so won't be covered any further here.


WASAPI Exclusive mode bypasses the Audio Mixer and thus the mixing/resampling layers of DirectSound so audio is passed-through as-is, this is why WASAPI should be used for encoded formats like DTS in order that they can reach the receiver unchanged for decoding there.  
WASAPI Exclusive mode bypasses the Audio Mixer and thus the mixing/resampling layers of DirectSound so audio is passed-through as-is, this is why WASAPI should be used for encoded formats like DTS in order that they can reach the receiver unchanged for decoding there.  
Line 70: Line 68:


[[Category:How-to]]
[[Category:How-to]]
[[Category:Audio]]
[[Category:Windows]]
[[Category:Windows]]
[[Category:Settings]]
[[Category:Settings]]
[[Category:Manual]]

Latest revision as of 00:28, 18 December 2015

Home icon grey.png   ▶ Audio ▶ Windows audio

This page describes how to set up audio for the Windows OS. It covers how to set up Kodi when using either Directsound or WASAPI, and when to use one vs the other.

Since WASAPI performs no mixing or resampling this is the preferred mode for best quality audio.

Kodi uses WASAPI only in the Exclusive Mode of operation in order that Kodi gets the exclusive rights to the audio buffers whilst playing audio streams to the exclusion of all other sounds or players, this is a change from previous version of Kodi where Shared Mode was also allowed. When using WASAPI care must be taken to ensure Windows is configured to allow Kodi to run in exclusive mode, refer to the below Configure Windows Sound Settings section.

In addition Kodi uses WASAPI in the more modern Event driven mode. Previously Kodi used the Push mode, so both the audio hardware & audio driver need to support the Event mode for audio to work with WASAPI selected.


Hardware Vendor Specifics

AMD GPU

If using WASAPI do not use the Realtek HD Audio drivers as they do not work with the event driven mode Kodi uses for WASAPI. To use WASAPI you must use the AMD High Definition Audio drivers.

The Realtek HD Audio drivers will however work with the Directsound mode.

Intel GPU

To support HD Audio on Windows the Intel Management Engine Interface driver must be installed, it's this driver that provides the HDCP DRM necessary for the HD Audio formats to works. If this driver is not installed then the HD formats will be missing from the Supported Formats tab.

In order to verify you have the Intel Management Engine Interface driver installed, follow the relevant step at Blu-Ray* Disc Playback with Intel® HD Graphics FAQ

Check drivers

Configure Windows Sound Settings

The Windows sound settings will only apply if you select an audio device using the Directsound API within Kodi, if you select an audio device using the WASAPI API then these settings will be ignored however it's a good to configure these correctly no matter what type of API you're using.

Windows Audio API's - Background

Since Windows Vista SP1 there has two primary audio interfaces, DirectSound and WASAPI (Windows Audio Session Application Programming Interface) with WASAPI being a replacement for Windows XP's Kernel Streaming mode.

Directsound

DirectSound acts as a program-friendly middle layer between the program and the audio driver, which in turn speaks to the audio hardware. With DirectSound, Windows controls the sample rate, channel layout and other details of the audio stream via an Audio Mixer. Every program using sound passes it's data to DirectSound and the Audio Mixer which then resamples as required so it can mix audio streams from any program together with system sounds.

The advantages are that programs don't need resampling code or other complexities, and any program can play sounds at the same time as others, or the same time as system sounds, because they are all mixed to one format.

The disadvantages are that other programs can play at the same time, and that a program's output gets mixed to whatever the system's settings are. This means the program cannot control the sampling rate, channel count, format, etc. Even more important for this thread is that you cannot pass through encoded formats, as DirectSound will not decode them and it would otherwise bit-mangle them, and there is a loss of sonic quality involved in the mixing and resampling.

WASAPI

Partly to allow for cleaner, uncompromised or encoded audio, and for low-latency requirements like mixing and recording, Microsoft re-vamped their Kernel Streaming mode after XP and came up with WASAPI for Vista.

WASAPI itself has two modes, Shared and Exclusive.

Shared mode is in many ways similar to DirectSound as it allows other sounds to be mixed into the currently playing stream, however this mode is not supported on Kodi so won't be covered any further here.

WASAPI Exclusive mode bypasses the Audio Mixer and thus the mixing/resampling layers of DirectSound so audio is passed-through as-is, this is why WASAPI should be used for encoded formats like DTS in order that they can reach the receiver unchanged for decoding there.

WASAPI Exclusive mode allows the application to interrogate the capabilities of the audio driver, since audio is presented directly by the application to the audio driver the format that the audio is sent in by the application must be in a format that is compatible with the capabilities of the audio driver, as there is no DirectSound between to convert it. This interrogation is a two way process that often involves some back-and-forth depending on the format specified and the device's capabilities, once a set of compatible formats is agreed upon by application and audio driver, the application then decides how it will present the audio stream to the audio driver.

In addition to Shared and Exclusive modes, there are two modes for how data is passed from the application to the audio driver.

The normal manner is in push mode - a buffer is created which the audio device draws from, and the application pushes as much data in as it can to keep that buffer full. To do this it must constantly monitor the levels in the buffer, with short "sleeps" in between to allow other threads to run.

WASAPI, and most modern sound devices, also support a "pull" or "event-driven" mode. In this mode two buffers are used. The application gives the audio driver a call-back address or function, fills one buffer and starts playback, then goes off to do other processing. It can forget about the data stream for a while. Whenever one of the two buffers is empty, the audio driver "calls you back", and gives you the address of the empty buffer. You fill this and go your way again. Between the two buffers there is a ping-pong action: one is in use and draining, the other is full and ready. As soon as the first is emptied the buffers are switched, and you are called upon to fill the empty one. So audio data is being "pulled" from the application by the audio driver, as opposed to "pushed" by the application.