summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/soundconfig.sh
diff options
context:
space:
mode:
authorCecil Hugh Watson <knoppmyth@gmail.com>2009-09-26 01:57:08 (GMT)
committerCecil Hugh Watson <knoppmyth@gmail.com>2009-09-26 01:57:08 (GMT)
commit7b29169fff9e7c624890c5edffe85def8a293136 (patch)
tree47753889faa3a2063b66d1c7e7681e703eb1b39a /abs/core/LinHES-config/soundconfig.sh
parentc491dea779dac29afff3578bf8245943817c2339 (diff)
downloadlinhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.zip
linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.tar.gz
linhes_pkgbuild-7b29169fff9e7c624890c5edffe85def8a293136.tar.bz2
LinHES 6.01.00
Diffstat (limited to 'abs/core/LinHES-config/soundconfig.sh')
-rwxr-xr-xabs/core/LinHES-config/soundconfig.sh254
1 files changed, 254 insertions, 0 deletions
diff --git a/abs/core/LinHES-config/soundconfig.sh b/abs/core/LinHES-config/soundconfig.sh
new file mode 100755
index 0000000..75998d6
--- /dev/null
+++ b/abs/core/LinHES-config/soundconfig.sh
@@ -0,0 +1,254 @@
+#!/bin/bash
+. /etc/systemconfig
+. /etc/profile
+echo $@ >/tmp/audio.call
+#set -x
+BASE=""
+. /etc/profile
+#TEMPLATES="/usr/share/templates"
+#TESTFILE="$TEMPLATES/audio/space_battle_A.wav"
+TESTFILE="/usr/share/sounds/alsa/Front_Center.wav"
+OSSinstalled="false"
+
+function testaudio () {
+
+ossplay -d$AUDIODEVICE $TESTFILE
+
+}
+
+function load_alsa() {
+
+ remove_service.sh alsa-utils
+# cd /lib/modules/2.6.21-STB
+ KER=`uname -r`
+ cd /lib/modules/$KER/kernel/
+ tar -xvf /lib/modules/alsa-$KER.tar
+ pacman -Sf --noconfirm alsa-lib
+
+ depmod -a
+ cd -
+ udevadm trigger
+ udevadm settle
+ udevadm trigger
+
+ add_service.sh alsa-utils
+ sleep 4
+ sv start alsa-utils
+}
+
+
+function unload_alsa () {
+#kill $(lsof -t /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*) && modprobe -r $(lsmod |grep ^snd |awk '{print $1}')
+ sv stop alsa-utils
+ remove_service.sh alsa-utils
+ rm -rf /dev/adsp*
+ rm -rf /dev/snd/*
+ rm -rf /dev/audio
+ modprobe -r $(lsmod |grep ^snd |awk '{print $1}')
+}
+
+function unload_oss {
+ sv stop oss
+ soundoff
+ rm -rf /dev/dsp*
+ rm -rf /dev/oss*
+ rm -rf /dev/sndstat
+ remove_service.sh oss
+}
+
+function installOSS {
+ echo "installing oss"
+ pacman -Q oss 2>/dev/null
+ if [ ! $? = 0 ]
+ then
+ pacman --noconfirm -Sf oss
+ fi
+ add_service.sh oss
+ sleep 4
+ sv start oss
+}
+
+
+function SYNCXINE {
+echo "modify xine config file"
+ if [ -f /data/home/mythtv/.xine/config ]
+ then
+ cp -f /data/home/mythtv/.xine/config $TEMPLATES/xine.config
+ else
+ cp $TEMPLATES/xine.config.template $TEMPLATES/xine.config
+ fi
+
+ if [ x$Audiotype = xOSS ]
+ then
+ DEVICENUMBER=`echo $SoundDevice|awk -F/ ' { print $3 } '|tr -d dsp `
+ sed -e "s/^.*audio.driver.*$/audio.driver:oss/" \
+ -e "s/^.audio.device.oss_device_name.*$/audio.device.oss_device_name:\/dev\/dsp/" \
+ -e "s/^.audio.devic.oss_device_number.*$/audio.device.oss_device_number:$DEVICENUMER/" \
+ -e "s/^.*audio.output.speaker_arrangement:.*$/Audio.output.speaker_arrangement:PassThrough/" \
+ $TEMPLATES/xine.config > /data/home/mythtv/.xine/config
+ else
+ cp $TEMPLATES/xine.config /data/home/mythtv/.xine/config
+ fi
+
+}
+
+function SYNCMPLAYER {
+echo "modify mplayer not implmented yet"
+}
+
+function SYNCMYTHMUSIC {
+echo "sync mythmusic"
+$MV_ROOT/bin/restore_default_settings.sh -c MUSICMYTH
+}
+
+function SYNCMYTHFRONTEND {
+echo "sync mythfrontend"
+$MV_ROOT/bin/restore_default_settings.sh -c MUSICFRONT
+}
+
+
+function checkOSSinstalled () {
+ ossinfo |grep Version |grep -q OSS >/dev/null
+ resultcode=$?
+ echo $resultcode
+ if [ $resultcode = 0 ]
+ then
+ OSSinstalled='true'
+ else
+ OSSinstalled='false'
+ fi
+}
+
+function sound_config_system {
+
+ if [ x$syncXine = x1 ]
+ then
+ SYNCXINE
+ fi
+ if [ x$syncMplayer = x1 ]
+ then
+ SYNCMPLAYER
+ fi
+ if [ x$syncMythMusic = x1 ]
+ then
+ SYNCMYTHMUSIC
+ fi
+ if [ x$syncMythFrontend = x1 ]
+ then
+ SYNCMYTHFRONTEND
+ fi
+
+}
+
+function loadsound (){
+ checkOSSinstalled
+ if [ x$AUDIOTYPE = xOSS -o x$AUDIOTYPE = xoss ]
+ #then
+ # if [ $OSSinstalled = "false" ]
+ then
+ while [ $OSSinstalled = "false" ]
+ do
+ unload_alsa
+ rm /tmp/.alsatest
+ installOSS
+ installOSS
+ sleep 2
+ checkOSSinstalled
+ done
+ # fi
+ else
+ touch /tmp/.alsatest
+ unload_oss
+ load_alsa
+ load_alsa
+ rm /tmp/.alsatest
+
+ fi
+
+}
+
+
+
+
+#####################MAIN PROGRAM##########################
+
+declare -r OPTSTRING="i:t:d:"
+
+if [ $# -eq 0 ]
+then
+ echo "Valid options are:"
+ echo " -i (oss|alsa) oss or alsa subsystem "
+ echo " -t (test|real|LOAD) "
+ echo " -d device"
+ exit 1
+fi
+
+
+
+
+while getopts "$OPTSTRING" SWITCH
+do
+ case $SWITCH in
+ \?) echo "unkown option"
+ exit 11 ;;
+ i) echo "$SWITCH" "$OPTARG"
+ AUDIOTYPE="$OPTARG"
+ ;;
+ d) echo "$SWITCH" "$OPTARG"
+ AUDIODEVICE=$OPTARG
+ ;;
+ t) echo "$SWITCH" "$OPTARG"
+ SOUNDOPTYPE="$OPTARG"
+ if [ x"$OPTARG" = xtest ]
+ then
+ TEST=true
+ else
+ TEST=false
+ fi
+
+
+ ;;
+
+ esac
+done
+
+
+
+
+case $SOUNDOPTYPE in
+ REAL|real )
+ loadsound
+ sound_config_system
+ ;;
+ test|TEST)
+ echo $@ > /tmp/audio.test
+ #loadsound
+ if [ x$AUDIOTYPE = xOSS -o x$AUDIOTYPE = xoss ]
+ then
+ echo "testing OSS $AUDIODEVICE "
+ ossplay -d$AUDIODEVICE $TESTFILE
+ else
+ echo "testing ALSA $AUDIODEVICE "
+ aplay --device=$AUDIODEVICE $TESTFILE
+ fi
+
+ ;;
+
+ LOAD|load)
+ loadsound
+ ;;
+ esac
+
+
+exit 0
+
+
+
+
+
+
+
+
+
+
+