// WinRT
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
- #define WIN32_WINRT
+ #define PA_WINRT
#define INITGUID
#endif
#endif // NTDDI_VERSION
// Missing declarations for WinRT
-#ifdef WIN32_WINRT
+#ifdef PA_WINRT
#define DEVICE_STATE_ACTIVE 0x00000001
typedef void (*MixMonoToStereoF) (void *__to, void *__from, UINT32 count);
// AVRT is the new "multimedia schedulling stuff"
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
typedef BOOL (WINAPI *FAvRtCreateThreadOrderingGroup) (PHANDLE,PLARGE_INTEGER,GUID*,PLARGE_INTEGER);
typedef BOOL (WINAPI *FAvRtDeleteThreadOrderingGroup) (HANDLE);
typedef BOOL (WINAPI *FAvRtWaitOnThreadOrderingGroup) (HANDLE);
typedef struct PaWasapiDeviceInfo
{
// Device
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
IMMDevice *device;
#endif
PaWinUtilComInitializationResult comInitializationResult;
//in case we later need the synch
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
IMMDeviceEnumerator *enumerator;
#endif
typedef struct PaWasapiSubStream
{
IAudioClient *clientParent;
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
IStream *clientStream;
#endif
IAudioClient *clientProc;
// input
PaWasapiSubStream in;
IAudioCaptureClient *captureClientParent;
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
IStream *captureClientStream;
#endif
IAudioCaptureClient *captureClient;
// output
PaWasapiSubStream out;
IAudioRenderClient *renderClientParent;
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
IStream *renderClientStream;
#endif
IAudioRenderClient *renderClient;
}
// ------------------------------------------------------------------------------------------
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static BOOL SetupAVRT()
{
hDInputDLL = LoadLibraryA("avrt.dll");
// ------------------------------------------------------------------------------------------
static void CloseAVRT()
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
if (hDInputDLL != NULL)
FreeLibrary(hDInputDLL);
hDInputDLL = NULL;
// ------------------------------------------------------------------------------------------
static BOOL IsWow64()
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
// http://msdn.microsoft.com/en-us/library/ms684139(VS.85).aspx
}
EWindowsVersion;
// Alternative way for checking Windows version (allows to check version on Windows 8.1 and up)
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor)
{
typedef ULONGLONG (NTAPI *LPFN_VERSETCONDITIONMASK)(ULONGLONG ConditionMask, DWORD TypeMask, BYTE Condition);
// Get Windows version
static EWindowsVersion GetWindowsVersion()
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static EWindowsVersion version = WINDOWS_UNKNOWN;
if (version == WINDOWS_UNKNOWN)
}
// ------------------------------------------------------------------------------------------
-#ifdef WIN32_WINRT
+#ifdef PA_WINRT
typedef struct PaActivateAudioInterfaceCompletionHandler
{
IActivateAudioInterfaceCompletionHandler parent;
}
PaActivateAudioInterfaceCompletionHandler;
-static HRESULT ( STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_QueryInterface )(
- IActivateAudioInterfaceCompletionHandler * This,
- /* [in] */ REFIID riid,
- /* [annotation][iid_is][out] */
- _COM_Outptr_ void **ppvObject)
+static HRESULT (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_QueryInterface)(
+ IActivateAudioInterfaceCompletionHandler *This, REFIID riid, void **ppvObject)
{
PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
return S_FALSE;
}
-static ULONG ( STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_AddRef )(
- IActivateAudioInterfaceCompletionHandler * This)
+static ULONG (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_AddRef)(
+ IActivateAudioInterfaceCompletionHandler *This)
{
PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
return ++ handler->refs;
}
-static ULONG ( STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_Release )(
- IActivateAudioInterfaceCompletionHandler * This)
+static ULONG (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_Release)(
+ IActivateAudioInterfaceCompletionHandler *This)
{
PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
if (handler->refs == 0)
return -- handler->refs;
}
-static HRESULT ( STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_ActivateCompleted )(
- IActivateAudioInterfaceCompletionHandler * This,
- /* [annotation][in] */
- _In_ IActivateAudioInterfaceAsyncOperation *activateOperation)
+static HRESULT (STDMETHODCALLTYPE PaActivateAudioInterfaceCompletionHandler_ActivateCompleted)(
+ IActivateAudioInterfaceCompletionHandler *This, IActivateAudioInterfaceAsyncOperation *activateOperation)
{
PaActivateAudioInterfaceCompletionHandler *handler = (PaActivateAudioInterfaceCompletionHandler *)This;
#endif
// ------------------------------------------------------------------------------------------
-#ifdef WIN32_WINRT
+#ifdef PA_WINRT
static HRESULT ActivateAudioInterface_WINRT(const PaWasapiDeviceInfo *deviceInfo, IAudioClient **client)
{
#define PA_WASAPI_DEVICE_PATH_LEN 64
// ------------------------------------------------------------------------------------------
static HRESULT ActivateAudioInterface(const PaWasapiDeviceInfo *deviceInfo, IAudioClient **client)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
return IMMDevice_Activate(deviceInfo->device, GetAudioClientIID(), CLSCTX_ALL, NULL, (void **)client);
#else
return ActivateAudioInterface_WINRT(deviceInfo, client);
}
// ------------------------------------------------------------------------------------------
-#ifdef WIN32_WINRT
-static DWORD SignalObjectAndWait(
- _In_ HANDLE hObjectToSignal,
- _In_ HANDLE hObjectToWaitOn,
- _In_ DWORD dwMilliseconds,
- _In_ BOOL bAlertable
-)
+#ifdef PA_WINRT
+static DWORD SignalObjectAndWait(HANDLE hObjectToSignal, HANDLE hObjectToWaitOn, DWORD dwMilliseconds, BOOL bAlertable)
{
SetEvent(hObjectToSignal);
return WaitForSingleObjectEx(hObjectToWaitOn, dwMilliseconds, bAlertable);
PaDeviceInfo *deviceInfoArray;
HRESULT hr = S_OK;
UINT i;
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
IMMDeviceCollection* pEndPoints = NULL;
#else
WAVEFORMATEX *mixFormat;
#endif
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
if (!SetupAVRT())
{
PRINT(("WASAPI: No AVRT! (not VISTA?)"));
(*hostApi)->info.defaultInputDevice = paNoDevice;
(*hostApi)->info.defaultOutputDevice = paNoDevice;
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
paWasapi->enumerator = NULL;
hr = CoCreateInstance(&pa_CLSID_IMMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER,
&pa_IID_IMMDeviceEnumerator, (void **)&paWasapi->enumerator);
PA_DEBUG(("WASAPI: device idx: %02d\n", i));
PA_DEBUG(("WASAPI: ---------------\n"));
- #ifndef WIN32_WINRT
+ #ifndef PA_WINRT
hr = IMMDeviceCollection_Item(pEndPoints, i, &paWasapi->devInfo[i].device);
// We need to set the result to a value otherwise we will return paNoError
// [IF_FAILED_JUMP(hResult, error);]
// Getting a temporary IAudioClient for more fields
// we make sure NOT to call Initialize yet!
{
- #ifdef WIN32_WINRT
+ #ifdef PA_WINRT
// Set flow as ActivateAudioInterface depends on it and selects corresponding
// direction for the Audio Client
paWasapi->devInfo[i].flow = (i == 0 ? eRender : eCapture);
hr = S_OK;
}
- #ifdef WIN32_WINRT
+ #ifdef PA_WINRT
// Get mix format which will treat as default device format
hr = IAudioClient_GetMixFormat(tmpClient, &mixFormat);
if (SUCCEEDED(hr))
// findout if platform workaround is required
paWasapi->useWOW64Workaround = UseWOW64Workaround();
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
SAFE_RELEASE(pEndPoints);
#endif
PRINT(("WASAPI: failed %s error[%d|%s]\n", __FUNCTION__, result, Pa_GetErrorText(result)));
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
SAFE_RELEASE(pEndPoints);
#endif
return;
// Release IMMDeviceEnumerator
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
SAFE_RELEASE(paWasapi->enumerator);
#endif
for (i = 0; i < paWasapi->deviceCount; ++i)
{
PaWasapiDeviceInfo *info = &paWasapi->devInfo[i];
- #ifndef WIN32_WINRT
+ #ifndef PA_WINRT
SAFE_RELEASE(info->device);
#else
(void)info;
// ------------------------------------------------------------------------------------------
HRESULT UnmarshalSubStreamComPointers(PaWasapiSubStream *substream)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
HRESULT hResult = S_OK;
HRESULT hFirstBadResult = S_OK;
substream->clientProc = NULL;
// ------------------------------------------------------------------------------------------
HRESULT UnmarshalStreamComPointers(PaWasapiStream *stream)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
HRESULT hResult = S_OK;
HRESULT hFirstBadResult = S_OK;
stream->captureClient = NULL;
// ------------------------------------------------------------------------------------------
HRESULT MarshalSubStreamComPointers(PaWasapiSubStream *substream)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
HRESULT hResult;
substream->clientStream = NULL;
// ------------------------------------------------------------------------------------------
HRESULT MarshalStreamComPointers(PaWasapiStream *stream)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
HRESULT hResult = S_OK;
stream->captureClientStream = NULL;
stream->in.clientStream = NULL;
// ------------------------------------------------------------------------------------------
HANDLE MMCSS_activate(const char *name)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
DWORD task_idx = 0;
HANDLE hTask = pAvSetMmThreadCharacteristics(name, &task_idx);
if (hTask == NULL)
if (!hTask)
return;
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
if (pAvRevertMmThreadCharacteristics(hTask) == FALSE)
{
PRINT(("WASAPI: AvRevertMmThreadCharacteristics failed!\n"));
PaError PaWasapi_GetJackCount(PaDeviceIndex nDevice, int *jcount)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
PaError ret;
HRESULT hr = S_OK;
PaDeviceIndex index;
}
// ------------------------------------------------------------------------------------------
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static PaWasapiJackConnectionType ConvertJackConnectionTypeWASAPIToPA(int connType)
{
switch (connType)
#endif
// ------------------------------------------------------------------------------------------
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static PaWasapiJackGeoLocation ConvertJackGeoLocationWASAPIToPA(int geoLoc)
{
switch (geoLoc)
#endif
// ------------------------------------------------------------------------------------------
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static PaWasapiJackGenLocation ConvertJackGenLocationWASAPIToPA(int genLoc)
{
switch (genLoc)
#endif
// ------------------------------------------------------------------------------------------
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
static PaWasapiJackPortConnection ConvertJackPortConnectionWASAPIToPA(int portConn)
{
switch (portConn)
PaError PaWasapi_GetJackDescription(PaDeviceIndex nDevice, int jindex, PaWasapiJackDescription *pJackDescription)
{
-#ifndef WIN32_WINRT
+#ifndef PA_WINRT
PaError ret;
HRESULT hr = S_OK;
PaDeviceIndex index;