pa_win_wasapi.h File Reference
Public API definitions for users of PortAudio

WASAPI-specific PortAudio API extension header file. More...

`#include "portaudio.h"`
`#include "pa_win_waveformat.h"`

Go to the source code of this file.

## Data Structures

struct | PaWasapiJackDescription
struct | PaWasapiStreamPassthrough
struct | PaWasapiStreamInfo

## Macros

#define | paWinWasapiExclusive (paWinWasapiExclusive)
#define | paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)
#define | paWinWasapiUseChannelMask (paWinWasapiUseChannelMask)
#define | paWinWasapiPolling (paWinWasapiPolling)
#define | paWinWasapiThreadPriority (paWinWasapiThreadPriority)
#define | paWinWasapiExplicitSampleFormat (paWinWasapiExplicitSampleFormat)
#define | paWinWasapiAutoConvert (paWinWasapiAutoConvert)
#define | paWinWasapiPassthrough (paWinWasapiPassthrough)
#define | paWasapiStreamStateError (paWasapiStreamStateError)
#define | paWasapiStreamStateThreadPrepare (paWasapiStreamStateThreadPrepare)
#define | paWasapiStreamStateThreadStart (paWasapiStreamStateThreadStart)
#define | paWasapiStreamStateThreadStop (paWasapiStreamStateThreadStop)

## Typedefs

typedef enum PaWasapiFlags | PaWasapiFlags
typedef enum PaWasapiStreamState | PaWasapiStreamState
typedef void(* | PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames, void *outputBuffer, long outputFrames, void *userData)
typedef void(* | PaWasapiStreamStateCallback) (PaStream *pStream, unsigned int stateFlags, unsigned int errorId, void *pUserData)
typedef enum PaWasapiDeviceRole | PaWasapiDeviceRole
typedef enum PaWasapiJackConnectionType | PaWasapiJackConnectionType
typedef enum PaWasapiJackGeoLocation | PaWasapiJackGeoLocation
typedef enum PaWasapiJackGenLocation | PaWasapiJackGenLocation
typedef enum PaWasapiJackPortConnection | PaWasapiJackPortConnection
typedef enum PaWasapiThreadPriority | PaWasapiThreadPriority
typedef struct PaWasapiJackDescription | PaWasapiJackDescription
typedef enum PaWasapiStreamCategory | PaWasapiStreamCategory
typedef enum PaWasapiStreamOption | PaWasapiStreamOption
typedef enum PaWasapiPassthroughFormat | PaWasapiPassthroughFormat
typedef struct PaWasapiStreamPassthrough | PaWasapiStreamPassthrough
typedef struct PaWasapiStreamInfo | PaWasapiStreamInfo

## Enumerations

