[Sugar-devel] [PATCH Etoys] Use ALSA sound backend if available
Daniel Drake
dsd at laptop.org
Wed Mar 27 15:10:08 EDT 2013
Extend the sound backend selection code to consider using ALSA.
On XO-1.75 and XO-4 this fixes sound in etoys with squeak-vm-4.x.
It also fixes XO-4 sound recording which was not working on any previous
version.
Index: etoys-5.0.2408/etoys.in
===================================================================
--- etoys-5.0.2408.orig/etoys.in 2013-03-27 15:06:22.000000000 -0400
+++ etoys-5.0.2408/etoys.in 2013-03-27 15:06:33.000000000 -0400
@@ -6,6 +6,7 @@
VM="squeak"
VMOPTIONS="-encoding UTF-8 -vm-display-x11 -xshm"
+VMSOUND=""
IMAGE="@prefix@/share/etoys/etoys.image"
IMOPTIONS=""
DOCUMENT=""
@@ -85,18 +86,24 @@
# make Compose input methods work
[ -z "$LC_ALL" ] && export LC_ALL="$LANG"
-# if pulseaudio is running, use it if VM has the driver, or fall back to OSS
+# if pulseaudio is running, use it if VM has the driver
if pulseaudio --check 2>/dev/null ; then
if "$VM" -help 2> /dev/null | grep -q vm-sound-pulse ; then
- VMOPTIONS="$VMOPTIONS -vm-sound-pulse"
+ VMSOUND="-vm-sound-pulse"
else
- VMOPTIONS="$VMOPTIONS -vm-sound-oss"
if padsp true 2>/dev/null ; then
+ VMSOUND="-vm-sound-oss"
WRAPPER=padsp
fi
fi
fi
+# Otherwise use ALSA if available
+[ -z "$VMSOUND" -a -e /proc/asound/cards ] && VMSOUND="-vm-sound-ALSA"
+
+# Fall back on OSS
+[ -n "$VMSOUND" ] || VMSOUND="-vm-sound-oss"
+
# enable compositioninput
case "$LANG" in
bn* | gu* | hi* | kn* | ml* | mr* | ta* | te* | sa* )
@@ -110,5 +117,5 @@
# VM, Image, and Document are non-optional
# Document has to be present even if empty for IMOPTIONS to work
-$DEBUG $WRAPPER "$VM" $VMOPTIONS "$IMAGE" "$DOCUMENT" $IMOPTIONS
-exec $WRAPPER "$VM" $VMOPTIONS "$IMAGE" "$DOCUMENT" $IMOPTIONS
+$DEBUG $WRAPPER "$VM" $VMOPTIONS $VMSOUND "$IMAGE" "$DOCUMENT" $IMOPTIONS
+exec $WRAPPER "$VM" $VMOPTIONS $VMSOUND "$IMAGE" "$DOCUMENT" $IMOPTIONS
More information about the Sugar-devel
mailing list