mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
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:
1 parent
3182ba780e
commit
f542e59a20
17 files changed
+534
-11
No files matched your search
@@ -33,6 +33,7 @@ import com.steamdeck.launcher.session.ProtonExtras
|
||||
import com.steamdeck.launcher.session.SessionPrefs
|
||||
import com.steamdeck.launcher.ui.ProtonDialog
|
||||
import com.steamdeck.launcher.ui.ProtonRow
|
||||
import com.steamdeck.launcher.ui.AudioDialog
|
||||
import com.steamdeck.launcher.ui.DriverDialog
|
||||
import com.steamdeck.launcher.ui.DriverRow
|
||||
import com.steamdeck.launcher.ui.ConfirmDialog
|
||||
@@ -73,6 +74,9 @@ class MainActivity : ComponentActivity() {
|
||||
private var offline by mutableStateOf(false)
|
||||
private var protonRows by mutableStateOf<List<ProtonRow>>(emptyList())
|
||||
private var showDrivers by mutableStateOf(false)
|
||||
private var showAudio by mutableStateOf(false)
|
||||
private var directAudio by mutableStateOf(false)
|
||||
private var mic by mutableStateOf(false)
|
||||
private var linuxRows by mutableStateOf<List<DriverRow>>(emptyList())
|
||||
private var linuxSteam by mutableStateOf("")
|
||||
private var linuxDesktop by mutableStateOf("")
|
||||
@@ -116,6 +120,7 @@ class MainActivity : ComponentActivity() {
|
||||
onFrameGen = { showFrameGen = true },
|
||||
onProtons = { refreshProtons(); showProtons = true },
|
||||
onDrivers = { refreshDrivers(); showDrivers = true },
|
||||
onAudio = { directAudio = SessionPrefs.directAudio(this); mic = SessionPrefs.micEnabled(this); showAudio = true },
|
||||
onCredits = { showCredits = true },
|
||||
)
|
||||
if (showApps) DesktopAppsDialog(
|
||||
@@ -142,6 +147,20 @@ class MainActivity : ComponentActivity() {
|
||||
onRemoveAndroid = { id -> TurnipDriver(this).remove(id); refreshDrivers() },
|
||||
onDismiss = { showDrivers = false },
|
||||
)
|
||||
if (showAudio) AudioDialog(
|
||||
directAudio = directAudio, mic = mic,
|
||||
onDirectAudio = { on -> SessionPrefs.setDirectAudio(this, on); directAudio = on },
|
||||
onMic = { on ->
|
||||
SessionPrefs.setMicEnabled(this, on)
|
||||
mic = on
|
||||
// The session checks the grant itself at start; asking here means the
|
||||
// answer is in before the first session that wants it.
|
||||
if (on && checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 2)
|
||||
}
|
||||
},
|
||||
onDismiss = { showAudio = false },
|
||||
)
|
||||
if (showRemove) ConfirmDialog(
|
||||
title = "Remove Linux runtime",
|
||||
text = "This deletes the runtime, the Steam client inside it, and every game installed there.",
|
||||
|
||||
Reference in new issue
Block a user