enum | PaWasapiFlags { paWinWasapiExclusive = (1 << 0) , paWinWasapiRedirectHostProcessor = (1 << 1) , paWinWasapiUseChannelMask = (1 << 2) , paWinWasapiPolling = (1 << 3) , paWinWasapiThreadPriority = (1 << 4) , paWinWasapiExplicitSampleFormat = (1 << 5) , paWinWasapiAutoConvert = (1 << 6) , paWinWasapiPassthrough = (1 << 7) }
enum | PaWasapiStreamState { paWasapiStreamStateError = (1 << 0) , paWasapiStreamStateThreadPrepare = (1 << 1) , paWasapiStreamStateThreadStart = (1 << 2) , paWasapiStreamStateThreadStop = (1 << 3) }
enum | PaWasapiDeviceRole { eRoleRemoteNetworkDevice = 0 , eRoleSpeakers , eRoleLineLevel , eRoleHeadphones , eRoleMicrophone , eRoleHeadset , eRoleHandset , eRoleUnknownDigitalPassthrough , eRoleSPDIF , eRoleHDMI , eRoleUnknownFormFactor }
enum | PaWasapiJackConnectionType { eJackConnTypeUnknown , eJackConnType3Point5mm , eJackConnTypeQuarter , eJackConnTypeAtapiInternal , eJackConnTypeRCA , eJackConnTypeOptical , eJackConnTypeOtherDigital , eJackConnTypeOtherAnalog , eJackConnTypeMultichannelAnalogDIN , eJackConnTypeXlrProfessional , eJackConnTypeRJ11Modem , eJackConnTypeCombination }
enum | PaWasapiJackGeoLocation { eJackGeoLocUnk = 0 , eJackGeoLocRear = 0x1 , eJackGeoLocFront , eJackGeoLocLeft , eJackGeoLocRight , eJackGeoLocTop , eJackGeoLocBottom , eJackGeoLocRearPanel , eJackGeoLocRiser , eJackGeoLocInsideMobileLid , eJackGeoLocDrivebay , eJackGeoLocHDMI , eJackGeoLocOutsideMobileLid , eJackGeoLocATAPI , eJackGeoLocReserved5 , eJackGeoLocReserved6 }
enum | PaWasapiJackGenLocation { eJackGenLocPrimaryBox = 0 , eJackGenLocInternal , eJackGenLocSeparate , eJackGenLocOther }
enum | PaWasapiJackPortConnection { eJackPortConnJack = 0 , eJackPortConnIntegratedDevice , eJackPortConnBothIntegratedAndJack , eJackPortConnUnknown }
enum | PaWasapiThreadPriority { eThreadPriorityNone = 0 , eThreadPriorityAudio , eThreadPriorityCapture , eThreadPriorityDistribution , eThreadPriorityGames , eThreadPriorityPlayback , eThreadPriorityProAudio , eThreadPriorityWindowManager }
enum | PaWasapiStreamCategory { eAudioCategoryOther = 0 , eAudioCategoryCommunications = 3 , eAudioCategoryAlerts = 4 , eAudioCategorySoundEffects = 5 , eAudioCategoryGameEffects = 6 , eAudioCategoryGameMedia = 7 , eAudioCategoryGameChat = 8 , eAudioCategorySpeech = 9 , eAudioCategoryMovie = 10 , eAudioCategoryMedia = 11 }
enum | PaWasapiStreamOption { eStreamOptionNone = 0 , eStreamOptionRaw = 1 , eStreamOptionMatchFormat = 2 }

enum

PaWasapiPassthroughFormat {
ePassthroughFormatPcmIec60958 = 0x00000000 , ePassthroughFormatDolbyDigital = 0x00920000 , ePassthroughFormatMpeg1 = 0x00030cea , ePassthroughFormatMpeg3 = 0x00040cea ,
ePassthroughFormatMpeg2 = 0x00050cea , ePassthroughFormatAac = 0x00060cea , ePassthroughFormatDts = 0x00080cea , ePassthroughFormatDolbyDigitalPlus = 0x000a0cea ,
ePassthroughFormatDolbyDigitalPlusAtmos = 0x010a0cea , ePassthroughFormatDtsHd = 0x000b0cea , ePassthroughFormatDtsXE1 = 0x010b0cea , ePassthroughFormatDtsXE2 = 0x030b0cea ,
ePassthroughFormatDolbyMlp = 0x000c0cea , ePassthroughFormatDolbyMat20 = 0x010c0cea , ePassthroughFormatDolbyMat21 = 0x030c0cea , ePassthroughFormatWmaPro = 0x01640000 ,
ePassthroughFormatAtrac = 0x00080cea , ePassthroughFormatOneBitAudio = 0x00090cea , ePassthroughFormatDst = 0x000d0cea
}

## Functions

