Feature: Add XAudio2 driver

This commit is contained in:
Owen Rudge
2018-04-09 23:18:45 +01:00
parent fb54dd04a1
commit 7bd2fa3516
16 changed files with 426 additions and 25 deletions

View File

@@ -77,6 +77,7 @@ set_default() {
enable_builtin_depend="1"
with_makedepend="0"
with_direct_music="1"
with_xaudio2="1"
with_sort="1"
with_iconv="1"
with_midi=""
@@ -152,6 +153,7 @@ set_default() {
enable_builtin_depend
with_makedepend
with_direct_music
with_xaudio2
with_sort
with_iconv
with_midi
@@ -411,6 +413,10 @@ detect_params() {
--without-direct-music) with_direct_music="0";;
--with-direct-music=*) with_direct_music="$optarg";;
--with-xaudio2) with_xaudio2="2";;
--without-xaudio2) with_xaudio2="0";;
--with-xaudio2=*) with_xaudio2="$optarg";;
--with-sort) with_sort="2";;
--without-sort) with_sort="0";;
--with-sort=*) with_sort="$optarg";;
@@ -871,6 +877,20 @@ check_params() {
fi
fi
if [ "$with_xaudio2" != "0" ]; then
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
if [ "$with_xaudio2" != "1" ]; then
log 1 "configure: error: xaudio2 is only supported on Win32 targets"
exit 1
fi
with_xaudio2="0"
log 1 "checking xaudio2... not Windows, skipping"
else
check_xaudio2
fi
fi
detect_sort
# Suppress language errors when there is a version defined, indicating a release
@@ -1772,6 +1792,10 @@ make_cflags_and_ldflags() {
fi
fi
if [ "$with_xaudio2" != "0" ]; then
CFLAGS="$CFLAGS -DWITH_XAUDIO2"
fi
if [ -n "$libtimidity_config" ]; then
CFLAGS="$CFLAGS -DLIBTIMIDITY"
CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`"
@@ -2160,6 +2184,35 @@ check_direct_music() {
fi
}
check_xaudio2() {
echo "
#include <windows.h>
#undef NTDDI_VERSION
#undef _WIN32_WINNT
#define NTDDI_VERSION NTDDI_WIN8
#define _WIN32_WINNT _WIN32_WINNT_WIN8
#include <xaudio2.h>
int main(int argc, char *argv[]) { }" > xaudio2.test.c
$cxx_host $CFLAGS xaudio2.test.c -o xaudio2.test 2> /dev/null
res=$?
rm -f xaudio2.test.c xaudio2.test
if [ "$res" != "0" ]; then
if [ "$with_xaudio2" != "1" ]; then
log 1 "configure: error: xaudio2 is not available on this system"
exit 1
fi
with_xaudio2="0"
log 1 "checking xaudio2... not found"
else
log 1 "checking xaudio2... found"
fi
}
check_makedepend() {
if [ "$enable_builtin_depend" != "0" ]; then
with_makedepend="0"