PortAudio: pa_win_wasapi.h File Reference

PortAudio 2.0

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Enumerations | Functions
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 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 }

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

## Enumeration Type Documentation

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

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.

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.

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

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

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

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

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