PaError | PaWasapi_GetAudioClient (PaStream *pStream, void **pAudioClient, int bOutput)
PaError | PaWasapi_UpdateDeviceList ()
int | PaWasapi_GetDeviceCurrentFormat (PaStream *pStream, void *pFormat, unsigned int formatSize, int bOutput)
int | PaWasapi_GetDeviceDefaultFormat (void *pFormat, unsigned int formatSize, PaDeviceIndex device)
int | PaWasapi_GetDeviceMixFormat (void *pFormat, unsigned int formatSize, PaDeviceIndex device)
int | PaWasapi_GetDeviceRole (PaDeviceIndex device)
PaError | PaWasapi_GetIMMDevice (PaDeviceIndex device, void **pIMMDevice)
int | PaWasapi_IsLoopback (PaDeviceIndex device)
PaError | PaWasapi_ThreadPriorityBoost (void **pTask, PaWasapiThreadPriority priorityClass)
PaError | PaWasapi_ThreadPriorityRevert (void *pTask)
PaError | PaWasapi_GetFramesPerHostBuffer (PaStream *pStream, unsigned int *pInput, unsigned int *pOutput)
PaError | PaWasapi_GetJackCount (PaDeviceIndex device, int *pJackCount)
PaError | PaWasapi_GetJackDescription (PaDeviceIndex device, int jackIndex, PaWasapiJackDescription *pJackDescription)
PaError | PaWasapi_SetStreamStateHandler (PaStream *pStream, PaWasapiStreamStateCallback fnStateHandler, void *pUserData)
PaError | PaWasapiWinrt_SetDefaultDeviceId (const unsigned short *pId, int bOutput)
PaError | PaWasapiWinrt_PopulateDeviceList (const unsigned short **pId, const unsigned short **pName, const PaWasapiDeviceRole *pRole, unsigned int count, int bOutput)

## Detailed Description

WASAPI-specific PortAudio API extension header file.

Definition in file pa_win_wasapi.h.

## Macro Definition Documentation

## paWasapiStreamStateError

#define paWasapiStreamStateError (paWasapiStreamStateError)

Definition at line 128 of file pa_win_wasapi.h.

## paWasapiStreamStateThreadPrepare

#define paWasapiStreamStateThreadPrepare (paWasapiStreamStateThreadPrepare)

Definition at line 129 of file pa_win_wasapi.h.

## paWasapiStreamStateThreadStart

#define paWasapiStreamStateThreadStart (paWasapiStreamStateThreadStart)

Definition at line 130 of file pa_win_wasapi.h.

## paWasapiStreamStateThreadStop

#define paWasapiStreamStateThreadStop (paWasapiStreamStateThreadStop)

Definition at line 131 of file pa_win_wasapi.h.

## paWinWasapiAutoConvert

#define paWinWasapiAutoConvert (paWinWasapiAutoConvert)

Definition at line 99 of file pa_win_wasapi.h.

## paWinWasapiExclusive

#define paWinWasapiExclusive (paWinWasapiExclusive)

Definition at line 93 of file pa_win_wasapi.h.

## paWinWasapiExplicitSampleFormat

#define paWinWasapiExplicitSampleFormat (paWinWasapiExplicitSampleFormat)

Definition at line 98 of file pa_win_wasapi.h.

## paWinWasapiPassthrough

#define paWinWasapiPassthrough (paWinWasapiPassthrough)

Definition at line 100 of file pa_win_wasapi.h.

## paWinWasapiPolling

#define paWinWasapiPolling (paWinWasapiPolling)

Definition at line 96 of file pa_win_wasapi.h.

## paWinWasapiRedirectHostProcessor

#define paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)

Definition at line 94 of file pa_win_wasapi.h.

## paWinWasapiThreadPriority

#define paWinWasapiThreadPriority (paWinWasapiThreadPriority)

Definition at line 97 of file pa_win_wasapi.h.

## paWinWasapiUseChannelMask

#define paWinWasapiUseChannelMask (paWinWasapiUseChannelMask)

Definition at line 95 of file pa_win_wasapi.h.

## Typedef Documentation

## PaWasapiHostProcessorCallback

typedef void(* PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames, void *outputBuffer, long outputFrames, void *userData)

Definition at line 143 of file pa_win_wasapi.h.

## PaWasapiPassthroughFormat

typedef enum PaWasapiPassthroughFormat PaWasapiPassthroughFormat

