aaudio: Deal with device recovery.

Android claims to work with multiple devices, but doesn't actually appear to
(at least, afaict), and it will report tons of devices that all just seem
to play to the current default output, so for now, turn this off and only
expose a default device.

And then, with that default output, attempt to recover on errors by throwing
away the current AAudioStream and building a new one.

This let me plug/unplug a set of headphones from the headphone jack and audio
would switch correctly to the new output.
This commit is contained in:
Ryan C. Gordon
2023-09-30 16:33:30 -04:00
parent a8813b58a6
commit 482c238953
3 changed files with 95 additions and 25 deletions

View File

@@ -32,6 +32,9 @@ extern "C" {
#include "../../audio/SDL_sysaudio.h"
// this appears to be broken right now (on Android, not SDL, I think...?).
#define ALLOW_MULTIPLE_ANDROID_AUDIO_DEVICES 0
/* Interface from the SDL library into the Android Java activity */
extern void Android_JNI_SetActivityTitle(const char *title);
extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen);