ISpatialAudioClient interface (spatialaudioclient.h)

The ISpatialAudioClient interface enables a client to create audio streams that emit audio from a position in 3D space. This interface is a part of Windows Sonic, Microsoft’s audio platform for more immersive audio which includes integrated spatial sound on Xbox and Windows.

Inheritance

The ISpatialAudioClient interface inherits from the IUnknown interface. ISpatialAudioClient also has these types of members:

Methods

The ISpatialAudioClient interface has these methods.

 
ISpatialAudioClient::ActivateSpatialAudioStream

Activates and initializes spatial audio stream using one of the spatial audio stream activation structures.
ISpatialAudioClient::GetMaxDynamicObjectCount

Gets the maximum number of dynamic audio objects for the spatial audio client.
ISpatialAudioClient::GetMaxFrameCount

Gets the maximum possible frame count per processing pass. This method can be used to determine the size of the source buffer that should be allocated to convey audio data for each processing pass.
ISpatialAudioClient::GetNativeStaticObjectTypeMask

Gets a channel mask which represents the subset of static speaker bed channels native to current rendering engine.
ISpatialAudioClient::GetStaticObjectPosition

Gets the position in 3D space of the specified static spatial audio channel.
ISpatialAudioClient::GetSupportedAudioObjectFormatEnumerator

Gets an IAudioFormatEnumerator that contains all supported audio formats for spatial audio objects, the first item in the list represents the most preferable format.
ISpatialAudioClient::IsAudioObjectFormatSupported

Gets a value indicating whether ISpatialAudioObjectRenderStream supports a the specified format.
ISpatialAudioClient::IsSpatialAudioStreamAvailable

When successful, gets a value indicating whether the currently active spatial rendering engine supports the specified spatial audio render stream.

Remarks

The following example code illustrates how to initialize this interface using IMMDevice.

HRESULT hr;
Microsoft::WRL::ComPtr<IMMDeviceEnumerator> deviceEnum;
Microsoft::WRL::ComPtr<IMMDevice> defaultDevice;

hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), nullptr, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator), (void**)&deviceEnum);
hr = deviceEnum->GetDefaultAudioEndpoint(EDataFlow::eRender, eMultimedia, &defaultDevice);

Microsoft::WRL::ComPtr<ISpatialAudioClient> spatialAudioClient;
hr = defaultDevice->Activate(__uuidof(ISpatialAudioClient), CLSCTX_INPROC_SERVER, nullptr, (void**)&spatialAudioClient);

For UWP apps that do not have access to IMMDevice, you should get an instance of ISpatialAudioClient by calling ActivateAudioInterfaceAsync. For an example, see the WindowsAudioSession sample.

Note  When using the ISpatialAudioClient interfaces on an Xbox One Development Kit (XDK) title, you must first call EnableSpatialAudio before calling IMMDeviceEnumerator::EnumAudioEndpoints or IMMDeviceEnumerator::GetDefaultAudioEndpoint. Failure to do so will result in an E_NOINTERFACE error being returned from the call to Activate. EnableSpatialAudio is only available for XDK titles, and does not need to be called for Universal Windows Platform apps running on Xbox One, nor for any non-Xbox One devices.
 
To access the ActivateAudioIntefaceAsync, you will need to link to mmdevapi.lib.

Requirements

Requirement Value
Minimum supported client Windows 10, version 1703 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header spatialaudioclient.h