Package: steam
Version: 1.0.0.39-2sjm1
Severity: wishlist
Tags: patch

Hi there,

It would be convenient to be able to configure Steam on a system-wide or
(at the user's option) per-user basis to use an audio driver other than
PulseAudio. Currently, this is possible by manually setting the
SDL_AUDIODRIVER environment variable, but that's somewhat clunky and
requires either running Steam from a shell or modifying the package
files.

I'm attaching a patch which will have /usr/games/steam look in
/etc/default/steam and "${config}/defaults" (in that order) for
STEAM_AUDIO_DRIVER and STEAM_AUDIO_DEVICE settings, and set the
appropriate environment variables when running Steam based on these. I've
also created a README.Debian to document the change for users (also
included in the patch).

This has been implemented in a generic and future-proof way that permits
both re-using the same config file for other settings in the future, and
hiding implementation details (like the fact that Steam uses SDL for
audio) from the user.

I have done some rudimentary testing of this patch and it works as
intended on my system. Please let me know if you see any obvious problems
with the change, and I'll get it fixed up.

Thanks,
Steven.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (800, 'unstable'), (700, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.10-3-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages steam depends on:
ii  debconf [debconf-2.0]  1.5.51
ii  libc6                  2.17-92+b1
ii  libgl1-mesa-dri        9.1.6-2+b1
ii  libgl1-mesa-glx        9.1.6-2+b1
ii  libstdc++6             4.8.1-10
ii  libx11-6               2:1.6.1-1
ii  libxau6                1:1.0.8-1
ii  libxcb1                1.9.1-3
ii  libxdmcp6              1:1.1.1-1
ii  multiarch-support      2.17-92+b1
ii  xterm                  297-1

Versions of packages steam recommends:
pn  zenity  <none>

steam suggests no packages.

-- debconf information:
* steam/question: I AGREE
* steam/license:
  steam/purge:
diff -urNd steam-1.0.0.39.orig/debian/README.Debian steam-1.0.0.39/debian/README.Debian
--- steam-1.0.0.39.orig/debian/README.Debian	1970-01-01 10:00:00.000000000 +1000
+++ steam-1.0.0.39/debian/README.Debian	2013-09-30 13:53:28.000000000 +1000
@@ -0,0 +1,33 @@
+Debian's Steam package exposes some configuration parameters. You can
+place these in one of two configuration files:
+
+  System-wide config file:
+    /etc/default/steam
+
+  Per-user config file:
+    ~/.steam/defaults
+
+
+
+Currently supported parameters are:
+
+
+  STEAM_AUDIO_DRIVER
+    This can be used to override the audio driver used by SDL. If unset,
+    'pulse' (PulseAudio) will be used. Possible values include 'alsa' and
+    'oss', although the full list will depend on your platform and your
+    build of SDL. Note that this is not the *system* build of SDL; it is
+    built separately as part of each user's Steam installation.
+
+    Notably, 'jack' is *not* a valid driver.
+
+    Example (to use ALSA instead of PulseAudio):
+      STEAM_AUDIO_DRIVER=alsa
+
+
+  STEAM_AUDIO_DEVICE
+    This is a driver-specific representation of the audio device to use.
+
+    Example (to use first audio device with ALSA):
+      STEAM_AUDIO_DRIVER=alsa
+      STEAM_AUDIO_DEVICE=hw:0,0
diff -urNd steam-1.0.0.39.orig/debian/scripts/steam steam-1.0.0.39/debian/scripts/steam
--- steam-1.0.0.39.orig/debian/scripts/steam	2013-05-28 05:26:58.000000000 +1000
+++ steam-1.0.0.39/debian/scripts/steam	2013-09-30 13:32:19.000000000 +1000
@@ -8,6 +8,16 @@
 ubuntu32=$config/ubuntu12_32
 exe=$ubuntu32/steam
 
+# Load system-wide and per-user configuration
+if [ -f /etc/default/steam -a -r /etc/default/steam ]; then
+	. /etc/default/steam
+fi
+if [ -f "${config}/defaults" -a -r "${config}/defaults" ]; then
+	. "${config}/defaults"
+fi
+[ -z "$STEAM_AUDIO_DRIVER" ] || export SDL_AUDIODRIVER="$STEAM_AUDIO_DRIVER"
+[ -z "$STEAM_AUDIO_DEVICE" ] || export AUDIODEV="$STEAM_AUDIO_DEVICE"
+
 # launch steam / do an initial update when the exe does not already exist
 test ! -d $config && rm -rf $config && mkdir -p $config || true
 test ! -e $config/steam.sh && rm -rf $config/package $exe || true

Reply via email to