wasapi:
- fixed configure.in to compile WASAPI module under MSYS - fixed include name cases for case-sensitive build environments - defined LPCGUID for some MinGW compilers which are missing it - fixed strict-aliasing rules break on line of getting device EndpointFormFactor in case '-Wstrict-aliasing' is specified or corresponding GCC optimization flag is used
This commit is contained in:
parent
b5e74653c1
commit
50c880c015
2 changed files with 28 additions and 10 deletions
18
configure.in
18
configure.in
|
|
@ -38,16 +38,17 @@ AC_ARG_WITH(asihpi,
|
||||||
|
|
||||||
AC_ARG_WITH(winapi,
|
AC_ARG_WITH(winapi,
|
||||||
AS_HELP_STRING([--with-winapi],
|
AS_HELP_STRING([--with-winapi],
|
||||||
[Select Windows API support (@<:@wmme|directx|asio|wdmks@:>@@<:@,...@:>@) @<:@wmme@:>@]),
|
[Select Windows API support (@<:@wmme|directx|asio|wasapi|wdmks@:>@@<:@,...@:>@) @<:@wmme@:>@]),
|
||||||
[with_winapi=$withval], [with_winapi="wmme"])
|
[with_winapi=$withval], [with_winapi="wmme"])
|
||||||
case "$target_os" in *mingw* | *cygwin*)
|
case "$target_os" in *mingw* | *cygwin*)
|
||||||
with_wmme=no
|
with_wmme=no
|
||||||
with_directx=no
|
with_directx=no
|
||||||
with_asio=no
|
with_asio=no
|
||||||
|
with_wasapi=no
|
||||||
with_wdmks=no
|
with_wdmks=no
|
||||||
for api in $(echo $with_winapi | sed 's/,/ /g'); do
|
for api in $(echo $with_winapi | sed 's/,/ /g'); do
|
||||||
case "$api" in
|
case "$api" in
|
||||||
wmme|directx|asio|wdmks)
|
wmme|directx|asio|wasapi|wdmks)
|
||||||
eval with_$api=yes
|
eval with_$api=yes
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|
@ -222,7 +223,7 @@ case "${host_os}" in
|
||||||
PADLL="portaudio.dll"
|
PADLL="portaudio.dll"
|
||||||
THREAD_CFLAGS="-mthreads"
|
THREAD_CFLAGS="-mthreads"
|
||||||
SHARED_FLAGS="-shared"
|
SHARED_FLAGS="-shared"
|
||||||
CFLAGS="$CFLAGS -I\$(top_srcdir)/include -DPA_NO_WMME -DPA_NO_ASIO -DPA_NO_WDMKS -DPA_NO_DS"
|
CFLAGS="$CFLAGS -I\$(top_srcdir)/include -DPA_NO_WMME -DPA_NO_ASIO -DPA_NO_WDMKS -DPA_NO_DS -DPA_NO_WASAPI"
|
||||||
|
|
||||||
if [[ "x$with_directx" = "xyes" ]]; then
|
if [[ "x$with_directx" = "xyes" ]]; then
|
||||||
DXDIR="$with_dxdir"
|
DXDIR="$with_dxdir"
|
||||||
|
|
@ -259,6 +260,13 @@ case "${host_os}" in
|
||||||
DLL_LIBS="${DLL_LIBS} -lwinmm"
|
DLL_LIBS="${DLL_LIBS} -lwinmm"
|
||||||
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -UPA_NO_WMME"
|
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -UPA_NO_WMME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ "x$with_wasapi" = "xyes" ]]; then
|
||||||
|
add_objects src/hostapi/wasapi/pa_win_wasapi.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o
|
||||||
|
LIBS="-lwinmm -lm -lole32 -luuid"
|
||||||
|
DLL_LIBS="${DLL_LIBS} -lwinmm"
|
||||||
|
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_NO_WASAPI"
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
cygwin* )
|
cygwin* )
|
||||||
|
|
@ -396,11 +404,13 @@ case "$target_os" in
|
||||||
test "x$with_directx" = "xyes" && with_directx="$with_directx (${with_dxdir})"
|
test "x$with_directx" = "xyes" && with_directx="$with_directx (${with_dxdir})"
|
||||||
test "x$with_wdmks" = "xyes" && with_wdmks="$with_wdmks (${with_dxdir})"
|
test "x$with_wdmks" = "xyes" && with_wdmks="$with_wdmks (${with_dxdir})"
|
||||||
test "x$with_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})"
|
test "x$with_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})"
|
||||||
|
test "x$with_wasapi" = "xyes"
|
||||||
AC_MSG_RESULT([
|
AC_MSG_RESULT([
|
||||||
WMME ........................ $with_wmme
|
WMME ........................ $with_wmme
|
||||||
DSound ...................... $with_directx
|
DSound ...................... $with_directx
|
||||||
WDMKS ....................... $with_wdmks
|
|
||||||
ASIO ........................ $with_asio
|
ASIO ........................ $with_asio
|
||||||
|
WASAPI ...................... $with_wasapi
|
||||||
|
WDMKS ....................... $with_wdmks
|
||||||
])
|
])
|
||||||
;;
|
;;
|
||||||
*darwin*)
|
*darwin*)
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@
|
||||||
#if _MSC_VER >= 1400
|
#if _MSC_VER >= 1400
|
||||||
#include <Avrt.h>
|
#include <Avrt.h>
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#include <audioclient.h>
|
#include <Audioclient.h>
|
||||||
#include <Endpointvolume.h>
|
#include <endpointvolume.h>
|
||||||
#define INITGUID //<< avoid additional linkage of static libs, uneeded code will be optimized out
|
#define INITGUID //<< avoid additional linkage of static libs, uneeded code will be optimized out
|
||||||
#include <mmdeviceapi.h>
|
#include <mmdeviceapi.h>
|
||||||
#include <functiondiscoverykeys.h>
|
#include <functiondiscoverykeys.h>
|
||||||
|
|
@ -84,6 +84,11 @@
|
||||||
#include <rpcsal.h>
|
#include <rpcsal.h>
|
||||||
#include <sal.h>
|
#include <sal.h>
|
||||||
|
|
||||||
|
#ifndef __LPCGUID_DEFINED__
|
||||||
|
#define __LPCGUID_DEFINED__
|
||||||
|
typedef const GUID *LPCGUID;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PROPERTYKEY_DEFINED
|
#ifndef PROPERTYKEY_DEFINED
|
||||||
#define PROPERTYKEY_DEFINED
|
#define PROPERTYKEY_DEFINED
|
||||||
typedef struct _tagpropertykey
|
typedef struct _tagpropertykey
|
||||||
|
|
@ -234,9 +239,9 @@
|
||||||
#include <propkeydef.h>
|
#include <propkeydef.h>
|
||||||
#define COBJMACROS
|
#define COBJMACROS
|
||||||
#define INITGUID
|
#define INITGUID
|
||||||
#include <audioclient.h>
|
#include <Audioclient.h>
|
||||||
#include <mmdeviceapi.h>
|
#include <mmdeviceapi.h>
|
||||||
#include <Endpointvolume.h>
|
#include <endpointvolume.h>
|
||||||
#include <functiondiscoverykeys.h>
|
#include <functiondiscoverykeys.h>
|
||||||
#undef INITGUID
|
#undef INITGUID
|
||||||
|
|
||||||
|
|
@ -1030,9 +1035,12 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
|
||||||
IF_FAILED_JUMP(hResult, error);
|
IF_FAILED_JUMP(hResult, error);
|
||||||
// set
|
// set
|
||||||
#if defined(DUMMYUNIONNAME) && defined(NONAMELESSUNION)
|
#if defined(DUMMYUNIONNAME) && defined(NONAMELESSUNION)
|
||||||
paWasapi->devInfo[i].formFactor = (EndpointFormFactor)(*((UINT *)(((WORD *)&value.wReserved3)+1)));
|
// avoid breaking strict-aliasing rules in such line: (EndpointFormFactor)(*((UINT *)(((WORD *)&value.wReserved3)+1)));
|
||||||
|
UINT v;
|
||||||
|
memcpy(&v, (((WORD *)&value.wReserved3)+1), sizeof(v));
|
||||||
|
paWasapi->devInfo[i].formFactor = (EndpointFormFactor)v;
|
||||||
#else
|
#else
|
||||||
paWasapi->devInfo[i].formFactor = (EndpointFormFactor)value.uintVal;
|
paWasapi->devInfo[i].formFactor = (EndpointFormFactor)value.uintVal;
|
||||||
#endif
|
#endif
|
||||||
PA_DEBUG(("WASAPI: device[%s] form-factor: %d\n", deviceInfo->name, paWasapi->devInfo[i].formFactor));
|
PA_DEBUG(("WASAPI: device[%s] form-factor: %d\n", deviceInfo->name, paWasapi->devInfo[i].formFactor));
|
||||||
// cleanup
|
// cleanup
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue