Audio: DirectAudio for games, and the microphone, from Bannerlator's Linux session

Two opt-ins on a new Audio screen, both ported from Bannerlator's gamescope
runtime where they are proven with voice in Steam's own tester.

DirectAudio replaces the audio driver inside the games the client launches -
Wine's mmdevapi driver, glibc build - with one that talks to a helper on the
Android side over a unix socket. The client keeps PulseAudio either way: it is
a native Linux program with no other way to make a sound. The helper runs here
because nothing inside the session can open Android's audio: a game is a glibc
process in a rootfs that binds no /system, and the uid the helper runs under is
what the recording permission is checked against.

The microphone is its own opt-in. The helper opens the input stream only when
asked and writes it to a pipe; PulseAudio's module-pipe-source turns that into
a source the client sees as DirectAudioMic. The daemon makes the pipe and the
helper waits for it - the two used to race, and the module fails on EEXIST.

The Proton wrappers gain Bannerlator's bl_directaudio, which adds the driver's
directory to WINEDLLPATH and names the driver in the prefix, and refuses on any
Proton that is not Wine 11 rather than pair a driver with an interface it was
not built against, which would be silence rather than an error. bl_game_cpus
comes along in the same splice and is inert until BL_GAME_CPUS is set.

The driver is staged into the runtime at every launch like the session scripts;
the helper ships as libdirectaudiorelay.so beside the PulseAudio daemon. Both
are the binaries Bannerlator carries, built by The412Banner/directaudio's relay
workflow (linux-wine11 build against ValveSoftware/wine proton_11.0).
This commit is contained in:
The412Banner committed 2026-09-21 09:13:33 -04:00
1 parent 3182ba780e
commit f542e59a20
17 files changed
+534 -11

No files matched your search

@@ -0,0 +1,69 @@
package com.steamdeck.launcher.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
/**
* The two audio opt-ins. The client always has PulseAudio; these change what the games get and
* whether anything can record. Both apply at the next session start.
*/
@Composable
fun AudioDialog(
directAudio: Boolean,
mic: Boolean,
onDirectAudio: (Boolean) -> Unit,
onMic: (Boolean) -> Unit,
onDismiss: () -> Unit,
) {
AlertDialog(
onDismissRequest = onDismiss,
title = { Text("Audio") },
text = {
Column {
Text(
"The Steam client itself always plays through PulseAudio. These two change what happens around it, at the next session start.",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
Spacer(Modifier.height(12.dp))
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) {
Column(modifier = Modifier.weight(1f)) {
Text("DirectAudio for games", style = MaterialTheme.typography.bodyMedium)
Text(
"Replaces Wine's audio driver inside the games the client launches with one that talks straight to Android — lower latency, no PulseAudio in between. Wine 11 Protons only (Valve's ARM64, GE, cachyos); on anything else it stays off rather than play silence. A game's first launch after turning this on still uses Proton's own audio; the second uses this.",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Switch(checked = directAudio, onCheckedChange = onDirectAudio)
}
Spacer(Modifier.height(8.dp))
Row(verticalAlignment = Alignment.CenterVertically, modifier = Modifier.fillMaxWidth().padding(vertical = 4.dp)) {
Column(modifier = Modifier.weight(1f)) {
Text("Microphone", style = MaterialTheme.typography.bodyMedium)
Text(
"Gives the session Android's microphone: the Steam client shows an input device named DirectAudioMic, for voice chat. Asks for the recording permission; with it off, nothing in the session can record and Android's indicator stays off.",
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
Switch(checked = mic, onCheckedChange = onMic)
}
}
},
confirmButton = { TextButton(onClick = onDismiss) { Text("OK") } },
)
}
@@ -67,6 +67,7 @@ fun MainScreen(
onFrameGen: () -> Unit,
onProtons: () -> Unit,
onDrivers: () -> Unit,
onAudio: () -> Unit,
onOffline: () -> Unit,
onCredits: () -> Unit,
) {
@@ -182,6 +183,10 @@ fun MainScreen(
onClick = onDrivers,
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
) { Text("Graphics drivers", fontSize = 13.sp * k) }
OutlinedButton(
onClick = onAudio,
modifier = Modifier.fillMaxWidth().padding(top = 5.dp * k).height(buttonHeight + 5.dp * k),
) { Text("Audio", fontSize = 13.sp * k) }
Spacer(Modifier.height(10.dp * k))
Text(
"by The412Banner and maxjivi05 · credits",