Passthrough format.

Format ids are obtained from the Microsoft documentation "Representing Formats for IEC 61937 Transmissions" and are composed by such formula where GUID is the guid of passthrough format: GUID.Data1 << 16 | GUID.Data2.

See also
  PaWasapiStreamPassthrough

Version
  Available as of 19.8.0

## PaWasapiStreamCategory

typedef enum PaWasapiStreamCategory PaWasapiStreamCategory

Stream category. Note:

- values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
- supported since Windows 8.0, noop on earlier versions
- values 1,2 are deprecated on Windows 10 and not included into enumeration

Version
  Available as of 19.6.0

## PaWasapiStreamOption

typedef enum PaWasapiStreamOption PaWasapiStreamOption

Stream option. Note:

- values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
- supported since Windows 8.1, noop on earlier versions

Version
  Available as of 19.6.0

## PaWasapiStreamPassthrough

typedef struct PaWasapiStreamPassthrough PaWasapiStreamPassthrough

Passthrough details.

Passthrough details provide direct link to the additional members in WAVEFORMATEXTENSIBLE_IEC61937. Passthrough mode allows to pass encoded data inside the PCM containers to the audio device.

Detailed description about supported formats and examples are provided in Microsoft documentation "Representing Formats for IEC 61937 Transmissions".

See also
  paWinWasapiPassthrough

Version
  Available as of 19.8.0

## PaWasapiStreamStateCallback

typedef void(* PaWasapiStreamStateCallback) (PaStream *pStream, unsigned int stateFlags, unsigned int errorId, void *pUserData)

Definition at line 156 of file pa_win_wasapi.h.

## Enumeration Type Documentation

## PaWasapiDeviceRole

enum PaWasapiDeviceRole

Definition at line 161 of file pa_win_wasapi.h.

## PaWasapiFlags

enum PaWasapiFlags

Definition at line 58 of file pa_win_wasapi.h.

## PaWasapiJackConnectionType

enum PaWasapiJackConnectionType

Definition at line 179 of file pa_win_wasapi.h.

## PaWasapiJackGenLocation

enum PaWasapiJackGenLocation

Definition at line 221 of file pa_win_wasapi.h.

## PaWasapiJackGeoLocation

enum PaWasapiJackGeoLocation

Definition at line 198 of file pa_win_wasapi.h.

## PaWasapiJackPortConnection

enum PaWasapiJackPortConnection

Definition at line 232 of file pa_win_wasapi.h.

## PaWasapiPassthroughFormat

enum PaWasapiPassthroughFormat

Passthrough format.

Format ids are obtained from the Microsoft documentation "Representing Formats for IEC 61937 Transmissions" and are composed by such formula where GUID is the guid of passthrough format: GUID.Data1 << 16 | GUID.Data2.

See also
  PaWasapiStreamPassthrough

Version
  Available as of 19.8.0

Definition at line 320 of file pa_win_wasapi.h.

## PaWasapiStreamCategory

enum PaWasapiStreamCategory

Stream category. Note:

- values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
- supported since Windows 8.0, noop on earlier versions
- values 1,2 are deprecated on Windows 10 and not included into enumeration

Version
  Available as of 19.6.0

Definition at line 279 of file pa_win_wasapi.h.

## PaWasapiStreamOption

enum PaWasapiStreamOption

Stream option. Note:

- values are equal to WASAPI AUDCLNT_STREAMOPTIONS enum
- supported since Windows 8.1, noop on earlier versions

Version
  Available as of 19.6.0

Enumerator
eStreamOptionNone | default
eStreamOptionRaw | bypass WASAPI Audio Engine DSP effects, supported since Windows 8.1
eStreamOptionMatchFormat | force WASAPI Audio Engine into a stream format, supported since Windows 10

Definition at line 302 of file pa_win_wasapi.h.

## PaWasapiStreamState

enum PaWasapiStreamState

Definition at line 108 of file pa_win_wasapi.h.

