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

@@ -0,0 +1,17 @@
package com.droiddeck.launcher.audio
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
class DirectAudioTimingTest {
@Test
fun lowLatencyOutputKeepsTheDriverDefaults() {
assertTrue(DirectAudioTiming.environment(lowLatencyOutput = true).isEmpty())
}
@Test
fun outputWithoutLowLatencyGetsALongerPeriodAndBuffer() {
assertEquals(listOf("AUDIO_DIRECT_PERIOD_MS=20", "AUDIO_DIRECT_MS=60"), DirectAudioTiming.environment(lowLatencyOutput = false))
}
}