PortAudio
2.0
|
WASAPI-specific PortAudio API extension header file. More...
Go to the source code of this file.
Data Structures | |
struct | PaWasapiJackDescription |
struct | PaWasapiStreamInfo |
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 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) } |
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 } |
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_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) |
WASAPI-specific PortAudio API extension header file.
Definition in file pa_win_wasapi.h.
typedef enum PaWasapiStreamCategory PaWasapiStreamCategory |
Stream category. Note:
typedef enum PaWasapiStreamOption PaWasapiStreamOption |
Stream option. Note:
Stream category. Note:
Definition at line 275 of file pa_win_wasapi.h.
enum PaWasapiStreamOption |
Stream option. Note:
Definition at line 298 of file pa_win_wasapi.h.
Enumerator | |
---|---|
eThreadPriorityAudio |
Default for Shared mode. |
eThreadPriorityProAudio |
Default for Exclusive mode. |
Definition at line 239 of file pa_win_wasapi.h.
Returns pointer to WASAPI's IAudioClient object of the stream.
pStream | Pointer to PaStream object. |
pAudioClient | Pointer to pointer of IAudioClient. |
bOutput | TRUE (1) for output stream, FALSE (0) for input stream. |
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 overriden and paWinWasapiRedirectHostProcessor flag is specified.
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. |
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.
pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure. |
formatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes. |
device | Device index. |
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.
pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure. |
formatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes. |
device | Device index. |
int PaWasapi_GetDeviceRole | ( | PaDeviceIndex | device | ) |
Get device role (PaWasapiDeviceRole enum).
device | Device index. |
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 findout max values of inputFrames/outputFrames of PaWasapiHostProcessorCallback.
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. |
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.
device | Device index. |
pJackCount | Pointer to variable to receive number of jacks. |
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.
device | Device index. |
jackIndex | Jack index. |
pJackDescription | Pointer to PaWasapiJackDescription. |
PaError PaWasapi_SetStreamStateHandler | ( | PaStream * | pStream, |
PaWasapiStreamStateCallback | fnStateHandler, | ||
void * | pUserData | ||
) |
Set stream state handler.
pStream | Pointer to PaStream object. |
fnStateHandler | Pointer to state handling function. |
pUserData | Pointer to user data. |
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.
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. |
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.
pTask | Task handle obtained by PaWasapi_BoostThreadPriority method. |
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().
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.
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). |
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.
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). |