From 326549c55ee09bcb3cd95540d870540aefc43c3d Mon Sep 17 00:00:00 2001 From: dmitrykos Date: Sun, 14 Aug 2016 10:52:36 +0300 Subject: [PATCH] wasapi: use Windows common Sleep() API instead of PA_Sleep() use GetTickCount64() API which is awailable for Windows Store app instead of _ftime_s() remove WAVEFORMAT and WAVEFORMATEX declaration and use the corresponding Windows include file instead --- src/hostapi/wasapi/pa_win_wasapi.c | 4 ++-- src/os/win/pa_win_util.c | 4 +--- src/os/win/pa_win_waveformat.c | 33 +++--------------------------- 3 files changed, 6 insertions(+), 35 deletions(-) diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c index eab2a8c..789c635 100644 --- a/src/hostapi/wasapi/pa_win_wasapi.c +++ b/src/hostapi/wasapi/pa_win_wasapi.c @@ -1367,7 +1367,7 @@ static HRESULT ActivateAudioInterface_WINRT(const PaWasapiDeviceInfo *deviceInfo // Wait in busy loop for async operation to complete while (SUCCEEDED(hr) && !handlerImpl->done) { - Pa_Sleep(1); + Sleep(1); } (*client) = handlerImpl->out.client; @@ -4084,7 +4084,7 @@ static PaError ReadStream( PaStream* s, void *_buffer, unsigned long frames ) { if ((sleep = ThreadIdleScheduler_NextSleep(&sched)) != 0) { - Pa_Sleep(sleep); + Sleep(sleep); sleep = 0; } } diff --git a/src/os/win/pa_win_util.c b/src/os/win/pa_win_util.c index 2de7684..1cd3525 100644 --- a/src/os/win/pa_win_util.c +++ b/src/os/win/pa_win_util.c @@ -149,9 +149,7 @@ double PaUtil_GetTime( void ) { #ifndef UNDER_CE #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) - struct _timeb tv = { 0 }; - _ftime_s(&tv); - return (double)tv.time + tv.millitm * .001; + return GetTickCount64() * .001; #else return timeGetTime() * .001; #endif diff --git a/src/os/win/pa_win_waveformat.c b/src/os/win/pa_win_waveformat.c index afb3648..bd5addd 100644 --- a/src/os/win/pa_win_waveformat.c +++ b/src/os/win/pa_win_waveformat.c @@ -38,6 +38,9 @@ #include #include +#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) + #include /* for WAVEFORMATEX */ +#endif #include "portaudio.h" #include "pa_win_waveformat.h" @@ -48,36 +51,6 @@ #endif -#if !defined(WAVE_FORMAT_PCM) -#define WAVE_FORMAT_PCM 1 -typedef struct tWAVEFORMAT -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; -} -WAVEFORMAT; -#endif - - -#if !defined(_WAVEFORMATEX_) -#define _WAVEFORMATEX_ -typedef struct tWAVEFORMATEX -{ - WORD wFormatTag; - WORD nChannels; - DWORD nSamplesPerSec; - DWORD nAvgBytesPerSec; - WORD nBlockAlign; - WORD wBitsPerSample; - WORD cbSize; -} -WAVEFORMATEX; -#endif - - static GUID pawin_ksDataFormatSubtypeGuidBase = { (USHORT)(WAVE_FORMAT_PCM), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }; -- 2.43.0