Daniel Drake 5a9cd21
From: Daniel Drake <dsd@laptop.org>
Daniel Drake 5a9cd21
To: <bert@freudenbergs.de>
Daniel Drake 5a9cd21
Message-Id: <20130327191008.892E6FA976@dev.laptop.org>
Daniel Drake 5a9cd21
Date: Wed, 27 Mar 2013 15:10:08 -0400 (EDT)
Daniel Drake 5a9cd21
X-Spam-Status: No, score=-3.6 required=3.5 tests=RCVD_IN_DNSWL_MED,
Daniel Drake 5a9cd21
	RP_MATCHES_RCVD autolearn=unavailable version=3.3.2
Daniel Drake 5a9cd21
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
Daniel Drake 5a9cd21
	sunjammer.sugarlabs.org
Daniel Drake 5a9cd21
X-Topics: Patches and patch reviews
Daniel Drake 5a9cd21
Cc: sugar-devel@lists.sugarlabs.org
Daniel Drake 5a9cd21
Subject: [Sugar-devel] [PATCH Etoys] Use ALSA sound backend if available
Daniel Drake 5a9cd21
X-BeenThere: sugar-devel@lists.sugarlabs.org
Daniel Drake 5a9cd21
X-Mailman-Version: 2.1.13
Daniel Drake 5a9cd21
MIME-Version: 1.0
Daniel Drake 5a9cd21
Content-Type: text/plain; charset="us-ascii"
Daniel Drake 5a9cd21
Content-Transfer-Encoding: 7bit
Daniel Drake 5a9cd21
Sender: sugar-devel-bounces@lists.sugarlabs.org
Daniel Drake 5a9cd21
Errors-To: sugar-devel-bounces@lists.sugarlabs.org
Daniel Drake 5a9cd21
Daniel Drake 5a9cd21
Extend the sound backend selection code to consider using ALSA.
Daniel Drake 5a9cd21
On XO-1.75 and XO-4 this fixes sound in etoys with squeak-vm-4.x.
Daniel Drake 5a9cd21
It also fixes XO-4 sound recording which was not working on any previous
Daniel Drake 5a9cd21
version.
Daniel Drake 5a9cd21
Daniel Drake 5a9cd21
Index: etoys-5.0.2408/etoys.in
Daniel Drake 5a9cd21
===================================================================
Daniel Drake 5a9cd21
--- etoys-5.0.2408.orig/etoys.in	2013-03-27 15:06:22.000000000 -0400
Daniel Drake 5a9cd21
+++ etoys-5.0.2408/etoys.in	2013-03-27 15:06:33.000000000 -0400
Daniel Drake 5a9cd21
@@ -6,6 +6,7 @@
Daniel Drake 5a9cd21
 
Daniel Drake 5a9cd21
 VM="squeak"
Daniel Drake 5a9cd21
 VMOPTIONS="-encoding UTF-8 -vm-display-x11 -xshm"
Daniel Drake 5a9cd21
+VMSOUND=""
Daniel Drake 5a9cd21
 IMAGE="@prefix@/share/etoys/etoys.image"
Daniel Drake 5a9cd21
 IMOPTIONS=""
Daniel Drake 5a9cd21
 DOCUMENT=""
Daniel Drake 5a9cd21
@@ -85,18 +86,24 @@
Daniel Drake 5a9cd21
 # make Compose input methods work
Daniel Drake 5a9cd21
 [ -z "$LC_ALL" ] && export LC_ALL="$LANG"
Daniel Drake 5a9cd21
 
Daniel Drake 5a9cd21
-# if pulseaudio is running, use it if VM has the driver, or fall back to OSS
Daniel Drake 5a9cd21
+# if pulseaudio is running, use it if VM has the driver
Daniel Drake 5a9cd21
 if pulseaudio --check 2>/dev/null ; then
Daniel Drake 5a9cd21
     if "$VM" -help 2> /dev/null | grep -q vm-sound-pulse ; then
Daniel Drake 5a9cd21
-        VMOPTIONS="$VMOPTIONS -vm-sound-pulse"
Daniel Drake 5a9cd21
+        VMSOUND="-vm-sound-pulse"
Daniel Drake 5a9cd21
     else
Daniel Drake 5a9cd21
-        VMOPTIONS="$VMOPTIONS -vm-sound-oss"
Daniel Drake 5a9cd21
         if padsp true 2>/dev/null ; then
Daniel Drake 5a9cd21
+            VMSOUND="-vm-sound-oss"
Daniel Drake 5a9cd21
             WRAPPER=padsp
Daniel Drake 5a9cd21
         fi
Daniel Drake 5a9cd21
     fi
Daniel Drake 5a9cd21
 fi
Daniel Drake 5a9cd21
 
Daniel Drake 5a9cd21
+# Otherwise use ALSA if available
Daniel Drake 5a9cd21
+[ -z "$VMSOUND" -a -e /proc/asound/cards ] && VMSOUND="-vm-sound-ALSA"
Daniel Drake 5a9cd21
+
Daniel Drake 5a9cd21
+# Fall back on OSS
Daniel Drake 5a9cd21
+[ -n "$VMSOUND" ] || VMSOUND="-vm-sound-oss"
Daniel Drake 5a9cd21
+
Daniel Drake 5a9cd21
 # enable compositioninput 
Daniel Drake 5a9cd21
 case "$LANG" in 
Daniel Drake 5a9cd21
     bn* | gu* | hi* | kn* | ml* | mr* | ta* | te* | sa* )
Daniel Drake 5a9cd21
@@ -110,5 +117,5 @@
Daniel Drake 5a9cd21
 
Daniel Drake 5a9cd21
 # VM, Image, and Document are non-optional
Daniel Drake 5a9cd21
 # Document has to be present even if empty for IMOPTIONS to work
Daniel Drake 5a9cd21
-$DEBUG $WRAPPER "$VM" $VMOPTIONS "$IMAGE" "$DOCUMENT" $IMOPTIONS
Daniel Drake 5a9cd21
-exec $WRAPPER "$VM" $VMOPTIONS "$IMAGE" "$DOCUMENT" $IMOPTIONS
Daniel Drake 5a9cd21
+$DEBUG $WRAPPER "$VM" $VMOPTIONS $VMSOUND "$IMAGE" "$DOCUMENT" $IMOPTIONS
Daniel Drake 5a9cd21
+exec $WRAPPER "$VM" $VMOPTIONS $VMSOUND "$IMAGE" "$DOCUMENT" $IMOPTIONS