diff options
Diffstat (limited to 'abs/core/LinHES-config/soundconfig.sh')
-rwxr-xr-x | abs/core/LinHES-config/soundconfig.sh | 220 |
1 files changed, 98 insertions, 122 deletions
diff --git a/abs/core/LinHES-config/soundconfig.sh b/abs/core/LinHES-config/soundconfig.sh index f682465..38687a4 100755 --- a/abs/core/LinHES-config/soundconfig.sh +++ b/abs/core/LinHES-config/soundconfig.sh @@ -17,9 +17,7 @@ echo "---------------------------------------" function testaudio () { - -ossplay -d$AUDIODEVICE $TESTFILE - + ossplay -d$AUDIODEVICE $TESTFILE } function load_alsa() { @@ -29,7 +27,7 @@ function load_alsa() { cd /lib/modules/$KER/ echo " uncompressing ALSA modules" tar -xf sound-preoss.tar.bz2 -# echo " installing alsa-lib" + #echo " installing alsa-lib" #pacman -S --force --noconfirm alsa-lib echo " uninstalling oss" @@ -50,7 +48,7 @@ function load_alsa() { function unload_alsa () { echo "unloading ALSA ..." -#kill $(lsof -t /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*) && modprobe -r $(lsmod |grep ^snd |awk '{print $1}') + #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* @@ -81,13 +79,11 @@ function installOSS { add_service.sh oss echo "blacklist soundcore" > $BLACKLIST echo "install soundcore /bin/false" >> $BLACKLIST - - } function SYNCXINE { -echo "modify xine config file" + echo "modify xine config file" if [ -f $MYTHHOME/.xine/config ] then cp -f $MYTHHOME/.xine/config $TEMPLATES/xine.config @@ -106,85 +102,82 @@ echo "modify xine config file" else cp $TEMPLATES/xine.config $MYTHHOME/.xine/config fi - } function SYNCMPLAYER { -echo "modify mplayer not implmented yet" + echo "modify mplayer config file" + if [ -f /etc/mplayer/mplayer.conf ] + then + backdate=`date +%b-%d-%Y-%H:%M:%S` + mv /etc/mplayer/mplayer.conf /etc/mplayer/mplayer.conf-$backdate + fi + if [ x$AUDIOTYPE = xALSA -o x$AUDIOTYPE = xalsa ] + then + MPLAYERDEVICE=`echo $AUDIODEVICE | tr : = | tr , .` + echo "ao=alsa:device=$MPLAYERDEVICE" > /etc/mplayer/mplayer.conf + echo "ac=hwac3,hwdts," >> /etc/mplayer/mplayer.conf + else + echo "ao=oss:$AUDIODEVICE" > /etc/mplayer/mplayer.conf + fi } -function SYNCMYTHMUSIC { -echo "sync mythmusic" -$MV_ROOT/bin/restore_default_settings.sh -c MUSICMYTH -} +function checkOSSinstalled () { + echo "Checking if OSS is installed" + ossinfo |grep Version |grep -q OSS >/dev/null + resultcode=$? -function SYNCMYTHFRONTEND { -echo "sync mythfrontend" -$MV_ROOT/bin/restore_default_settings.sh -c MUSICFRONT + if [ $resultcode = 0 ] + then + OSSinstalled='true' + echo " OSS is loaded" + else + OSSinstalled='false' + echo " OSS is NOT loaded" + fi } - -function checkOSSinstalled () { - echo "Checking if OSS is installed" - ossinfo |grep Version |grep -q OSS >/dev/null - resultcode=$? - - if [ $resultcode = 0 ] - then - OSSinstalled='true' - echo " OSS is loaded" - else - OSSinstalled='false' - echo " OSS is NOT loaded" - fi +function write_asound { + echo "writing asound.conf file" + if [ -f /etc/asound.conf ] + then + backdate=`date +%b-%d-%Y-%H:%M:%S` + mv /etc/asound.conf /etc/asound.conf-$backdate + fi + echo 'pcm.!default "'"$AUDIODEVICE"'"' > /etc/asound.conf } function sound_config_system { - - SYNCMYTHFRONTEND + if [ x$AUDIOTYPE = xALSA -o x$AUDIOTYPE = xalsa ] + then + write_asound + fi + SYNCMPLAYER # 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 ] + checkOSSinstalled + if [ x$AUDIOTYPE = xOSS -o x$AUDIOTYPE = xoss ] + then + while [ $OSSinstalled = "false" ] + do + unload_alsa + if [ -e /tmp/.alsatest ] then - while [ $OSSinstalled = "false" ] - do - unload_alsa - if [ -e /tmp/.alsatest ] - then - rm /tmp/.alsatest - fi - installOSS - checkOSSinstalled - done - # fi - else - touch /tmp/.alsatest - unload_oss - load_alsa - #load_alsa - rm /tmp/.alsatest - - fi - + rm /tmp/.alsatest + fi + installOSS + checkOSSinstalled + done + else + touch /tmp/.alsatest + unload_oss + load_alsa + rm /tmp/.alsatest + fi } @@ -209,67 +202,50 @@ fi while getopts "$OPTSTRING" SWITCH do case $SWITCH in - \?) echo "unknown 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 + \?) echo "unknown 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 - ;; + #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 " - echo aplay --device=$AUDIODEVICE $TESTFILE - aplay -d=$AUDIODEVICE $TESTFILE - fi - - ;; - + 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 " + echo aplay --device=$AUDIODEVICE $TESTFILE + aplay --device=$AUDIODEVICE $TESTFILE + fi + ;; LOAD|load) - loadsound - ;; - esac - + loadsound + ;; +esac exit 0 - - - - - - - - - - - |