wasapi: ported to WinRT (UWP)
os: compatibility fixes for compilation of PortAudio as Windows Store library (only WASAPI hostapi is compatible with Windows Store APIs)
This commit is contained in:
parent
e111b3a269
commit
2e7545f17f
4 changed files with 454 additions and 53 deletions
|
|
@ -52,7 +52,7 @@
|
|||
#include "pa_win_coinitialize.h"
|
||||
|
||||
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) && !(defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)) /* MSC version 6 and above */
|
||||
#pragma comment( lib, "ole32.lib" )
|
||||
#endif
|
||||
|
||||
|
|
@ -76,7 +76,11 @@ PaError PaWinUtil_CoInitialize( PaHostApiTypeId hostApiType, PaWinUtilComInitial
|
|||
RPC_E_CHANGED_MODE was returned.
|
||||
*/
|
||||
|
||||
#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY != WINAPI_FAMILY_APP)
|
||||
hr = CoInitialize(0); /* use legacy-safe equivalent to CoInitializeEx(NULL, COINIT_APARTMENTTHREADED) */
|
||||
#else
|
||||
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
|
||||
#endif
|
||||
if( FAILED(hr) && hr != RPC_E_CHANGED_MODE )
|
||||
{
|
||||
PA_DEBUG(("CoInitialize(0) failed. hr=%d\n", hr));
|
||||
|
|
|
|||
|
|
@ -44,14 +44,17 @@
|
|||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <mmsystem.h> /* for timeGetTime() */
|
||||
|
||||
#include "pa_util.h"
|
||||
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
|
||||
#pragma comment( lib, "winmm.lib" )
|
||||
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||
#include <sys/timeb.h> /* for _ftime_s() */
|
||||
#else
|
||||
#include <mmsystem.h> /* for timeGetTime() */
|
||||
#if (defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1200))) && !defined(_WIN32_WCE) /* MSC version 6 and above */
|
||||
#pragma comment( lib, "winmm.lib" )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "pa_util.h"
|
||||
|
||||
/*
|
||||
Track memory allocations to avoid leaks.
|
||||
|
|
@ -144,8 +147,14 @@ double PaUtil_GetTime( void )
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifndef UNDER_CE
|
||||
#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;
|
||||
#else
|
||||
return timeGetTime() * .001;
|
||||
#endif
|
||||
#else
|
||||
return GetTickCount() * .001;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -47,6 +47,37 @@
|
|||
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
|
||||
#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