PortAudio 2.0
pa_win_wasapi.h File Reference

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.

Macro Definition Documentation

◆ paWasapiStreamStateError

#define paWasapiStreamStateError   (paWasapiStreamStateError)

◆ paWasapiStreamStateThreadPrepare

#define paWasapiStreamStateThreadPrepare   (paWasapiStreamStateThreadPrepare)

Referenced by ProcThreadEvent(), and ProcThreadPoll().

◆ paWasapiStreamStateThreadStart

#define paWasapiStreamStateThreadStart   (paWasapiStreamStateThreadStart)

Referenced by ProcThreadEvent(), and ProcThreadPoll().

◆ paWasapiStreamStateThreadStop

#define paWasapiStreamStateThreadStop   (paWasapiStreamStateThreadStop)

Referenced by ProcThreadEvent(), and ProcThreadPoll().

◆ paWinWasapiAutoConvert

#define paWinWasapiAutoConvert   (paWinWasapiAutoConvert)

◆ paWinWasapiExclusive

#define paWinWasapiExclusive   (paWinWasapiExclusive)

Referenced by main().

◆ paWinWasapiExplicitSampleFormat

#define paWinWasapiExplicitSampleFormat   (paWinWasapiExplicitSampleFormat)

◆ paWinWasapiPassthrough

#define paWinWasapiPassthrough   (paWinWasapiPassthrough)

Referenced by main().

◆ paWinWasapiPolling

#define paWinWasapiPolling   (paWinWasapiPolling)

◆ paWinWasapiRedirectHostProcessor

#define paWinWasapiRedirectHostProcessor   (paWinWasapiRedirectHostProcessor)

◆ paWinWasapiThreadPriority

#define paWinWasapiThreadPriority   (paWinWasapiThreadPriority)

◆ paWinWasapiUseChannelMask

#define paWinWasapiUseChannelMask   (paWinWasapiUseChannelMask)

Referenced by main().

Typedef Documentation

◆ PaWasapiDeviceRole

◆ PaWasapiFlags

◆ PaWasapiHostProcessorCallback

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

◆ PaWasapiJackConnectionType

◆ PaWasapiJackDescription

typedef struct PaWasapiJackDescription PaWasapiJackDescription

◆ PaWasapiJackGenLocation

◆ PaWasapiJackGeoLocation

◆ PaWasapiJackPortConnection

◆ 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

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

◆ PaWasapiStreamInfo

typedef struct PaWasapiStreamInfo PaWasapiStreamInfo

◆ 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

◆ PaWasapiStreamState

◆ PaWasapiStreamStateCallback

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

◆ PaWasapiThreadPriority

Enumeration Type Documentation

◆ PaWasapiDeviceRole

Enumerator
eRoleRemoteNetworkDevice 
eRoleSpeakers 
eRoleLineLevel 
eRoleHeadphones 
eRoleMicrophone 
eRoleHeadset 
eRoleHandset 
eRoleUnknownDigitalPassthrough 
eRoleSPDIF 
eRoleHDMI 
eRoleUnknownFormFactor 

◆ PaWasapiFlags

Enumerator
paWinWasapiExclusive 
paWinWasapiRedirectHostProcessor 
paWinWasapiUseChannelMask 
paWinWasapiPolling 
paWinWasapiThreadPriority 
paWinWasapiExplicitSampleFormat 
paWinWasapiAutoConvert 
paWinWasapiPassthrough 

◆ PaWasapiJackConnectionType

Enumerator
eJackConnTypeUnknown 
eJackConnType3Point5mm 
eJackConnTypeQuarter 
eJackConnTypeAtapiInternal 
eJackConnTypeRCA 
eJackConnTypeOptical 
eJackConnTypeOtherDigital 
eJackConnTypeOtherAnalog 
eJackConnTypeMultichannelAnalogDIN 
eJackConnTypeXlrProfessional 
eJackConnTypeRJ11Modem 
eJackConnTypeCombination 

◆ PaWasapiJackGenLocation

Enumerator
eJackGenLocPrimaryBox 
eJackGenLocInternal 
eJackGenLocSeparate 
eJackGenLocOther 

◆ PaWasapiJackGeoLocation