## PaWasapiThreadPriority

enum PaWasapiThreadPriority

Enumerator
eThreadPriorityAudio | Default for Shared mode.
eThreadPriorityProAudio | Default for Exclusive mode.

Definition at line 243 of file pa_win_wasapi.h.

## Function Documentation

## PaWasapi_GetAudioClient()

PaError PaWasapi_GetAudioClient | ( | PaStream * | pStream,
|  | void ** | pAudioClient,
|  | int | bOutput )

Returns pointer to WASAPI's IAudioClient object of the stream.

Parameters

  pStream | Pointer to PaStream object.
  pAudioClient | Pointer to pointer of IAudioClient.
  bOutput | TRUE (1) for output stream, FALSE (0) for input stream.

Returns
  Error code indicating success or failure.

## PaWasapi_GetDeviceCurrentFormat()

int PaWasapi_GetDeviceCurrentFormat | ( | PaStream * | pStream,
|  | void * | pFormat,
|  | unsigned int | formatSize,
|  | int | bOutput )

Get current audio format of the device assigned to the opened stream.

Format is represented by PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure. Use this function to reconfirm format if PA's processor is overridden and paWinWasapiRedirectHostProcessor flag is specified.

Parameters

  pStream | Pointer to PaStream object.
  pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
  formatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
  bOutput | TRUE (1) for output stream, FALSE (0) for input stream.

Returns
  Non-negative value indicating the number of bytes copied into format descriptor or, a PaErrorCode (which is always negative) if PortAudio is not initialized or an error is encountered.

## PaWasapi_GetDeviceDefaultFormat()

int PaWasapi_GetDeviceDefaultFormat | ( | void * | pFormat,
|  | unsigned int | formatSize,
|  | PaDeviceIndex | device )

Get default audio format for the device in Shared Mode.

Format is represented by PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure and obtained by getting the device property with a PKEY_AudioEngine_DeviceFormat key.

Parameters

  pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
  formatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
  device | Device index.

Returns
  Non-negative value indicating the number of bytes copied into format descriptor or, a PaErrorCode (which is always negative) if PortAudio is not initialized or an error is encountered.

## PaWasapi_GetDeviceMixFormat()

int PaWasapi_GetDeviceMixFormat | ( | void * | pFormat,
|  | unsigned int | formatSize,
|  | PaDeviceIndex | device )

Get mix audio format for the device in Shared Mode.

Format is represented by PaWinWaveFormat or WAVEFORMATEXTENSIBLE structureand obtained by IAudioClient::GetMixFormat.

Parameters

  pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
  formatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
  device | Device index.

Returns
  Non-negative value indicating the number of bytes copied into format descriptor or, a PaErrorCode (which is always negative) if PortAudio is not initialized or an error is encountered.

## PaWasapi_GetDeviceRole()

int PaWasapi_GetDeviceRole | ( | PaDeviceIndex | device | ) |

Get device role (PaWasapiDeviceRole enum).

Parameters

  device | Device index.

Returns
  Non-negative value indicating device role or, a PaErrorCode (which is always negative) if PortAudio is not initialized or an error is encountered.

## PaWasapi_GetFramesPerHostBuffer()

PaError PaWasapi_GetFramesPerHostBuffer | ( | PaStream * | pStream,
|  | unsigned int * | pInput,
|  | unsigned int * | pOutput )

Get number of frames per host buffer.

It is max value of frames of WASAPI buffer which can be locked for operations. Use this method as helper to find out max values of inputFrames/outputFrames of PaWasapiHostProcessorCallback.

Parameters

  pStream | Pointer to PaStream object.
  pInput | Pointer to variable to receive number of input frames. Can be NULL.
  pOutput | Pointer to variable to receive number of output frames. Can be NULL.

Returns
  Error code indicating success or failure.

See also
  PaWasapiHostProcessorCallback

## PaWasapi_GetIMMDevice()

PaError PaWasapi_GetIMMDevice | ( | PaDeviceIndex | device,
|  | void ** | pIMMDevice )

Get device IMMDevice pointer.

Parameters

  device | Device index.
  pAudioClient | Pointer to pointer of IMMDevice.

Returns
  Error code indicating success or failure.

## PaWasapi_GetJackCount()

PaError PaWasapi_GetJackCount | ( | PaDeviceIndex | device,
|  | int * | pJackCount )

Get number of jacks associated with a WASAPI device.

Use this method to determine if there are any jacks associated with the provided WASAPI device. Not all audio devices will support this capability. This is valid for both input and output devices.

Note
  Not available on UWP platform.

Parameters

  device | Device index.
  pJackCount | Pointer to variable to receive number of jacks.

Returns
  Error code indicating success or failure.

See also
  PaWasapi_GetJackDescription

## PaWasapi_GetJackDescription()

PaError PaWasapi_GetJackDescription | ( | PaDeviceIndex | device,
|  | int | jackIndex,
|  | PaWasapiJackDescription * | pJackDescription )

Get the jack description associated with a WASAPI device and jack number.

Before this function is called, use PaWasapi_GetJackCount to determine the number of jacks associated with device. If jcount is greater than zero, then each jack from 0 to jcount can be queried with this function to get the jack description.

Note
  Not available on UWP platform.

Parameters

  device | Device index.
  jackIndex | Jack index.
  pJackDescription | Pointer to PaWasapiJackDescription.

Returns
  Error code indicating success or failure.

See also
  PaWasapi_GetJackCount

## PaWasapi_IsLoopback()

int PaWasapi_IsLoopback | ( | PaDeviceIndex | device | ) |

Get device loopback state:

0 - Not loopback, 1 - Loopback, negative - PaErrorCode.

Parameters

  device | Device index.

Returns
  Non-negative value indicating loopback state or, a PaErrorCode (which is always negative) if PortAudio is not initialized or an error is encountered.

## PaWasapi_SetStreamStateHandler()

PaError PaWasapi_SetStreamStateHandler | ( | PaStream * | pStream,
|  | PaWasapiStreamStateCallback | fnStateHandler,
|  | void * | pUserData )

Set stream state handler.

Parameters

  pStream | Pointer to PaStream object.
  fnStateHandler | Pointer to state handling function.
  pUserData | Pointer to user data.

Returns
  Error code indicating success or failure.

## PaWasapi_ThreadPriorityBoost()

PaError PaWasapi_ThreadPriorityBoost | ( | void ** | pTask,
|  | PaWasapiThreadPriority | priorityClass )

Boost thread priority of calling thread (MMCSS).

Use it for Blocking Interface only inside the thread which makes calls to Pa_WriteStream/Pa_ReadStream.

Parameters

  pTask | Handle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority method to revert thread priority to initial state.
  priorityClass | Id of thread priority of PaWasapiThreadPriority type. Specifying eThreadPriorityNone does nothing.

Returns
  Error code indicating success or failure.

See also
  PaWasapi_RevertThreadPriority

## PaWasapi_ThreadPriorityRevert()

PaError PaWasapi_ThreadPriorityRevert | ( | void * | pTask | ) |

Boost thread priority of calling thread (MMCSS).

Use it for Blocking Interface only inside the thread which makes calls to Pa_WriteStream/Pa_ReadStream.

Parameters

  pTask | Task handle obtained by PaWasapi_BoostThreadPriority method.

Returns
  Error code indicating success or failure.

See also
  PaWasapi_BoostThreadPriority

## PaWasapi_UpdateDeviceList()

PaError PaWasapi_UpdateDeviceList | ( |  | ) |

Update device list.

This function is available if PA_WASAPI_MAX_CONST_DEVICE_COUNT is defined during compile time with maximum constant WASAPI device count (recommended value - 32). If PA_WASAPI_MAX_CONST_DEVICE_COUNT is set to 0 (or not defined) during compile time the implementation will not define PaWasapi_UpdateDeviceList() and thus updating device list can only be possible by calling Pa_Terminate() and then Pa_Initialize().

