Skip to content

Commit

Permalink
Add wasapi support for portaudio
Browse files Browse the repository at this point in the history
Fixes #715.
  • Loading branch information
TimothyGu committed Jul 1, 2015
1 parent 6041a36 commit eb65c9c
Show file tree
Hide file tree
Showing 4 changed files with 134 additions and 58 deletions.
133 changes: 133 additions & 0 deletions src/portaudio-1-fixes.patch
@@ -0,0 +1,133 @@
This file is part of MXE.
See index.html for further information.

Contains ad hoc patches for cross building.

From dfa2eeb14b92d2bbaf1f6916b2d154b98719d470 Mon Sep 17 00:00:00 2001
From: MXE
Date: Tue, 30 Jun 2015 21:20:47 -0400
Subject: [PATCH 1/4] configure: Fix wdmks source file path


diff --git a/configure.in b/configure.in
index 305b64e..3f3b31e 100644
--- a/configure.in
+++ b/configure.in
@@ -318,7 +318,7 @@ case "${host_os}" in

if [[ "x$with_wdmks" = "xyes" ]]; then
DXDIR="$with_dxdir"
- add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_util.o src/os/win/pa_win_waveformat.o
+ add_objects src/hostapi/wdmks/pa_win_wdmks.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_wdmks_utils.o src/os/win/pa_win_waveformat.o
LIBS="${LIBS} -lwinmm -lm -luuid -lsetupapi -lole32"
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
--
1.9.1


From 19e458bb064fbccadecced9c20f5c05c65018c2c Mon Sep 17 00:00:00 2001
From: MXE
Date: Tue, 30 Jun 2015 21:21:17 -0400
Subject: [PATCH 2/4] pa_win_ds: Add shim for macro


diff --git a/src/hostapi/dsound/pa_win_ds.c b/src/hostapi/dsound/pa_win_ds.c
index 98afb5c..2b24981 100644
--- a/src/hostapi/dsound/pa_win_ds.c
+++ b/src/hostapi/dsound/pa_win_ds.c
@@ -876,6 +876,9 @@ static PaError AddOutputDeviceInfoFromDirectSound(
case DSSPEAKER_STEREO: count = 2; break;
case DSSPEAKER_SURROUND: count = 4; break;
case DSSPEAKER_5POINT1: count = 6; break;
+#ifndef DSSPEAKER_7POINT1
+#define DSSPEAKER_7POINT1 0x00000007
+#endif
case DSSPEAKER_7POINT1: count = 8; break;
#ifndef DSSPEAKER_7POINT1_SURROUND
#define DSSPEAKER_7POINT1_SURROUND 0x00000008
@@ -2108,7 +2111,8 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
}
else
{
- CalculateBufferSettings( &stream->hostBufferSizeFrames, &pollingPeriodFrames,
+ CalculateBufferSettings( (unsigned long*)&stream->hostBufferSizeFrames,
+ &pollingPeriodFrames,
/* isFullDuplex = */ (inputParameters && outputParameters),
suggestedInputLatencyFrames,
suggestedOutputLatencyFrames,
--
1.9.1


From 65b0f52b1a450a7a773ec6cf6a76822e665ed266 Mon Sep 17 00:00:00 2001
From: MXE
Date: Tue, 30 Jun 2015 21:21:38 -0400
Subject: [PATCH 3/4] pa_win_wdmks: Remove extraneous winioctl.h inclusion

This caused compilation failure on mingw-w64.

http://music.columbia.edu/pipermail/portaudio/2015-June/016833.html

diff --git a/src/hostapi/wdmks/pa_win_wdmks.c b/src/hostapi/wdmks/pa_win_wdmks.c
index f969e14..5fca590 100644
--- a/src/hostapi/wdmks/pa_win_wdmks.c
+++ b/src/hostapi/wdmks/pa_win_wdmks.c
@@ -87,7 +87,6 @@ of a device for the duration of active stream using those devices
#include "pa_win_wdmks.h"

#include <windows.h>
-#include <winioctl.h>
#include <process.h>

#include <math.h>
--
1.9.1


From 4cec0d1cc47fcf3dd71fded3678282981d5d4f74 Mon Sep 17 00:00:00 2001
From: MXE
Date: Tue, 30 Jun 2015 21:25:55 -0400
Subject: [PATCH 4/4] pa_win_wasapi: Fix compilation on mingw-w64


diff --git a/configure.in b/configure.in
index 3f3b31e..dc84918 100644
--- a/configure.in
+++ b/configure.in
@@ -337,7 +337,7 @@ case "${host_os}" in
add_objects src/hostapi/wasapi/pa_win_wasapi.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o
LIBS="${LIBS} -lwinmm -lm -lole32 -luuid"
DLL_LIBS="${DLL_LIBS} -lwinmm -lole32"
- CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
+ CFLAGS="$CFLAGS -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
fi
;;

diff --git a/src/hostapi/wasapi/pa_win_wasapi.c b/src/hostapi/wasapi/pa_win_wasapi.c
index aecdd63..a9473b9 100644
--- a/src/hostapi/wasapi/pa_win_wasapi.c
+++ b/src/hostapi/wasapi/pa_win_wasapi.c
@@ -49,14 +49,15 @@
#include <assert.h>
#include <mmsystem.h>
#include <mmreg.h> // must be before other Wasapi headers
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
- #include <Avrt.h>
+#if defined(_MSC_VER) && (_MSC_VER >= 1400) || defined(__MINGW64_VERSION_MAJOR)
+ #include <avrt.h>
#define COBJMACROS
- #include <Audioclient.h>
+ #include <audioclient.h>
#include <endpointvolume.h>
#define INITGUID // Avoid additional linkage of static libs, excessive code will be optimized out by the compiler
- #include <mmdeviceapi.h>
+ #include <functiondiscoverykeys_devpkey.h>
#include <functiondiscoverykeys.h>
+ #include <mmdeviceapi.h>
#include <devicetopology.h> // Used to get IKsJackDescription interface
#undef INITGUID
#endif
--
1.9.1

42 changes: 0 additions & 42 deletions src/portaudio-1-win32.patch

This file was deleted.

15 changes: 0 additions & 15 deletions src/portaudio-2-wdmks.patch

This file was deleted.

2 changes: 1 addition & 1 deletion src/portaudio.mk
Expand Up @@ -25,7 +25,7 @@ define $(PKG)_BUILD
cd '$(1)' && ./configure \
$(MXE_CONFIGURE_OPTS) \
--with-host_os=mingw \
--with-winapi=wmme,directx,wdmks \
--with-winapi=wmme,directx,wdmks,wasapi \
--with-dxdir=$(PREFIX)/$(TARGET) \
ac_cv_path_AR=$(TARGET)-ar \
$(if $(BUILD_SHARED),\
Expand Down

0 comments on commit eb65c9c

Please sign in to comment.