Enumerator
eJackGeoLocUnk 
eJackGeoLocRear 
eJackGeoLocFront 
eJackGeoLocLeft 
eJackGeoLocRight 
eJackGeoLocTop 
eJackGeoLocBottom 
eJackGeoLocRearPanel 
eJackGeoLocRiser 
eJackGeoLocInsideMobileLid 
eJackGeoLocDrivebay 
eJackGeoLocHDMI 
eJackGeoLocOutsideMobileLid 
eJackGeoLocATAPI 
eJackGeoLocReserved5 
eJackGeoLocReserved6 

◆ PaWasapiJackPortConnection

Enumerator
eJackPortConnJack 
eJackPortConnIntegratedDevice 
eJackPortConnBothIntegratedAndJack 
eJackPortConnUnknown 

◆ 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
Enumerator
ePassthroughFormatPcmIec60958 
ePassthroughFormatDolbyDigital 
ePassthroughFormatMpeg1 
ePassthroughFormatMpeg3 
ePassthroughFormatMpeg2 
ePassthroughFormatAac 
ePassthroughFormatDts 
ePassthroughFormatDolbyDigitalPlus 
ePassthroughFormatDolbyDigitalPlusAtmos 
ePassthroughFormatDtsHd 
ePassthroughFormatDtsXE1 
ePassthroughFormatDtsXE2 
ePassthroughFormatDolbyMlp 
ePassthroughFormatDolbyMat20 
ePassthroughFormatDolbyMat21 
ePassthroughFormatWmaPro 
ePassthroughFormatAtrac 
ePassthroughFormatOneBitAudio 
ePassthroughFormatDst 

◆ 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
Enumerator
eAudioCategoryOther 
eAudioCategoryCommunications 
eAudioCategoryAlerts 
eAudioCategorySoundEffects 
eAudioCategoryGameEffects 
eAudioCategoryGameMedia 
eAudioCategoryGameChat 
eAudioCategorySpeech 
eAudioCategoryMovie 
eAudioCategoryMedia 

◆ 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

◆ PaWasapiStreamState

Enumerator
paWasapiStreamStateError 
paWasapiStreamStateThreadPrepare 
paWasapiStreamStateThreadStart 
paWasapiStreamStateThreadStop 

◆ PaWasapiThreadPriority

Enumerator
eThreadPriorityNone 
eThreadPriorityAudio 

Default for Shared mode.

eThreadPriorityCapture 
eThreadPriorityDistribution 
eThreadPriorityGames 
eThreadPriorityPlayback 
eThreadPriorityProAudio 

Default for Exclusive mode.

eThreadPriorityWindowManager 

Function Documentation

◆ PaWasapi_GetAudioClient()

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

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

Parameters
pStreamPointer to PaStream object.
pAudioClientPointer to pointer of IAudioClient.
bOutputTRUE (1) for output stream, FALSE (0) for input stream.
Returns
Error code indicating success or failure.

References PaWasapiSubStream::clientParent, PaWasapiStream::in, PaWasapiStream::out, paBadStreamPtr, paNoError, paUnanticipatedHostError, and TRUE.