Returns
  Error code indicating success or failure.

## PaWasapiWinrt_PopulateDeviceList()

PaError PaWasapiWinrt_PopulateDeviceList | ( | const unsigned short ** | pId,
|  | const unsigned short ** | pName,
|  | const PaWasapiDeviceRole * | pRole,
|  | unsigned int | count,
|  | int | bOutput )

Populate the device list.

By default the implementation will rely on DEVINTERFACE_AUDIO_RENDER and DEVINTERFACE_AUDIO_CAPTURE as default devices. If device Id is provided by PaWasapiWinrt_SetDefaultDeviceId() then those device Ids will be used as default and only devices for the device list.

By populating the device list you can provide an additional available audio devices of the system to PA which are obtainable by: Windows::Devices::Enumeration::DeviceInformation::FindAllAsync(selector) where selector is obtainable by Windows::Media::Devices::MediaDevice::GetAudioRenderSelector() or Windows::Media::Devices::MediaDevice::GetAudioCaptureSelector() API.

After the call completes, memory referenced by pointers can be freed, as implementation keeps its own copy.

You must call PaWasapi_UpdateDeviceList() to update the internal device list of the implementation after calling this function.

See an example in the IMPORTANT notes.

Note
  UWP/WinRT platform only.

Parameters

  pId | Array of device Ids, pointer to the array of pointers of 16-bit Unicode string (WCHAR). If NULL and count is also 0 then device Ids will be reset to the default. Required.
  pName | Array of device Names, pointer to the array of pointers of 16-bit Unicode string (WCHAR). Optional.
  pRole | Array of device Roles, see PaWasapiDeviceRole and PaWasapi_GetDeviceRole() for more details. Optional.
  count | Number of devices, the number of array elements (pId, pName, pRole). Maximum count of devices is limited by PA_WASAPI_DEVICE_MAX_COUNT.
  bOutput | TRUE (1) for output (render), FALSE (0) for input (capture).

Returns
  Error code indicating success or failure. Will return paIncompatibleStreamHostApi if library is not compiled for UWP/WinRT platform. If Id is longer than PA_WASAPI_DEVICE_ID_LEN characters paBufferTooBig will be returned. If Name is longer than PA_WASAPI_DEVICE_NAME_LEN characters paBufferTooBig will be returned.

## PaWasapiWinrt_SetDefaultDeviceId()

PaError PaWasapiWinrt_SetDefaultDeviceId | ( | const unsigned short * | pId,
|  | int | bOutput )

Set default device Id.

By default implementation will use the DEVINTERFACE_AUDIO_RENDER and DEVINTERFACE_AUDIO_CAPTURE Ids if device Id is not provided explicitly. These default Ids will not allow to use Exclusive mode on UWP/WinRT platform and thus you must provide device Id explicitly via this API before calling the Pa_OpenStream().

Device Ids on UWP platform are obtainable via: Windows::Media::Devices::MediaDevice::GetDefaultAudioRenderId() or Windows::Media::Devices::MediaDevice::GetDefaultAudioCaptureId() API.

After the call completes, memory referenced by pointers can be freed, as implementation keeps its own copy.

Call this function before calling Pa_IsFormatSupported() when Exclusive mode is requested.

See an example in the IMPORTANT notes.

Note
  UWP/WinRT platform only.

Parameters

  pId | Device Id, pointer to the 16-bit Unicode string (WCHAR). If NULL then device Id will be reset to the default, e.g. DEVINTERFACE_AUDIO_RENDER or DEVINTERFACE_AUDIO_CAPTURE.
  bOutput | TRUE (1) for output (render), FALSE (0) for input (capture).

Returns
  Error code indicating success or failure. Will return paIncompatibleStreamHostApi if library is not compiled for UWP/WinRT platform. If Id is longer than PA_WASAPI_DEVICE_ID_LEN characters paBufferTooBig will be returned.