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 | PaWasapiStreamInfo

## Macros

#define | paWinWasapiExclusive (paWinWasapiExclusive)
#define | paWinWasapiRedirectHostProcessor (paWinWasapiRedirectHostProcessor)
#define | paWinWasapiUseChannelMask (paWinWasapiUseChannelMask)
#define | paWinWasapiPolling (paWinWasapiPolling)
#define | paWinWasapiThreadPriority (paWinWasapiThreadPriority)

## Typedefs

typedef enum PaWasapiFlags | PaWasapiFlags
typedef void(* | PaWasapiHostProcessorCallback) (void *inputBuffer, long inputFrames, void *outputBuffer, long outputFrames, void *userData)
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 struct PaWasapiStreamInfo | PaWasapiStreamInfo

## Enumerations

enum | PaWasapiFlags { paWinWasapiExclusive = (1 << 0), paWinWasapiRedirectHostProcessor = (1 << 1), paWinWasapiUseChannelMask = (1 << 2), paWinWasapiPolling = (1 << 3), paWinWasapiThreadPriority = (1 << 4) }
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 }

## Functions

int | PaWasapi_GetDeviceDefaultFormat (void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice)
int | PaWasapi_GetDeviceRole (PaDeviceIndex nDevice)
PaError | PaWasapi_ThreadPriorityBoost (void **hTask, PaWasapiThreadPriority nPriorityClass)
PaError | PaWasapi_ThreadPriorityRevert (void *hTask)
PaError | PaWasapi_GetFramesPerHostBuffer (PaStream *pStream, unsigned int *nInput, unsigned int *nOutput)
PaError | PaWasapi_GetJackCount (PaDeviceIndex nDevice, int *jcount)
PaError | PaWasapi_GetJackDescription (PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription)

## Detailed Description

WASAPI-specific PortAudio API extension header file.

Definition in file pa_win_wasapi.h.

## Typedef Documentation

## PaWasapiStreamCategory

typedef enum PaWasapiStreamCategory PaWasapiStreamCategory

Stream category. Note:

- values are equal to WASAPI AUDIO_STREAM_CATEGORY enum
- supported since Windows 8.0, noop on earler 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 earler versions

Version
  Available as of 19.6.0

## Enumeration Type Documentation

## PaWasapiStreamCategory

enum PaWasapiStreamCategory

Stream category. Note:

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

Version
  Available as of 19.6.0

Definition at line 213 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 earler 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 236 of file pa_win_wasapi.h.

## PaWasapiThreadPriority

enum PaWasapiThreadPriority

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

Definition at line 177 of file pa_win_wasapi.h.

## Function Documentation

## PaWasapi_GetDeviceDefaultFormat()

int PaWasapi_GetDeviceDefaultFormat | ( | void * | pFormat,
|  | unsigned int | nFormatSize,
|  | PaDeviceIndex | nDevice
| ) |  |

Returns default sound format for device. Format is represented by PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.

Parameters

  pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
  nFormatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
  nDevice | Device index.

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

## PaWasapi_GetDeviceRole()

int PaWasapi_GetDeviceRole | ( | PaDeviceIndex | nDevice | ) |

Returns device role (PaWasapiDeviceRole enum).

Parameters

  nDevice | device index.

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

## PaWasapi_GetFramesPerHostBuffer()

PaError PaWasapi_GetFramesPerHostBuffer | ( | PaStream * | pStream,
|  | unsigned int * | nInput,
|  | unsigned int * | nOutput
| ) |  |

Get number of frames per host buffer. This is maximal value of frames of WASAPI buffer which can be locked for operations. Use this method as helper to findout maximal values of inputFrames/outputFrames of PaWasapiHostProcessorCallback.

Parameters

  pStream | Pointer to PaStream to query.
  nInput | Pointer to variable to receive number of input frames. Can be NULL.
  nOutput | Pointer to variable to receive number of output frames. Can be NULL.

Returns
  Error code indicating success or failure.

See also
  PaWasapiHostProcessorCallback

## PaWasapi_GetJackCount()

PaError PaWasapi_GetJackCount | ( | PaDeviceIndex | nDevice,
|  | int * | jcount
| ) |  |

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.

Parameters

  nDevice | device index.
  jcount | Number of jacks is returned in this variable

Returns
  Error code indicating success or failure

See also
  PaWasapi_GetJackDescription

## PaWasapi_GetJackDescription()

PaError PaWasapi_GetJackDescription | ( | PaDeviceIndex | nDevice,
|  | int | jindex,
|  | 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.

Parameters

  nDevice | device index.
  jindex | Which jack to return information
  KSJACK_DESCRIPTION | This structure filled in on success.

Returns
  Error code indicating success or failure

See also
  PaWasapi_GetJackCount

## PaWasapi_ThreadPriorityBoost()

PaError PaWasapi_ThreadPriorityBoost | ( | void ** | hTask,
|  | PaWasapiThreadPriority | nPriorityClass
| ) |  |

Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread which makes calls to Pa_WriteStream/Pa_ReadStream.

Parameters

  hTask | Handle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority method to revert thread priority to initial state.
  nPriorityClass | 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 * | hTask | ) |

Boost thread priority of calling thread (MMCSS). Use it for Blocking Interface only for thread which makes calls to Pa_WriteStream/Pa_ReadStream.

Parameters

  hTask | Task handle obtained by PaWasapi_BoostThreadPriority method.

Returns
  Error code indicating success or failure.

See also
  PaWasapi_BoostThreadPriority