PortAudio 2.0
Data Structures | Macros | Typedefs | Enumerations | Functions
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  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.

Macro Definition Documentation

◆ paWinWasapiExclusive

#define paWinWasapiExclusive   (paWinWasapiExclusive)

Definition at line 77 of file pa_win_wasapi.h.

◆ paWinWasapiPolling

#define paWinWasapiPolling   (paWinWasapiPolling)

Definition at line 80 of file pa_win_wasapi.h.

◆ paWinWasapiRedirectHostProcessor

#define paWinWasapiRedirectHostProcessor   (paWinWasapiRedirectHostProcessor)

Definition at line 78 of file pa_win_wasapi.h.

◆ paWinWasapiThreadPriority

#define paWinWasapiThreadPriority   (paWinWasapiThreadPriority)

Definition at line 81 of file pa_win_wasapi.h.

◆ paWinWasapiUseChannelMask

#define paWinWasapiUseChannelMask   (paWinWasapiUseChannelMask)

Definition at line 79 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 90 of file pa_win_wasapi.h.

◆ 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

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

◆ PaWasapiDeviceRole

enum PaWasapiDeviceRole

Definition at line 95 of file pa_win_wasapi.h.

◆ PaWasapiFlags

enum PaWasapiFlags

Definition at line 56 of file pa_win_wasapi.h.

◆ PaWasapiJackConnectionType

enum PaWasapiJackConnectionType

Definition at line 113 of file pa_win_wasapi.h.

◆ PaWasapiJackGenLocation

enum PaWasapiJackGenLocation

Definition at line 155 of file pa_win_wasapi.h.

◆ PaWasapiJackGeoLocation

enum PaWasapiJackGeoLocation

Definition at line 132 of file pa_win_wasapi.h.

◆ PaWasapiJackPortConnection

enum PaWasapiJackPortConnection

Definition at line 166 of file pa_win_wasapi.h.

◆ 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

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

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
pFormatPointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
nFormatSizeSize of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes.
nDeviceDevice 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
nDevicedevice 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
pStreamPointer to PaStream to query.
nInputPointer to variable to receive number of input frames. Can be NULL.
nOutputPointer 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
nDevicedevice index.
jcountNumber 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
nDevicedevice index.
jindexWhich jack to return information
KSJACK_DESCRIPTIONThis 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
hTaskHandle to pointer to priority task. Must be used with PaWasapi_RevertThreadPriority method to revert thread priority to initial state.
nPriorityClassId 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
hTaskTask handle obtained by PaWasapi_BoostThreadPriority method.
Returns
Error code indicating success or failure.
See also
PaWasapi_BoostThreadPriority