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
This commit is contained in:
parent
26c0dc4458
commit
326549c55e
3 changed files with 6 additions and 35 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
@ -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 };
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue