fix(audio): DirectAudio no longer crackles where Android refuses low-latency output (#1862)

* fix(audio): DirectAudio no longer crackles where Android refuses low-latency output

On devices where Android won't give the game a low-latency output (AYN Thor,
Android 13), DirectAudio kept Wine's 10 ms period and 12 ms buffer. An
emulated game audio thread can't keep that pace there, so audio crackled.
The session now checks for low-latency output and, only when it is refused,
asks DirectAudio for a 20 ms period and a 60 ms buffer.

DirectAudio's settings are now AUDIO_DIRECT_* everywhere in DroidDeck and are
handed to the driver under the names it reads when DirectAudio is set up.
AUDIO_DIRECT_MS and AUDIO_DIRECT_PERIOD_MS can be set per game.

* fix(audio): game profile DirectAudio settings and the microphone-off setting reach the driver
This commit is contained in:
MaxsTechReview authored and GitHub committed 2026-10-30 16:34:45 -04:00
1 parent 9cc56631cd
commit 7bc3529722
7 files changed
+125 -10

No files matched your search

@@ -727,6 +727,15 @@ def record_install_scripts(digest, env):
print("droiddeck-game-env: install scripts not recorded (%s)" % error, file=sys.stderr)
def directaudio_settings(env):
if "directaudio" not in env.get("WINE_AUDIO_DRIVER", "").split(","):
return env
for name, value in list(env.items()):
if name.startswith("AUDIO_DIRECT_"):
env["BANNER_" + name] = value
return env
def start(launch, launch_env, digest):
if digest:
code = subprocess.run(launch, env=launch_env, check=False).returncode
@@ -797,7 +806,8 @@ def main():
if app_id and len(command) > 1 and command[1] == "waitforexitandrun":
command = offline_without_anticheat(command, env)
if mic_enabled == "0":
env["BANNER_AUDIO_DIRECT_MIC"] = "0"
env["AUDIO_DIRECT_MIC"] = "0"
env = directaudio_settings(env)
env = vram_cap(env)
env = force_ssbs(command, env)
game_cores(env)
@@ -335,6 +335,11 @@ bl_directaudio() {
fi
WINEDLLPATH="$da/lib/wine${WINEDLLPATH:+:$WINEDLLPATH}"
export WINEDLLPATH
for name in $(compgen -e); do
case $name in
AUDIO_DIRECT_*) export "BANNER_$name=${!name}" ;;
esac
done
WINE_AUDIO_DRIVER="directaudio,pulse"
export WINE_AUDIO_DRIVER
pfx="${STEAM_COMPAT_DATA_PATH:-}/pfx"