]> Repos - portaudio/commitdiff
wasapi: use Windows common Sleep() API instead of PA_Sleep()
authordmitrykos <dmitrykos@neutroncode.com>
Sun, 14 Aug 2016 07:52:36 +0000 (10:52 +0300)
committerdmitrykos <dmitrykos@neutroncode.com>
Sun, 14 Aug 2016 07:52:36 +0000 (10:52 +0300)
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
src/os/win/pa_win_util.c
src/os/win/pa_win_waveformat.c

index eab2a8ca2860f26f93c23da8fce80747ae7a277e..789c635030abd6ca291fe13e589166b12ad6965e 100644 (file)
@@ -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;
                                }
                        }
index 2de76844ea3770cedd16e24a972798b62bcd1a42..1cd35258bd652d50eba8e5e3fa87e97f2d6171ed 100644 (file)
@@ -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
index afb3648b72d5d787534a0b4f3229f81babb32965..bd5addd407db9d85230e6a22efa8b23b6a199810 100644 (file)
@@ -38,6 +38,9 @@
 
 #include <windows.h>
 #include <mmsystem.h>
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
+    #include <mmreg.h> /* for WAVEFORMATEX */
+#endif
 
 #include "portaudio.h"
 #include "pa_win_waveformat.h"
 #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 };