◆ 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
pStreamPointer to PaStream object.
pFormatPointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
formatSizeSize of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
bOutputTRUE (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.

References _WAVEFORMATEXTENSIBLE_UNION::ext, PaWasapiStream::in, PaWasapiStream::out, paBadStreamPtr, TRUE, and PaWasapiSubStream::wavexu.

◆ 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
pFormatPointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
formatSizeSize of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
deviceDevice 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.

References PaWasapiDeviceInfo::DefaultFormat, paBadBufferPtr, paBufferTooSmall, and paNoError.

◆ 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
pFormatPointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
formatSizeSize of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
deviceDevice 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.

References PaWasapiDeviceInfo::MixFormat, paBadBufferPtr, paBufferTooSmall, and paNoError.

◆ PaWasapi_GetDeviceRole()

int PaWasapi_GetDeviceRole ( PaDeviceIndex device)

Get device role (PaWasapiDeviceRole enum).

Parameters
deviceDevice 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.

References PaWasapiDeviceInfo::formFactor, and paNoError.

◆ 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
pStreamPointer to PaStream object.
pInputPointer to variable to receive number of input frames. Can be NULL.
pOutputPointer to variable to receive number of output frames. Can be NULL.
Returns
Error code indicating success or failure.
See also
PaWasapiHostProcessorCallback

References PaWasapiSubStream::framesPerHostCallback, PaWasapiStream::in, PaWasapiStream::out, paBadStreamPtr, and paNoError.

◆ PaWasapi_GetIMMDevice()

PaError PaWasapi_GetIMMDevice ( PaDeviceIndex device,
void ** pIMMDevice )

Get device IMMDevice pointer.

Parameters
deviceDevice index.
pAudioClientPointer to pointer of IMMDevice.
Returns
Error code indicating success or failure.

References PaWasapiDeviceInfo::device, paBadBufferPtr, paIncompatibleStreamHostApi, and paNoError.

◆ 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
deviceDevice index.
pJackCountPointer to variable to receive number of jacks.
Returns
Error code indicating success or failure.
See also
PaWasapi_GetJackDescription

References PaWasapiDeviceInfo::device, IF_FAILED_JUMP, LogHostError, paNoError, paUnanticipatedHostError, and SAFE_RELEASE.

◆ 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
deviceDevice index.
jackIndexJack index.
pJackDescriptionPointer to PaWasapiJackDescription.
Returns
Error code indicating success or failure.
See also
PaWasapi_GetJackCount

References PaWasapiJackDescription::channelMapping, PaWasapiJackDescription::color, PaWasapiJackDescription::connectionType, PaWasapiDeviceInfo::device, PaWasapiJackDescription::genLocation, PaWasapiJackDescription::geoLocation, IF_FAILED_JUMP, PaWasapiJackDescription::isConnected, LogHostError, paNoError, paUnanticipatedHostError, PaWasapiJackDescription::portConnection, and SAFE_RELEASE.

◆ PaWasapi_IsLoopback()

int PaWasapi_IsLoopback ( PaDeviceIndex device)

Get device loopback state:

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

Parameters
deviceDevice 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.

References PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, PaWasapiHostApiRepresentation::inheritedHostApiRep, PaWasapiDeviceInfo::loopBack, paInvalidDevice, paNoError, paNotInitialized, and PaUtil_DeviceIndexToHostApiDeviceIndex().

◆ PaWasapi_SetStreamStateHandler()

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

Set stream state handler.

Parameters
pStreamPointer to PaStream object.
fnStateHandlerPointer to state handling function.
pUserDataPointer to user data.
Returns
Error code indicating success or failure.

References PaWasapiStream::fnStateHandler, paBadStreamPtr, paNoError, and PaWasapiStream::pStateHandlerUserData.

◆ 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
pTaskHandle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority method to revert thread priority to initial state.
priorityClassId of thread priority of PaWasapiThreadPriority type. Specifying eThreadPriorityNone does nothing.
Returns
Error code indicating success or failure.
See also
PaWasapi_RevertThreadPriority

References eThreadPriorityAudio, eThreadPriorityProAudio, FALSE, paNoError, and paUnanticipatedHostError.

Referenced by ProcThreadEvent(), and ProcThreadPoll().

◆ 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
pTaskTask handle obtained by PaWasapi_BoostThreadPriority method.
Returns
Error code indicating success or failure.
See also
PaWasapi_BoostThreadPriority

References FALSE, paNoError, and paUnanticipatedHostError.

◆ 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.

References paInternalError.

◆ 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
pIdArray 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.
pNameArray of device Names, pointer to the array of pointers of 16-bit Unicode string (WCHAR). Optional.
pRoleArray of device Roles, see PaWasapiDeviceRole and PaWasapi_GetDeviceRole() for more details. Optional.
countNumber of devices, the number of array elements (pId, pName, pRole). Maximum count of devices is limited by PA_WASAPI_DEVICE_MAX_COUNT.
bOutputTRUE (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.

References PA_WASAPI_DEVICE_ID_LEN, PA_WASAPI_DEVICE_NAME_LEN, paBufferTooBig, paIncompatibleStreamHostApi, paInsufficientMemory, paNoError, and STATIC_ARRAY_SIZE.

◆ 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
pIdDevice 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.
bOutputTRUE (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.

References PA_WASAPI_DEVICE_ID_LEN, paBufferTooBig, paIncompatibleStreamHostApi, paNoError, and STATIC_ARRAY_SIZE.