Commit 68103993520166dc2d573bdb5dfe0ed7a2f641ea

Sam Lantinga 2021-08-10T14:50:43

Enable AAUDIO driver for Android I thought this was already enabled for 2.0.16, but apparently not. Fixes https://github.com/libsdl-org/SDL/issues/3710

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70a482e..17f0a5f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1010,7 +1010,7 @@ if(ANDROID)
     find_library(ANDROID_OPENSLES_LIBRARY OpenSLES)
     list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_OPENSLES_LIBRARY})
 
-    set(SDL_AUDIO_DRIVER_AAUDIO 0)
+    set(SDL_AUDIO_DRIVER_AAUDIO 1)
     file(GLOB AAUDIO_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/aaudio/*.c)
     set(SOURCE_FILES ${SOURCE_FILES} ${AAUDIO_AUDIO_SOURCES})
 
diff --git a/WhatsNew.txt b/WhatsNew.txt
index 69d2e74..08d82c0 100644
--- a/WhatsNew.txt
+++ b/WhatsNew.txt
@@ -2,6 +2,13 @@
 This is a list of major changes in SDL's version history.
 
 ---------------------------------------------------------------------------
+2.0.18:
+---------------------------------------------------------------------------
+
+Android:
+* Added support for audio output and capture using AAudio
+
+---------------------------------------------------------------------------
 2.0.16:
 ---------------------------------------------------------------------------
 General:
@@ -30,7 +37,6 @@ Linux:
 * Added the hint SDL_HINT_AUDIO_DEVICE_STREAM_ROLE to describe the role of your application for audio control panels
 
 Android:
-* Added support for audio output and capture using AAudio
 * Added SDL_AndroidShowToast() to show a lightweight notification
 
 iOS:
diff --git a/configure.ac b/configure.ac
index 3ef13d4..8076f92 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3660,6 +3660,15 @@ case "$host" in
                 AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
                 SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
                 SUMMARY_audio="${SUMMARY_audio} android"
+
+                AC_DEFINE(SDL_AUDIO_DRIVER_OPENSLES, 1, [ ])
+                SOURCES="$SOURCES $srcdir/src/audio/openslES/*.c"
+                SUMMARY_audio="${SUMMARY_audio} openslES"
+
+                AC_DEFINE(SDL_AUDIO_DRIVER_AAUDIO, 1, [ ])
+                SOURCES="$SOURCES $srcdir/src/audio/aaudio/*.c"
+                SUMMARY_audio="${SUMMARY_audio} aaudio"
+
                 have_audio=yes
             ;;
             nto)
diff --git a/include/SDL_config.h.in b/include/SDL_config.h.in
index 0d999d9..2459985 100644
--- a/include/SDL_config.h.in
+++ b/include/SDL_config.h.in
@@ -262,6 +262,7 @@
 #undef SDL_FILESYSTEM_DISABLED
 
 /* Enable various audio drivers */
+#undef SDL_AUDIO_DRIVER_AAUDIO
 #undef SDL_AUDIO_DRIVER_ALSA
 #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
 #undef SDL_AUDIO_DRIVER_ANDROID
@@ -283,6 +284,7 @@
 #undef SDL_AUDIO_DRIVER_NAS
 #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
 #undef SDL_AUDIO_DRIVER_NETBSD
+#undef SDL_AUDIO_DRIVER_OPENSLES
 #undef SDL_AUDIO_DRIVER_OSS
 #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
 #undef SDL_AUDIO_DRIVER_PAUDIO
diff --git a/include/SDL_config_android.h b/include/SDL_config_android.h
index cd43314..9414ccc 100644
--- a/include/SDL_config_android.h
+++ b/include/SDL_config_android.h
@@ -143,7 +143,7 @@
 /* Enable various audio drivers */
 #define SDL_AUDIO_DRIVER_ANDROID    1
 #define SDL_AUDIO_DRIVER_OPENSLES   1
-#define SDL_AUDIO_DRIVER_AAUDIO     0
+#define SDL_AUDIO_DRIVER_AAUDIO     1
 #define SDL_AUDIO_DRIVER_DUMMY  1
 
 /* Enable various input drivers */