WASAPI implementation of support for a host API. More...
#include <windows.h>
#include <stdio.h>
#include <process.h>
#include <assert.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_win_wasapi.h"
#include "pa_debugprint.h"
#include "pa_ringbuffer.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>
#include <devicetopology.h>
Data Structures | |
struct | _tagpropertykey |
struct | _BYTE_BLOB |
struct | PaWasapiDeviceInfo |
struct | PaWasapiHostApiRepresentation |
struct | PaWasapiAudioClientParams |
struct | PaWasapiSubStream |
struct | PaWasapiHostProcessor |
struct | PaWasapiStream |
struct | ThreadIdleScheduler |
Defines | |
#define | WIN32_LEAN_AND_MEAN |
#define | WINVER 0x0600 |
#define | _WIN32_WINNT WINVER |
#define | __LPCGUID_DEFINED__ |
#define | PROPERTYKEY_DEFINED |
#define | __MIDL_CONST const |
#define | NONAMELESSUNION |
#define | WAVE_FORMAT_IEEE_FLOAT 0x0003 |
#define | __MINGW_EXTENSION |
#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.clientProc && (STREAM)->out.clientProc) |
#define | IF_FAILED_JUMP(hr, label) if(FAILED(hr)) goto label; |
#define | IF_FAILED_INTERNAL_ERROR_JUMP(hr, error, label) if(FAILED(hr)) { error = paInternalError; 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 | 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_FLT32(TYPE) |
#define | _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32(TYPE) |
#define | _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT64(TYPE) |
#define | _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L(TYPE) |
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 PaWasapiAudioClientParams | PaWasapiAudioClientParams |
typedef struct PaWasapiSubStream | PaWasapiSubStream |
typedef struct PaWasapiHostProcessor | PaWasapiHostProcessor |
typedef struct PaWasapiStream | PaWasapiStream |
typedef struct ThreadIdleScheduler | ThreadIdleScheduler |
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 | { WASAPI_PACKETS_PER_INPUT_BUFFER = 6 } |
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, MIX_DIR__2TO1_L } |
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) |
void | _StreamOnStop (PaWasapiStream *stream) |
void | _StreamFinish (PaWasapiStream *stream) |
void | _StreamCleanup (PaWasapiStream *stream) |
HRESULT | _PollGetOutputFramesAvailable (PaWasapiStream *stream, UINT32 *available) |
HRESULT | _PollGetInputFramesAvailable (PaWasapiStream *stream, UINT32 *available) |
void * | PaWasapi_ReallocateMemory (void *ptr, size_t size) |
void | PaWasapi_FreeMemory (void *ptr) |
UINT32 | ALIGN_NEXT_POW2 (UINT32 v) |
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) |
HRESULT | UnmarshalSubStreamComPointers (PaWasapiSubStream *substream) |
HRESULT | UnmarshalStreamComPointers (PaWasapiStream *stream) |
void | ReleaseUnmarshaledSubComPointers (PaWasapiSubStream *substream) |
void | ReleaseUnmarshaledComPointers (PaWasapiStream *stream) |
HRESULT | MarshalSubStreamComPointers (PaWasapiSubStream *substream) |
HRESULT | MarshalStreamComPointers (PaWasapiStream *stream) |
unsigned long | PaUtil_GetOutputFrameCount (PaUtilBufferProcessor *bp) |
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) |
HRESULT | ProcessOutputBuffer (PaWasapiStream *stream, PaWasapiHostProcessor *processor, UINT32 frames) |
HRESULT | ProcessInputBuffer (PaWasapiStream *stream, PaWasapiHostProcessor *processor) |
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 __LPCGUID_DEFINED__ |
#define __MIDL_CONST const |
#define __MINGW_EXTENSION |
#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_FLT32 | ( | 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 _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT32 | ( | TYPE | ) |
TYPE * __restrict to = (TYPE *)__to;\
TYPE * __restrict from = (TYPE *)__from;\
TYPE * __restrict end = to + count;\
while (to != end)\
{\
*to ++ = (TYPE)(((INT32)from[0] + (INT32)from[1]) >> 1);\
from += 2;\
}
#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_INT64 | ( | TYPE | ) |
TYPE * __restrict to = (TYPE *)__to;\
TYPE * __restrict from = (TYPE *)__from;\
TYPE * __restrict end = to + count;\
while (to != end)\
{\
*to ++ = (TYPE)(((INT64)from[0] + (INT64)from[1]) >> 1);\
from += 2;\
}
#define _WASAPI_MONO_TO_STEREO_MIXER_2_TO_1_L | ( | TYPE | ) |
TYPE * __restrict to = (TYPE *)__to;\
TYPE * __restrict from = (TYPE *)__from;\
TYPE * __restrict end = to + count;\
while (to != end)\
{\
*to ++ = from[0];\
from += 2;\
}
#define _WIN32_WINNT WINVER |
#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_INTERNAL_ERROR_JUMP | ( | hr, | ||
error, | ||||
label | ||||
) | if(FAILED(hr)) { error = paInternalError; goto label; } |
Referenced by PaWasapi_Initialize().
#define IF_FAILED_JUMP | ( | hr, | ||
label | ||||
) | if(FAILED(hr)) goto label; |
Referenced by PaWasapi_GetJackCount(), and PaWasapi_GetJackDescription().
#define INITGUID |
#define LogHostError | ( | HRES | ) | __LogHostError(HRES, __FUNCTION__, __FILE__, __LINE__) |
#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.clientProc && (STREAM)->out.clientProc) |
Referenced by ProcThreadPoll().
#define PRINT | ( | x | ) | PA_DEBUG(x); |
Referenced by MMCSS_activate(), MMCSS_deactivate(), PaWasapi_Initialize(), ProcThreadEvent(), and ProcThreadPoll().
#define PROPERTYKEY_DEFINED |
#define REFTIMES_PER_MILLISEC 10000 |
#define REFTIMES_PER_MILLISEC 10000 |
#define REFTIMES_PER_SEC 10000000 |
#define REFTIMES_PER_SEC 10000000 |
#define SAFE_CLOSE | ( | h | ) | if ((h) != NULL) { CloseHandle((h)); (h) = NULL; } |
Referenced by _StreamCleanup().
#define SAFE_RELEASE | ( | punk | ) | if ((punk) != NULL) { (punk)->lpVtbl->Release((punk)); (punk) = NULL; } |
#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) |
#define WINVER 0x0600 |
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 PaWasapiAudioClientParams PaWasapiAudioClientParams |
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 struct ThreadIdleScheduler ThreadIdleScheduler |
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 | ||||
) |
HRESULT _PollGetInputFramesAvailable | ( | PaWasapiStream * | stream, | |
UINT32 * | available | |||
) |
References PaWasapiSubStream::clientProc, PaWasapiStream::in, and LogHostError.
Referenced by ProcessInputBuffer().
HRESULT _PollGetOutputFramesAvailable | ( | PaWasapiStream * | stream, | |
UINT32 * | available | |||
) |
References PaWasapiSubStream::clientProc, PaWasapiSubStream::framesPerHostCallback, LogHostError, and PaWasapiStream::out.
Referenced by ProcThreadPoll().
void _StreamCleanup | ( | PaWasapiStream * | stream | ) |
void _StreamFinish | ( | PaWasapiStream * | stream | ) |
References _StreamCleanup(), _StreamOnStop(), PaWasapiStream::bBlocking, PaWasapiSubStream::clientParent, FALSE, PaWasapiStream::hBlockingOpStreamRD, PaWasapiStream::hBlockingOpStreamWR, PaWasapiStream::hCloseRequest, PaWasapiStream::hThreadExit, PaWasapiStream::out, PaWasapiStream::running, and TRUE.
void _StreamOnStop | ( | PaWasapiStream * | stream | ) |
References PaWasapiStream::bBlocking, PaWasapiSubStream::clientParent, PaWasapiSubStream::clientProc, PaWasapiStream::hAvTask, PaWasapiStream::in, PaWasapiStream::out, PaWasapi_ThreadPriorityRevert(), PaUtilStreamRepresentation::streamFinishedCallback, PaWasapiStream::streamRepresentation, and PaUtilStreamRepresentation::userData.
Referenced by _StreamFinish(), ProcThreadEvent(), and ProcThreadPoll().
UINT32 ALIGN_NEXT_POW2 | ( | UINT32 | v | ) |
typedef BOOL | ( | WINAPI * | FAvRtCreateThreadOrderingGroup | ) |
Referenced by ProcThreadEvent(), and ProcThreadPoll().
typedef HANDLE | ( | WINAPI * | FAvSetMmThreadCharacteristics | ) |
Referenced by PaWin_WDMKS_QueryFilterMaximumChannelCount(), and ProcessingThreadProc().
HRESULT MarshalStreamComPointers | ( | PaWasapiStream * | stream | ) |
References PaWasapiStream::captureClientParent, PaWasapiStream::captureClientStream, PaWasapiSubStream::clientParent, PaWasapiSubStream::clientStream, PaWasapiStream::in, MarshalSubStreamComPointers(), PaWasapiStream::out, ReleaseUnmarshaledComPointers(), PaWasapiStream::renderClientParent, PaWasapiStream::renderClientStream, and UnmarshalStreamComPointers().
HRESULT MarshalSubStreamComPointers | ( | PaWasapiSubStream * | substream | ) |
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 | ( | 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 | ( | IAudioClient | , | |
1cb9ad4c | , | |||
dbfa | , | |||
4c32 | , | |||
b1 | , | |||
78 | , | |||
c2 | , | |||
f5 | , | |||
68 | , | |||
a7 | , | |||
03 | , | |||
b2 | ||||
) |
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 | ( | IDeviceTopology | , | |
2A07407E | , | |||
6497 | , | |||
4A18 | , | |||
97 | , | |||
87 | , | |||
32 | , | |||
f7 | , | |||
9b | , | |||
d0 | , | |||
d9 | , | |||
8f | ||||
) |
unsigned long PaUtil_GetOutputFrameCount | ( | PaUtilBufferProcessor * | bp | ) |
References PaUtilBufferProcessor::hostOutputFrameCount.
void PaWasapi_FreeMemory | ( | void * | ptr | ) |
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 KSJACK_DESCRIPTION::ChannelMapping, PaWasapiJackDescription::channelMapping, KSJACK_DESCRIPTION::Color, PaWasapiJackDescription::color, KSJACK_DESCRIPTION::ConnectionType, PaWasapiJackDescription::connectionType, PaWasapiDeviceInfo::device, PaWasapiHostApiRepresentation::deviceCount, PaWasapiHostApiRepresentation::devInfo, KSJACK_DESCRIPTION::GenLocation, PaWasapiJackDescription::genLocation, KSJACK_DESCRIPTION::GeoLocation, PaWasapiJackDescription::geoLocation, IF_FAILED_JUMP, PaWasapiHostApiRepresentation::inheritedHostApiRep, KSJACK_DESCRIPTION::IsConnected, PaWasapiJackDescription::isConnected, LogHostError, paNoError, PaUtil_DeviceIndexToHostApiDeviceIndex(), KSJACK_DESCRIPTION::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_INTERNAL_ERROR_JUMP, PaUtilHostApiRepresentation::info, PaWasapiHostApiRepresentation::inheritedHostApiRep, LogHostError, MAX_STR_LEN, PaDeviceInfo::maxInputChannels, PaDeviceInfo::maxOutputChannels, PaWasapiDeviceInfo::MinimumDevicePeriod, PaDeviceInfo::name, PA_DEBUG, Pa_GetErrorText(), paNoError, 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().
void * PaWasapi_ReallocateMemory | ( | void * | ptr, | |
size_t | size | |||
) |
Referenced by ProcessInputBuffer(), ProcessOutputBuffer(), and ProcThreadPoll().
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().
Referenced by _StreamOnStop().
HRESULT ProcessInputBuffer | ( | PaWasapiStream * | stream, | |
PaWasapiHostProcessor * | processor | |||
) |
References _PollGetInputFramesAvailable(), AUDCLNT_S_BUFFER_EMPTY, PaWasapiStream::captureClient, PaWasapiStream::hCloseRequest, PaWasapiStream::in, LogHostError, PaWasapiSubStream::monoBuffer, PaWasapiSubStream::monoBufferSize, PaWasapiSubStream::monoMixer, PaWasapi_ReallocateMemory(), PaWasapiHostProcessor::processor, S_INPUT, PaWasapiHostProcessor::userData, and PaWasapiSubStream::wavex.
Referenced by ProcThreadEvent(), and ProcThreadPoll().
HRESULT ProcessOutputBuffer | ( | PaWasapiStream * | stream, | |
PaWasapiHostProcessor * | processor, | |||
UINT32 | frames | |||
) |
References AUDCLNT_E_BUFFER_TOO_LARGE, AUDCLNT_SHAREMODE_SHARED, PaWasapiSubStream::clientProc, LogHostError, PaWasapiSubStream::monoBuffer, PaWasapiSubStream::monoBufferSize, PaWasapiSubStream::monoMixer, PaWasapiStream::out, PaWasapi_ReallocateMemory(), PaWasapiHostProcessor::processor, PaWasapiStream::renderClient, S_OUTPUT, PaWasapiSubStream::shareMode, PaWasapiHostProcessor::userData, and PaWasapiSubStream::wavex.
Referenced by ProcThreadEvent(), and ProcThreadPoll().
PA_THREAD_FUNC ProcThreadEvent | ( | void * | param | ) |
References _StreamOnStop(), AUDCLNT_SHAREMODE_EXCLUSIVE, BOOL(), PaWasapiStream::captureClient, PaWasapiSubStream::clientProc, 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, ProcessInputBuffer(), PaWasapiHostProcessor::processor, ProcessOutputBuffer(), ReleaseUnmarshaledComPointers(), PaWasapiStream::renderClient, PaWasapiStream::running, S_COUNT, S_INPUT, S_OUTPUT, PaWasapiSubStream::shareMode, TRUE, UnmarshalStreamComPointers(), and PaWasapiHostProcessor::userData.
PA_THREAD_FUNC ProcThreadPoll | ( | void * | param | ) |
References _PollGetOutputFramesAvailable(), _StreamOnStop(), AUDCLNT_S_BUFFER_EMPTY, AUDCLNT_SHAREMODE_SHARED, BOOL(), PaWasapiStream::bufferMode, PaWasapiStream::bufferProcessor, PaWasapiStream::captureClient, PaWasapiSubStream::clientProc, PaWasapiSubStream::framesPerBuffer, PaWasapiSubStream::framesPerHostCallback, 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_ReallocateMemory(), PaWasapi_ThreadPriorityBoost(), PRINT, ProcessInputBuffer(), PaWasapiHostProcessor::processor, ProcessOutputBuffer(), ReleaseUnmarshaledComPointers(), PaWasapiStream::renderClient, PaWasapiStream::running, S_FULLDUPLEX, S_INPUT, S_OUTPUT, PaWasapiSubStream::shareMode, TRUE, UnmarshalStreamComPointers(), PaWasapiHostProcessor::userData, WASAPI_PACKETS_PER_INPUT_BUFFER, and PaWasapiSubStream::wavex.
void ReleaseUnmarshaledComPointers | ( | PaWasapiStream * | stream | ) |
References PaWasapiStream::captureClient, PaWasapiStream::in, PaWasapiStream::out, ReleaseUnmarshaledSubComPointers(), PaWasapiStream::renderClient, and SAFE_RELEASE.
Referenced by MarshalStreamComPointers(), ProcThreadEvent(), and ProcThreadPoll().
void ReleaseUnmarshaledSubComPointers | ( | PaWasapiSubStream * | substream | ) |
References PaWasapiSubStream::clientProc, and SAFE_RELEASE.
Referenced by MarshalSubStreamComPointers(), and ReleaseUnmarshaledComPointers().
HRESULT UnmarshalStreamComPointers | ( | PaWasapiStream * | stream | ) |
References PaWasapiStream::captureClient, PaWasapiStream::captureClientStream, PaWasapiSubStream::clientParent, PaWasapiSubStream::clientProc, PaWasapiStream::in, PaWasapiStream::out, PaWasapiStream::renderClient, PaWasapiStream::renderClientStream, and UnmarshalSubStreamComPointers().
Referenced by MarshalStreamComPointers(), ProcThreadEvent(), and ProcThreadPoll().
HRESULT UnmarshalSubStreamComPointers | ( | PaWasapiSubStream * | substream | ) |
References PaWasapiSubStream::clientProc, and PaWasapiSubStream::clientStream.
Referenced by MarshalSubStreamComPointers(), and UnmarshalStreamComPointers().
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 |