mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-04 04:40:24 +00:00
aaudio: Make input preset into a hint, don't set it by default.
Fixes #16130.
Reference Issue #13402.
(cherry picked from commit 22e42e6e1e)
This commit is contained in:
@@ -368,9 +368,13 @@ static bool BuildAAudioStream(SDL_AudioDevice *device)
|
||||
SetOptionalStreamUsage(builder);
|
||||
|
||||
if (recording && ctx.AAudioStreamBuilder_setInputPreset) { // optional API: requires Android 28
|
||||
// try to use a microphone that is for recording external audio. Otherwise Android might choose the mic used for talking
|
||||
// on the telephone when held to the user's ear, which is often not useful at any distance from the device.
|
||||
ctx.AAudioStreamBuilder_setInputPreset(builder, AAUDIO_INPUT_PRESET_CAMCORDER);
|
||||
const char *hint = SDL_GetHint(SDL_HINT_ANDROID_AAUDIO_INPUT_PRESET);
|
||||
if (hint) {
|
||||
const aaudio_input_preset_t preset = (const aaudio_input_preset_t) SDL_atoi(hint);
|
||||
if (preset) {
|
||||
ctx.AAudioStreamBuilder_setInputPreset(builder, preset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LOGI("AAudio Try to open %u hz %s %u channels samples %u",
|
||||
|
||||
Reference in New Issue
Block a user