WASAPI implementation of support for a host API. More...
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <mmsystem.h>
#include <mmreg.h>
#include <malloc.h>
#include <memory.h>
#include "pa_util.h"
#include "pa_allocation.h"
#include "pa_hostapi.h"
#include "pa_stream.h"
#include "pa_cpuload.h"
#include "pa_process.h"
#include "pa_debugprint.h"
#include "pa_win_wasapi.h"
#include <basetyps.h>
#include <rpcsal.h>
#include <sal.h>
#include <sdkddkver.h>
#include <propkeydef.h>
#include <audioclient.h>
#include <mmdeviceapi.h>
#include <endpointvolume.h>
#include <functiondiscoverykeys.h>
Data Structures | |
struct | _tagpropertykey |
struct | _BYTE_BLOB |
struct | PaWasapiDeviceInfo |
struct | PaWasapiHostApiRepresentation |
struct | PaWasapiSubStream |
struct | PaWasapiHostProcessor |
struct | PaWasapiStream |
Defines | |
#define | WIN32_LEAN_AND_MEAN |
#define | __LPCGUID_DEFINED__ |
#define | PROPERTYKEY_DEFINED |
#define | __MIDL_CONST const |
#define | WAVE_FORMAT_IEEE_FLOAT 0x0003 |
#define | SPEAKER_FRONT_LEFT 0x1 |
#define | SPEAKER_FRONT_RIGHT 0x2 |
#define | SPEAKER_FRONT_CENTER 0x4 |
#define | SPEAKER_LOW_FREQUENCY 0x8 |
#define | SPEAKER_BACK_LEFT 0x10 |
#define | SPEAKER_BACK_RIGHT 0x20 |
#define | SPEAKER_FRONT_LEFT_OF_CENTER 0x40 |
#define | SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 |
#define | SPEAKER_BACK_CENTER 0x100 |
#define | SPEAKER_SIDE_LEFT 0x200 |
#define | SPEAKER_SIDE_RIGHT 0x400 |
#define | SPEAKER_TOP_CENTER 0x800 |
#define | SPEAKER_TOP_FRONT_LEFT 0x1000 |
#define | SPEAKER_TOP_FRONT_CENTER 0x2000 |
#define | SPEAKER_TOP_FRONT_RIGHT 0x4000 |
#define | SPEAKER_TOP_BACK_LEFT 0x8000 |
#define | SPEAKER_TOP_BACK_CENTER 0x10000 |
#define | SPEAKER_TOP_BACK_RIGHT 0x20000 |
#define | SPEAKER_RESERVED 0x7FFC0000 |
#define | SPEAKER_ALL 0x80000000 |
#define | KSAUDIO_SPEAKER_DIRECTOUT 0 |
#define | KSAUDIO_SPEAKER_MONO (SPEAKER_FRONT_CENTER) |
#define | KSAUDIO_SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) |
#define | KSAUDIO_SPEAKER_QUAD |
#define | KSAUDIO_SPEAKER_SURROUND |
#define | KSAUDIO_SPEAKER_5POINT1 |
#define | KSAUDIO_SPEAKER_7POINT1 |
#define | KSAUDIO_SPEAKER_5POINT1_SURROUND |
#define | KSAUDIO_SPEAKER_7POINT1_SURROUND |
#define | KSAUDIO_SPEAKER_5POINT1_BACK KSAUDIO_SPEAKER_5POINT1 |
#define | KSAUDIO_SPEAKER_7POINT1_WIDE KSAUDIO_SPEAKER_7POINT1 |
#define | KSAUDIO_SPEAKER_GROUND_FRONT_LEFT SPEAKER_FRONT_LEFT |
#define | KSAUDIO_SPEAKER_GROUND_FRONT_CENTER SPEAKER_FRONT_CENTER |
#define | KSAUDIO_SPEAKER_GROUND_FRONT_RIGHT SPEAKER_FRONT_RIGHT |
#define | KSAUDIO_SPEAKER_GROUND_REAR_LEFT SPEAKER_BACK_LEFT |
#define | KSAUDIO_SPEAKER_GROUND_REAR_RIGHT SPEAKER_BACK_RIGHT |
#define | KSAUDIO_SPEAKER_TOP_MIDDLE SPEAKER_TOP_CENTER |
#define | KSAUDIO_SPEAKER_SUPER_WOOFER SPEAKER_LOW_FREQUENCY |
#define | NONAMELESSUNION |
#define | COBJMACROS |
#define | INITGUID |
#define | GUID_SECT |
#define | __DEFINE_GUID(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) static const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
#define | __DEFINE_IID(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) static const IID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
#define | __DEFINE_CLSID(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) static const CLSID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
#define | PA_DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) __DEFINE_CLSID(pa_CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) |
#define | PA_DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) __DEFINE_IID(pa_IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) |
#define | CREATE_THREAD(PROC) (HANDLE)_beginthreadex( NULL, 0, (PROC), stream, 0, &stream->dwThreadId ) |
#define | PA_THREAD_FUNC static unsigned WINAPI |
#define | PA_THREAD_ID unsigned |
#define | AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x018) |
#define | AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x019) |
#define | AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x020) |
#define | MAX_STR_LEN 512 |
#define | STATIC_ARRAY_SIZE(array) (sizeof(array)/sizeof(array[0])) |
#define | PRINT(x) PA_DEBUG(x); |
#define | PA_SKELETON_SET_LAST_HOST_ERROR(errorCode, errorText) PaUtil_SetLastHostErrorInfo( paWASAPI, errorCode, errorText ) |
#define | PA_WASAPI__IS_FULLDUPLEX(STREAM) ((STREAM)->in.client && (STREAM)->out.client) |
#define | IF_FAILED_JUMP(hr, label) if(FAILED(hr)) goto label; |
#define | SAFE_CLOSE(h) if ((h) != NULL) { CloseHandle((h)); (h) = NULL; } |
#define | SAFE_RELEASE(punk) if ((punk) != NULL) { (punk)->lpVtbl->Release((punk)); (punk) = NULL; } |
#define | _GetProc(fun, type, name) |
#define | LogHostError(HRES) __LogHostError(HRES, __FUNCTION__, __FILE__, __LINE__) |
#define | LogPaError(PAERR) __LogPaError(PAERR, __FUNCTION__, __FILE__, __LINE__) |
#define | HDA_PACKET_SIZE (128) |
#define | REFTIMES_PER_SEC 10000000 |
#define | REFTIMES_PER_MILLISEC 10000 |
#define | WINDOWS_7_SERVER2008R2_AND_UP (WINDOWS_7_SERVER2008R2|WINDOWS_FUTURE) |
#define | _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2(TYPE) |
#define | _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1(TYPE) |
#define | __DIV_8(v) ((v) >> 3) |
#define | __DIV_8(v) ((v) >> 3) |
#define | __DIV_8(v) ((v) >> 3) |
#define | __DIV_8(v) ((v) >> 3) |
Typedefs | |
typedef enum _AVRT_PRIORITY | AVRT_PRIORITY |
typedef enum _AVRT_PRIORITY * | PAVRT_PRIORITY |
typedef const GUID * | LPCGUID |
typedef struct _tagpropertykey | PROPERTYKEY |
typedef struct _BYTE_BLOB | BYTE_BLOB |
typedef __RPC_unique_pointer BYTE_BLOB * | UP_BYTE_BLOB |
typedef LONGLONG | REFERENCE_TIME |
typedef void(* | MixMonoToStereoF )(void *__to, void *__from, UINT32 count) |
typedef GUID | PLARGE_INTEGER |
typedef BOOL(WINAPI * | FAvRevertMmThreadCharacteristics )(HANDLE) |
typedef struct PaWasapiDeviceInfo | PaWasapiDeviceInfo |
typedef struct PaWasapiSubStream | PaWasapiSubStream |
typedef struct PaWasapiHostProcessor | PaWasapiHostProcessor |
typedef struct PaWasapiStream | PaWasapiStream |
typedef UINT32(* | ALIGN_FUNC )(UINT32 v, UINT32 align) |
typedef enum EWindowsVersion | EWindowsVersion |
typedef enum EMixerDir | EMixerDir |
Enumerations | |
enum | _AVRT_PRIORITY { AVRT_PRIORITY_LOW = -1, AVRT_PRIORITY_NORMAL, AVRT_PRIORITY_HIGH, AVRT_PRIORITY_CRITICAL } |
enum | { S_INPUT = 0, S_OUTPUT = 1, S_COUNT = 2, S_FULLDUPLEX = 0 } |
enum | EWindowsVersion { WINDOWS_UNKNOWN = 0, WINDOWS_VISTA_SERVER2008 = (1 << 0), WINDOWS_7_SERVER2008R2 = (1 << 1), WINDOWS_FUTURE = (1 << 2) } |
enum | EMixerDir { MIX_DIR__1TO2, MIX_DIR__2TO1 } |
Functions | |
PA_DEFINE_IID (IAudioClient, 1cb9ad4c, dbfa, 4c32, b1, 78, c2, f5, 68, a7, 03, b2) | |
PA_DEFINE_IID (IMMEndpoint, 1be09788, 6894, 4089, 85, 86, 9a, 2a, 6c, 26, 5a, c5) | |
PA_DEFINE_IID (IMMDeviceEnumerator, a95664d2, 9614, 4f35, a7, 46, de, 8d, b6, 36, 17, e6) | |
PA_DEFINE_CLSID (IMMDeviceEnumerator, bcde0395, e52f, 467c, 8e, 3d, c4, 57, 92, 91, 69, 2e) | |
PA_DEFINE_IID (IAudioRenderClient, f294acfc, 3146, 4483, a7, bf, ad, dc, a7, c2, 60, e2) | |
PA_DEFINE_IID (IAudioCaptureClient, c8adbd64, e71e, 48a0, a4, de, 18, 5c, 39, 5c, d3, 17) | |
PA_DEFINE_IID (IDeviceTopology, 2A07407E, 6497, 4A18, 97, 87, 32, f7, 9b, d0, d9, 8f) | |
PA_DEFINE_IID (IPart, AE2DE0E4, 5BCA, 4F2D, aa, 46, 5d, 13, f8, fd, b3, a9) | |
PA_DEFINE_IID (IKsJackDescription, 4509F757, 2D46, 4637, 8e, 62, ce, 7d, b9, 44, f5, 7b) | |
__DEFINE_GUID (pa_KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71) | |
__DEFINE_GUID (pa_KSDATAFORMAT_SUBTYPE_ADPCM, 0x00000002, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71) | |
__DEFINE_GUID (pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71) | |
PA_THREAD_FUNC | ProcThreadEvent (void *param) |
PA_THREAD_FUNC | ProcThreadPoll (void *param) |
typedef | BOOL (WINAPI *FAvRtCreateThreadOrderingGroup)(PHANDLE |
typedef | HANDLE (WINAPI *FAvSetMmThreadCharacteristics)(LPCTSTR |
PaError | PaWasapi_Initialize (PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index) |
int | PaWasapi_GetDeviceDefaultFormat (void *pFormat, unsigned int nFormatSize, PaDeviceIndex nDevice) |
int | PaWasapi_GetDeviceRole (PaDeviceIndex nDevice) |
PaError | PaWasapi_GetFramesPerHostBuffer (PaStream *pStream, unsigned int *nInput, unsigned int *nOutput) |
HANDLE | MMCSS_activate (const char *name) |
void | MMCSS_deactivate (HANDLE hTask) |
PaError | PaWasapi_ThreadPriorityBoost (void **hTask, PaWasapiThreadPriority nPriorityClass) |
PaError | PaWasapi_ThreadPriorityRevert (void *hTask) |
PaError | PaWasapi_GetJackCount (PaDeviceIndex nDevice, int *jcount) |
PaError | PaWasapi_GetJackDescription (PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription) |
Variables | |
typedef | LPDWORD |
FAvRtCreateThreadOrderingGroup | pAvRtCreateThreadOrderingGroup = NULL |
FAvRtDeleteThreadOrderingGroup | pAvRtDeleteThreadOrderingGroup = NULL |
FAvRtWaitOnThreadOrderingGroup | pAvRtWaitOnThreadOrderingGroup = NULL |
FAvSetMmThreadCharacteristics | pAvSetMmThreadCharacteristics = NULL |
FAvRevertMmThreadCharacteristics | pAvRevertMmThreadCharacteristics = NULL |
FAvSetMmThreadPriority | pAvSetMmThreadPriority = NULL |
WASAPI implementation of support for a host API.
#define __DEFINE_CLSID | ( | n, | ||
l, | ||||
w1, | ||||
w2, | ||||
b1, | ||||
b2, | ||||
b3, | ||||
b4, | ||||
b5, | ||||
b6, | ||||
b7, | ||||
b8 | ||||
) | static const CLSID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
#define __DEFINE_GUID | ( | n, | ||
l, | ||||
w1, | ||||
w2, | ||||
b1, | ||||
b2, | ||||
b3, | ||||
b4, | ||||
b5, | ||||
b6, | ||||
b7, | ||||
b8 | ||||
) | static const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
#define __DEFINE_IID | ( | n, | ||
l, | ||||
w1, | ||||
w2, | ||||
b1, | ||||
b2, | ||||
b3, | ||||
b4, | ||||
b5, | ||||
b6, | ||||
b7, | ||||
b8 | ||||
) | static const IID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
#define __DIV_8 | ( | v | ) | ((v) >> 3) |
Referenced by ProcThreadPoll().
#define __DIV_8 | ( | v | ) | ((v) >> 3) |
#define __DIV_8 | ( | v | ) | ((v) >> 3) |
#define __DIV_8 | ( | v | ) | ((v) >> 3) |
#define __LPCGUID_DEFINED__ |
#define __MIDL_CONST const |
#define _GetProc | ( | fun, | ||
type, | ||||
name | ||||
) |
{ \ fun = (type) GetProcAddress(hDInputDLL,name); \ if (fun == NULL) { \ PRINT(("GetProcAddr failed for %s" ,name)); \ return FALSE; \ } \ } \
#define _WASAPI_MONO_TO_STEREO_MIXER_1_TO_2 | ( | TYPE | ) |
TYPE * __restrict to = __to;\
TYPE * __restrict from = __from;\
TYPE * __restrict end = from + count;\
while (from != end)\
{\
*to ++ = *from;\
*to ++ = *from;\
++ from;\
}
#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1 | ( | TYPE | ) |
TYPE * __restrict to = (TYPE *)__to;\ TYPE * __restrict from = (TYPE *)__from;\ TYPE * __restrict end = to + count;\ while (to != end)\ {\ *to ++ = (TYPE)((float)(from[0] + from[1]) * 0.5f);\ from += 2;\ }
#define AUDCLNT_E_BUFFER_ERROR AUDCLNT_ERR(0x018) |
#define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x019) |
#define AUDCLNT_E_INVALID_DEVICE_PERIOD AUDCLNT_ERR(0x020) |
#define COBJMACROS |
#define CREATE_THREAD | ( | PROC | ) | (HANDLE)_beginthreadex( NULL, 0, (PROC), stream, 0, &stream->dwThreadId ) |
#define GUID_SECT |
#define HDA_PACKET_SIZE (128) |
#define IF_FAILED_JUMP | ( | hr, | ||
label | ||||
) | if(FAILED(hr)) goto label; |
Referenced by PaWasapi_GetJackCount(), PaWasapi_GetJackDescription(), and PaWasapi_Initialize().
#define INITGUID |
#define KSAUDIO_SPEAKER_5POINT1 |
(SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \ SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \ SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
#define KSAUDIO_SPEAKER_5POINT1_BACK KSAUDIO_SPEAKER_5POINT1 |
#define KSAUDIO_SPEAKER_5POINT1_SURROUND |
(SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \ SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \ SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
#define KSAUDIO_SPEAKER_7POINT1 |
(SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \ SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \ SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | \ SPEAKER_FRONT_LEFT_OF_CENTER | SPEAKER_FRONT_RIGHT_OF_CENTER)
#define KSAUDIO_SPEAKER_7POINT1_SURROUND |
(SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \ SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY | \ SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT | \ SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT)
#define KSAUDIO_SPEAKER_7POINT1_WIDE KSAUDIO_SPEAKER_7POINT1 |
#define KSAUDIO_SPEAKER_DIRECTOUT 0 |
#define KSAUDIO_SPEAKER_GROUND_FRONT_CENTER SPEAKER_FRONT_CENTER |
#define KSAUDIO_SPEAKER_GROUND_FRONT_LEFT SPEAKER_FRONT_LEFT |
#define KSAUDIO_SPEAKER_GROUND_FRONT_RIGHT SPEAKER_FRONT_RIGHT |
#define KSAUDIO_SPEAKER_GROUND_REAR_LEFT SPEAKER_BACK_LEFT |
#define KSAUDIO_SPEAKER_GROUND_REAR_RIGHT SPEAKER_BACK_RIGHT |
#define KSAUDIO_SPEAKER_MONO (SPEAKER_FRONT_CENTER) |
#define KSAUDIO_SPEAKER_QUAD |
(SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \ SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT)
#define KSAUDIO_SPEAKER_STEREO (SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT) |
#define KSAUDIO_SPEAKER_SUPER_WOOFER SPEAKER_LOW_FREQUENCY |
#define KSAUDIO_SPEAKER_SURROUND |
(SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT | \ SPEAKER_FRONT_CENTER | SPEAKER_BACK_CENTER)
#define KSAUDIO_SPEAKER_TOP_MIDDLE SPEAKER_TOP_CENTER |
#define LogHostError | ( | HRES | ) | __LogHostError(HRES, __FUNCTION__, __FILE__, __LINE__) |
Referenced by PaWasapi_GetJackCount(), PaWasapi_GetJackDescription(), PaWasapi_Initialize(), ProcThreadEvent(), and ProcThreadPoll().
#define LogPaError | ( | PAERR | ) | __LogPaError(PAERR, __FUNCTION__, __FILE__, __LINE__) |
Referenced by ProcThreadPoll().
#define MAX_STR_LEN 512 |
Referenced by PaWasapi_Initialize().
#define NONAMELESSUNION |
#define PA_DEFINE_CLSID | ( | className, | ||
l, | ||||
w1, | ||||
w2, | ||||
b1, | ||||
b2, | ||||
b3, | ||||
b4, | ||||
b5, | ||||
b6, | ||||
b7, | ||||
b8 | ||||
) | __DEFINE_CLSID(pa_CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) |
#define PA_DEFINE_IID | ( | interfaceName, | ||
l, | ||||
w1, | ||||
w2, | ||||
b1, | ||||
b2, | ||||
b3, | ||||
b4, | ||||
b5, | ||||
b6, | ||||
b7, | ||||
b8 | ||||
) | __DEFINE_IID(pa_IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) |
#define PA_SKELETON_SET_LAST_HOST_ERROR | ( | errorCode, | ||
errorText | ||||
) | PaUtil_SetLastHostErrorInfo( paWASAPI, errorCode, errorText ) |
#define PA_THREAD_FUNC static unsigned WINAPI |
#define PA_THREAD_ID unsigned |
#define PA_WASAPI__IS_FULLDUPLEX | ( | STREAM | ) | ((STREAM)->in.client && (STREAM)->out.client) |
Referenced by ProcThreadPoll().
#define PRINT | ( | x | ) | PA_DEBUG(x); |
Referenced by MMCSS_activate(), MMCSS_deactivate(), PaWasapi_Initialize(), and ProcThreadEvent().
#define PROPERTYKEY_DEFINED |
#define REFTIMES_PER_MILLISEC 10000 |
#define REFTIMES_PER_SEC 10000000 |
#define SAFE_CLOSE | ( | h | ) | if ((h) != NULL) { CloseHandle((h)); (h) = NULL; } |
#define SAFE_RELEASE | ( | punk | ) | if ((punk) != NULL) { (punk)->lpVtbl->Release((punk)); (punk) = NULL; } |
Referenced by PaWasapi_GetJackCount(), PaWasapi_GetJackDescription(), and PaWasapi_Initialize().
#define SPEAKER_ALL 0x80000000 |
#define SPEAKER_BACK_CENTER 0x100 |
#define SPEAKER_BACK_LEFT 0x10 |
#define SPEAKER_BACK_RIGHT 0x20 |
#define SPEAKER_FRONT_CENTER 0x4 |
#define SPEAKER_FRONT_LEFT 0x1 |
#define SPEAKER_FRONT_LEFT_OF_CENTER 0x40 |
#define SPEAKER_FRONT_RIGHT 0x2 |
#define SPEAKER_FRONT_RIGHT_OF_CENTER 0x80 |
#define SPEAKER_LOW_FREQUENCY 0x8 |
#define SPEAKER_RESERVED 0x7FFC0000 |
#define SPEAKER_SIDE_LEFT 0x200 |
#define SPEAKER_SIDE_RIGHT 0x400 |
#define SPEAKER_TOP_BACK_CENTER 0x10000 |
#define SPEAKER_TOP_BACK_LEFT 0x8000 |
#define SPEAKER_TOP_BACK_RIGHT 0x20000 |
#define SPEAKER_TOP_CENTER 0x800 |
#define SPEAKER_TOP_FRONT_CENTER 0x2000 |
#define SPEAKER_TOP_FRONT_LEFT 0x1000 |
#define SPEAKER_TOP_FRONT_RIGHT 0x4000 |
#define STATIC_ARRAY_SIZE | ( | array | ) | (sizeof(array)/sizeof(array[0])) |
Referenced by PaWasapi_ThreadPriorityBoost().
#define WAVE_FORMAT_IEEE_FLOAT 0x0003 |
#define WIN32_LEAN_AND_MEAN |
#define WINDOWS_7_SERVER2008R2_AND_UP (WINDOWS_7_SERVER2008R2|WINDOWS_FUTURE) |
typedef UINT32(* ALIGN_FUNC)(UINT32 v, UINT32 align) |
typedef AVRT_PRIORITY |
typedef struct _BYTE_BLOB BYTE_BLOB |
typedef enum EWindowsVersion EWindowsVersion |
typedef BOOL(WINAPI * FAvRevertMmThreadCharacteristics)(HANDLE) |
typedef const GUID* LPCGUID |
typedef void(* MixMonoToStereoF)(void *__to, void *__from, UINT32 count) |
typedef enum _AVRT_PRIORITY * PAVRT_PRIORITY |
typedef struct PaWasapiDeviceInfo PaWasapiDeviceInfo |
typedef struct PaWasapiHostProcessor PaWasapiHostProcessor |
typedef struct PaWasapiStream PaWasapiStream |
typedef struct PaWasapiSubStream PaWasapiSubStream |
typedef PLARGE_INTEGER |
typedef struct _tagpropertykey PROPERTYKEY |
typedef LONGLONG REFERENCE_TIME |
typedef __RPC_unique_pointer BYTE_BLOB* UP_BYTE_BLOB |
enum _AVRT_PRIORITY |
enum EMixerDir |
enum EWindowsVersion |
__DEFINE_GUID | ( | pa_KSDATAFORMAT_SUBTYPE_PCM | , | |
0x00000001 | , | |||
0x0000 | , | |||
0x0010 | , | |||
0x80 | , | |||
0x00 | , | |||
0x00 | , | |||
0xaa | , | |||
0x00 | , | |||
0x38 | , | |||
0x9b | , | |||
0x71 | ||||
) |
__DEFINE_GUID | ( | pa_KSDATAFORMAT_SUBTYPE_ADPCM | , | |
0x00000002 | , | |||
0x0000 | , | |||
0x0010 | , | |||
0x80 | , | |||
0x00 | , | |||
0x00 | , | |||
0xaa | , | |||
0x00 | , | |||
0x38 | , | |||
0x9b | , | |||
0x71 | ||||
) |
__DEFINE_GUID | ( | pa_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT | , | |
0x00000003 | , | |||
0x0000 | , | |||
0x0010 | , | |||
0x80 | , | |||
0x00 | , | |||
0x00 | , | |||
0xaa | , | |||
0x00 | , | |||
0x38 | , | |||
0x9b | , | |||
0x71 | ||||
) |
typedef BOOL | ( | WINAPI * | FAvRtCreateThreadOrderingGroup | ) |
Referenced by ProcThreadEvent().
typedef HANDLE | ( | WINAPI * | FAvSetMmThreadCharacteristics | ) |
Referenced by PaWin_WDMKS_QueryFilterMaximumChannelCount(), and ProcessingThreadProc().
HANDLE MMCSS_activate | ( | const char * | name | ) |
References pAvSetMmThreadCharacteristics, and PRINT.
Referenced by PaWasapi_ThreadPriorityBoost().
void MMCSS_deactivate | ( | HANDLE | hTask | ) |
References FALSE, pAvRevertMmThreadCharacteristics, and PRINT.
Referenced by PaWasapi_ThreadPriorityRevert().
PA_DEFINE_CLSID | ( | IMMDeviceEnumerator | , | |
bcde0395 | , | |||
e52f | , | |||
467c | , | |||
8e | , | |||
3d | , | |||
c4 | , | |||
57 | , | |||
92 | , | |||
91 | , | |||
69 | , | |||
2e | ||||
) |
PA_DEFINE_IID | ( | IPart | , | |
AE2DE0E4 | , | |||
5BCA | , | |||
4F2D | , | |||
aa | , | |||
46 | , | |||
5d | , | |||
13 | , | |||
f8 | , | |||
fd | , | |||
b3 | , | |||
a9 | ||||
) |
PA_DEFINE_IID | ( | IMMEndpoint | , | |
1be09788 | , | |||
6894 | , | |||
4089 | , | |||
85 | , | |||
86 | , | |||
9a | , | |||
2a | , | |||
6c | , | |||
26 | , | |||
5a | , | |||
c5 | ||||
) |
PA_DEFINE_IID | ( | IKsJackDescription | , | |
4509F757 | , | |||
2D46 | , | |||
4637 | , | |||
8e | , | |||
62 | , | |||
ce | , | |||
7d | , | |||
b9 | , | |||
44 | , | |||
f5 | , | |||
7b | ||||
) |
PA_DEFINE_IID | ( | IAudioRenderClient | , | |
f294acfc | , | |||
3146 | , | |||
4483 | , | |||
a7 | , | |||
bf | , | |||
ad | , | |||
dc | , | |||
a7 | , | |||
c2 | , | |||
60 | , | |||
e2 | ||||
) |
PA_DEFINE_IID | ( | IAudioClient | , | |
1cb9ad4c | , | |||
dbfa | , | |||
4c32 | , | |||
b1 | , | |||
78 | , | |||
c2 | , | |||
f5 | , | |||
68 | , | |||
a7 | , | |||
03 | , | |||
b2 | ||||
) |
PA_DEFINE_IID | ( | IAudioCaptureClient | , | |
c8adbd64 | , | |||
e71e | , | |||
48a0 | , | |||
a4 | , | |||
de | , | |||
18 | , | |||
5c | , | |||
39 | , | |||
5c | , | |||
d3 | , | |||
17 | ||||
) |
PA_DEFINE_IID | ( | IMMDeviceEnumerator | , | |
a95664d2 | , | |||
9614 | , | |||
4f35 | , | |||
a7 | , | |||
46 | , | |||
de | , | |||
8d | , | |||
b6 | , | |||
36 | , | |||
17 | , | |||
e6 | ||||
) |
PA_DEFINE_IID | ( | IDeviceTopology | , | |
2A07407E | , | |||
6497 | , | |||
4A18 | , | |||
97 | , | |||
87 | , | |||
32 | , | |||
f7 | , | |||
9b | , | |||
d0 | , | |||
d9 | , | |||
8f | ||||
) |
int PaWasapi_GetDeviceDefaultFormat | ( | void * | pFormat, | |
unsigned int | nFormatSize, | |||
PaDeviceIndex | nDevice | |||
) |
Returns default sound format for device. Format is represented by PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure.
pFormat | Pointer to PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure. | |
nFormatSize | Size of PaWinWaveFormat or WAVEFORMATEXTENSIBLE structure in bytes. | |
nDevice | Device index. |
References PaWasapiDeviceInfo::DefaultFormat, PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, PaWasapiHostApiRepresentation::inheritedHostApiRep, paNoError, and PaUtil_DeviceIndexToHostApiDeviceIndex().
int PaWasapi_GetDeviceRole | ( | PaDeviceIndex | nDevice | ) |
Returns device role (PaWasapiDeviceRole enum).
nDevice | device index. |
References PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, PaWasapiDeviceInfo::formFactor, PaWasapiHostApiRepresentation::inheritedHostApiRep, paNoError, and PaUtil_DeviceIndexToHostApiDeviceIndex().
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.
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. |
References PaWasapiSubStream::framesPerHostCallback, PaWasapiStream::in, and PaWasapiStream::out.
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.
nDevice | device index. | |
jcount | Number of jacks is returned in this variable |
References PaWasapiDeviceInfo::device, PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, IF_FAILED_JUMP, PaWasapiHostApiRepresentation::inheritedHostApiRep, LogHostError, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), and SAFE_RELEASE.
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.
nDevice | device index. | |
jindex | Which jack to return information | |
KSJACK_DESCRIPTION | This structure filled in on success. |
References __MIDL___MIDL_itf_devicetopology_0000_0000_0010::ChannelMapping, PaWasapiJackDescription::channelMapping, __MIDL___MIDL_itf_devicetopology_0000_0000_0010::Color, PaWasapiJackDescription::color, __MIDL___MIDL_itf_devicetopology_0000_0000_0010::ConnectionType, PaWasapiJackDescription::connectionType, PaWasapiDeviceInfo::device, PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, __MIDL___MIDL_itf_devicetopology_0000_0000_0010::GenLocation, PaWasapiJackDescription::genLocation, __MIDL___MIDL_itf_devicetopology_0000_0000_0010::GeoLocation, PaWasapiJackDescription::geoLocation, IF_FAILED_JUMP, PaWasapiHostApiRepresentation::inheritedHostApiRep, __MIDL___MIDL_itf_devicetopology_0000_0000_0010::IsConnected, PaWasapiJackDescription::isConnected, LogHostError, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), __MIDL___MIDL_itf_devicetopology_0000_0000_0010::PortConnection, PaWasapiJackDescription::portConnection, and SAFE_RELEASE.
PaError PaWasapi_Initialize | ( | PaUtilHostApiRepresentation ** | hostApi, | |
PaHostApiIndex | index | |||
) |
References PaWasapiHostApiRepresentation::allocations, PaWasapiHostApiRepresentation::blockingStreamInterface, PaWasapiHostApiRepresentation::callbackStreamInterface, PaWasapiHostApiRepresentation::defaultCapturer, PaWasapiDeviceInfo::DefaultDevicePeriod, PaWasapiDeviceInfo::DefaultFormat, PaDeviceInfo::defaultHighInputLatency, PaDeviceInfo::defaultHighOutputLatency, PaDeviceInfo::defaultLowInputLatency, PaDeviceInfo::defaultLowOutputLatency, PaWasapiHostApiRepresentation::defaultRenderer, PaDeviceInfo::defaultSampleRate, PaWasapiDeviceInfo::device, DEVICE_STATE_ACTIVE, PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, E_NOTFOUND, eAll, eCapture, eMultimedia, PaWasapiHostApiRepresentation::enumerator, eRender, PaWasapiDeviceInfo::flow, PaWasapiDeviceInfo::formFactor, GetStreamReadAvailable(), GetStreamWriteAvailable(), PaDeviceInfo::hostApi, IF_FAILED_JUMP, PaUtilHostApiRepresentation::info, PaWasapiHostApiRepresentation::inheritedHostApiRep, LogHostError, MAX_STR_LEN, PaDeviceInfo::maxInputChannels, PaDeviceInfo::maxOutputChannels, PaWasapiDeviceInfo::MinimumDevicePeriod, PaDeviceInfo::name, PA_DEBUG, Pa_GetErrorText(), PaUtil_AllocateMemory(), PaUtil_CreateAllocationGroup(), PaUtil_DummyGetCpuLoad(), PaUtil_DummyGetReadAvailable(), PaUtil_DummyGetWriteAvailable(), PaUtil_DummyRead(), PaUtil_DummyWrite(), PaUtil_GroupAllocateMemory(), PaUtil_InitializeStreamInterface(), PRINT, PropVariantClear(), PropVariantInit, ReadStream(), SAFE_RELEASE, PaWasapiDeviceInfo::state, PaDeviceInfo::structVersion, PaHostApiInfo::structVersion, PaWasapiDeviceInfo::szDeviceID, PaWasapiHostApiRepresentation::useWOW64Workaround, and WriteStream().
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.
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. |
References MMCSS_activate(), and STATIC_ARRAY_SIZE.
Referenced by ProcThreadEvent(), and ProcThreadPoll().
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.
hTask | Task handle obtained by PaWasapi_BoostThreadPriority method. |
References MMCSS_deactivate().
PA_THREAD_FUNC ProcThreadEvent | ( | void * | param | ) |
References AUDCLNT_SHAREMODE_EXCLUSIVE, BOOL(), PaWasapiStream::cclient, PaWasapiSubStream::client, PaWasapiStream::event, FALSE, PaWasapiSubStream::framesPerBuffer, PaWasapiStream::hAvTask, PaWasapiStream::hCloseRequest, PaWasapiStream::hostProcessOverrideInput, PaWasapiStream::hostProcessOverrideOutput, PaWasapiStream::hThreadExit, PaWasapiStream::hThreadStart, PaWasapiStream::in, LogHostError, PaWasapiStream::nThreadPriority, PaWasapiStream::out, PaWasapi_ThreadPriorityBoost(), PRINT, PaWasapiHostProcessor::processor, PaWasapiStream::rclient, PaWasapiStream::running, S_COUNT, S_INPUT, PaWasapiSubStream::shareMode, and PaWasapiHostProcessor::userData.
PA_THREAD_FUNC ProcThreadPoll | ( | void * | param | ) |
References __DIV_8, AUDCLNT_S_BUFFER_EMPTY, AUDCLNT_SHAREMODE_SHARED, PaWasapiStream::bufferMode, PaWasapiStream::bufferProcessor, PaWasapiStream::cclient, PaWasapiSubStream::client, PaWasapiSubStream::framesPerBuffer, PaUtilBufferProcessor::framesPerUserBuffer, PaWasapiStream::hAvTask, PaWasapiStream::hCloseRequest, PaWasapiStream::hostProcessOverrideInput, PaWasapiStream::hostProcessOverrideOutput, PaWasapiStream::hThreadExit, PaWasapiStream::hThreadStart, PaWasapiStream::in, LogHostError, LogPaError, PaWasapiSubStream::monoBuffer, PaWasapiSubStream::monoBufferSize, PaWasapiSubStream::monoMixer, PaWasapiStream::nThreadPriority, PaWasapiStream::out, PA_WASAPI__IS_FULLDUPLEX, paInsufficientMemory, paUtilFixedHostBufferSize, PaWasapi_ThreadPriorityBoost(), PaWasapiHostProcessor::processor, PaWasapiStream::rclient, PaWasapiStream::running, S_FULLDUPLEX, S_INPUT, PaWasapiSubStream::shareMode, PaWasapiHostProcessor::userData, and PaWasapiSubStream::wavex.
typedef LPDWORD |
Referenced by MMCSS_deactivate().
FAvRtCreateThreadOrderingGroup pAvRtCreateThreadOrderingGroup = NULL |
FAvRtDeleteThreadOrderingGroup pAvRtDeleteThreadOrderingGroup = NULL |
FAvRtWaitOnThreadOrderingGroup pAvRtWaitOnThreadOrderingGroup = NULL |
FAvSetMmThreadCharacteristics pAvSetMmThreadCharacteristics = NULL |
Referenced by MMCSS_activate().
FAvSetMmThreadPriority pAvSetMmThreadPriority = NULL |