Commit faf7a9bc authored by dmitrykos's avatar dmitrykos

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

git-svn-id: https://subversion.assembla.com/svn/portaudio/portaudio/trunk@1469 0f58301d-fd10-0410-b4af-bbb618454e57
parent 95b2102d
......@@ -38,16 +38,17 @@ AC_ARG_WITH(asihpi,
AC_ARG_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"])
case "$target_os" in *mingw* | *cygwin*)
with_wmme=no
with_directx=no
with_asio=no
with_wasapi=no
with_wdmks=no
for api in $(echo $with_winapi | sed 's/,/ /g'); do
case "$api" in
wmme|directx|asio|wdmks)
wmme|directx|asio|wasapi|wdmks)
eval with_$api=yes
;;
*)
......@@ -222,7 +223,7 @@ case "${host_os}" in
PADLL="portaudio.dll"
THREAD_CFLAGS="-mthreads"
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
DXDIR="$with_dxdir"
......@@ -259,6 +260,13 @@ case "${host_os}" in
DLL_LIBS="${DLL_LIBS} -lwinmm"
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -UPA_NO_WMME"
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* )
......@@ -396,11 +404,13 @@ case "$target_os" in
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_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})"
test "x$with_wasapi" = "xyes"
AC_MSG_RESULT([
WMME ........................ $with_wmme
DSound ...................... $with_directx
WDMKS ....................... $with_wdmks
ASIO ........................ $with_asio
WASAPI ...................... $with_wasapi
WDMKS ....................... $with_wdmks
])
;;
*darwin*)
......
......@@ -51,8 +51,8 @@
#if _MSC_VER >= 1400
#include <Avrt.h>
#define COBJMACROS
#include <audioclient.h>
#include <Endpointvolume.h>
#include <Audioclient.h>
#include <endpointvolume.h>
#define INITGUID //<< avoid additional linkage of static libs, uneeded code will be optimized out
#include <mmdeviceapi.h>
#include <functiondiscoverykeys.h>
......@@ -84,6 +84,11 @@
#include <rpcsal.h>
#include <sal.h>
#ifndef __LPCGUID_DEFINED__
#define __LPCGUID_DEFINED__
typedef const GUID *LPCGUID;
#endif
#ifndef PROPERTYKEY_DEFINED
#define PROPERTYKEY_DEFINED
typedef struct _tagpropertykey
......@@ -234,9 +239,9 @@
#include <propkeydef.h>
#define COBJMACROS
#define INITGUID
#include <audioclient.h>
#include <Audioclient.h>
#include <mmdeviceapi.h>
#include <Endpointvolume.h>
#include <endpointvolume.h>
#include <functiondiscoverykeys.h>
#undef INITGUID
......@@ -1030,9 +1035,12 @@ PaError PaWasapi_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiInd
IF_FAILED_JUMP(hResult, error);
// set
#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
paWasapi->devInfo[i].formFactor = (EndpointFormFactor)value.uintVal;
paWasapi->devInfo[i].formFactor = (EndpointFormFactor)value.uintVal;
#endif
PA_DEBUG(("WASAPI: device[%s] form-factor: %d\n", deviceInfo->name, paWasapi->devInfo[i].formFactor));
// cleanup
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment