From 64de605c2bbf7fea4c80fe803bb229593d9fafbf Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Mon, 17 Feb 2014 23:54:00 +0000 Subject: mythinstall: Audio Settings cleanups. HDMI is detected as Digital. refs #960 LinHES-config: systemconfig.py: remove tinker from audio config soundconfig.sh: fix aplay cmd flag for testing audio. Add asound.conf and mplayer.conf creation using the seleted default devices. --- abs/core/LinHES-config/PKGBUILD | 6 +- abs/core/LinHES-config/soundconfig.sh | 220 +++++++++------------ abs/core/LinHES-config/systemconfig.py | 26 ++- .../mythinstall/installsettings.cpp | 73 ++++--- abs/core/mythinstall/PKGBUILD | 2 +- 5 files changed, 160 insertions(+), 167 deletions(-) diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index a47d7ea..9b0f11a 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=8.1 -pkgrel=11 +pkgrel=12 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config ) pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' @@ -146,7 +146,7 @@ md5sums=('e4faaa3d5f180d796e200b701048b008' 'b596d2e3779a434435bc0f0277b1ba3e' '5012fbd31d205a6d6b0a1d8caf3eba8f' '157e73d0f90d7b306aba8f5921aeedd3' - 'a805504b6593eaa416fe5f32cd4d1b9e' + 'f8f803cb5738ce0021cd37c1ab514c45' '952af1c0a44579c04a405ffce9aed264' '5f890ea9bda6aef652d2560ca19dac07' 'ab2aa42c2947148c2b1cac0ade6d1d55' @@ -171,7 +171,7 @@ md5sums=('e4faaa3d5f180d796e200b701048b008' '299c24c0820fc9c483c820db2595e3cb' 'cf51cb22e23218ae7e9b55cac1ba3a7f' '781f161a79c3188a31c8615b8258b241' - '70749be12c98d4b8fd283bd5dd9182bb' + '18370d92ba6b467bcc4996c377e1fa1f' '2596460462cf6c889cf8f95485537b20' 'dc3c5270691a62600475705f4cb78b56' '4804aa93aaad3dfcfff08cd9ffd68836' 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 - - - - - - - - - - - diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py index 1af9daf..ed19675 100755 --- a/abs/core/LinHES-config/systemconfig.py +++ b/abs/core/LinHES-config/systemconfig.py @@ -296,21 +296,17 @@ def main(argv): logging.info("____Skipping of Audio, config disabled____") else: logging.debug("______Start of Audio Configuration______") - if not systemconfig.get("Audiotype") == "tinker": - if cmdmodule["this_is_install"]: - if systemconfig.get("Audiotype") == "OSS": - mv_common.pacinstall("oss") - mv_common.add_service("oss") - - cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT, - systemconfig.get("Audiotype"), - systemconfig["SoundDevice"]) - mv_common.runcmd(cmd) - - mv_common.reloadfe(systemconfig.get("dbhost"),restartlcd) - else: - logging.debug(" Tinker mode(audio), not changing configuration") - logging.debug("__End of audio") + if cmdmodule["this_is_install"]: + if systemconfig.get("Audiotype") == "OSS": + mv_common.pacinstall("oss") + mv_common.add_service("oss") + + cmd="%s/bin/soundconfig.sh -t real -i %s -d %s" %(MVROOT, + systemconfig.get("Audiotype"), + systemconfig["SoundDevice"]) + mv_common.runcmd(cmd) + mv_common.reloadfe(systemconfig.get("dbhost"),restartlcd) + logging.debug("__End of audio") if cmdmodule["misc"]: if mv_common.read_config(mv_common.module_config,"misc") == False : diff --git a/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp b/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp index 2e505f1..fb5f841 100755 --- a/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp +++ b/abs/core/mythinstall/MythVantage-app/mythinstall/installsettings.cpp @@ -2800,9 +2800,8 @@ SoundSettings::SoundSettings(): HostAudiotype->setLabel(QObject::tr("Sound Card Driver")); HostAudiotype->addSelection("OSS"); HostAudiotype->addSelection("ALSA"); - HostAudiotype->addSelection("tinker"); - HostAudiotype->setHelpText(QObject::tr("Select the sound driver, OSS or ALSA." ) ); + HostAudiotype->setHelpText(QObject::tr("Select the sound driver, ALSA or OSS." ) ); addChild(HostAudiotype); setTrigger(HostAudiotype); @@ -2835,34 +2834,32 @@ SoundSettings::SoundSettings(): HorizontalConfigurationGroup *lpalsa = new HorizontalConfigurationGroup(false, false, true, true); TransButtonSetting *LoadOSSbutton = new TransButtonSetting(); - LoadOSSbutton->setLabel(tr("Load OSS driver")); + LoadOSSbutton->setLabel(tr("Load OSS Driver")); TransButtonSetting *LoadALSAbutton = new TransButtonSetting(); - LoadALSAbutton->setLabel(tr("Load ALSA driver")); + LoadALSAbutton->setLabel(tr("Load ALSA Driver")); TransButtonSetting *TestAudiobutton = new TransButtonSetting(); - TestAudiobutton->setLabel(tr("Test Audio Settings")); + TestAudiobutton->setLabel(tr("Test Device")); + TestAudiobutton->setHelpText(QObject::tr("Will play a sound using the selected default device.")); lp->addChild(TestAudiobutton); lp->addChild(LoadOSSbutton); TransButtonSetting *TestALSAAudiobutton = new TransButtonSetting(); - TestALSAAudiobutton->setLabel(tr("Test ALSA Audio Settings")); + TestALSAAudiobutton->setLabel(tr("Test Device")); + TestALSAAudiobutton->setHelpText(QObject::tr("Will play a sound using the selected default device.")); lpalsa->addChild(TestALSAAudiobutton); lpalsa->addChild(LoadALSAbutton); TransLabelSetting *osslabel = new TransLabelSetting(); - osslabel->setValue("The original OSS! More information can be found at:"); - - TransLabelSetting *osslabel1 = new TransLabelSetting(); - osslabel1->setValue("http://www.opensound.com \n\nPlease note to fully configure sound visit the \nMythTV audio setup.\n"); + osslabel->setValue("OSS- Open Sound System\nhttp://opensound.com\n\nTo configure sound for MythTV go to:\nService Menu --> MythTV Settings --> Setup --> Audio\n"); TransLabelSetting *AlsaLabel = new TransLabelSetting(); - AlsaLabel->setValue("ALSA, the alternative to OSS\n\nPlease note to fully configure sound visit the \nMythTV audio setup.\n"); + AlsaLabel->setValue("ALSA - Advanced Linux Sound Architecture\nhttp://alsa-project.org\n\nTo configure sound for MythTV go to:\nService Menu --> MythTV Settings --> Setup --> Audio\n"); // OSS GROUP SoundOSSsettings *OSS = new SoundOSSsettings ; ConfigurationGroup* osssettings = new VerticalConfigurationGroup(false); osssettings->addChild(osslabel); - osssettings->addChild(osslabel1); osssettings->addChild(OSS); // osssettings->addChild(syncboxes); osssettings->addChild(lp); @@ -2889,7 +2886,6 @@ SoundSettings::SoundSettings(): ALSA, SLOT(loadalsadriver())); addTarget("ALSA", alsasettings); addTarget("OSS", osssettings); - addTarget("tinker", new VerticalConfigurationGroup(false)); }; @@ -2898,13 +2894,17 @@ SoundOSSsettings::SoundOSSsettings(): { SetVertical(true); HostSoundTypeout = new HostComboBox("HostSoundTypeout"); - HostSoundTypeout->setLabel(QObject::tr("Type")); + HostSoundTypeout->setLabel(QObject::tr("Audio Type")); HostSoundTypeout->addSelection("Analog"); HostSoundTypeout->addSelection("Digital"); - HostSoundTypeout->setHelpText(QObject::tr("")); + HostSoundTypeout->setHelpText(QObject::tr("Select the connection type, Analog or Digital.")); HostSoundOssAnalog = new HostComboBox("HostSoundOssAnalog"); + HostSoundOssAnalog->setLabel(QObject::tr("Default Device")); + HostSoundOssAnalog->setHelpText(QObject::tr("Select the default audio output device for the system.")); HostSoundOssDigital = new HostComboBox("HostSoundOssDigital"); + HostSoundOssDigital->setLabel(QObject::tr("Default Device")); + HostSoundOssDigital->setHelpText(QObject::tr("Select the default audio output device for the system.")); fillossselection(); int findossanalog=HostSoundOssAnalog->findSelection(hostparm.OLDHostSoundOSSAnalog ); int findossdigital=HostSoundOssDigital->findSelection(hostparm.OLDHostSoundOSSDigital ); @@ -2921,13 +2921,17 @@ SoundALSAsettings::SoundALSAsettings(): { SetVertical(true); HostSoundALSATypeout = new HostComboBox("HostSoundALSATypeout"); - HostSoundALSATypeout->setLabel(QObject::tr("Type")); + HostSoundALSATypeout->setLabel(QObject::tr("Audio Type")); HostSoundALSATypeout->addSelection("Analog"); HostSoundALSATypeout->addSelection("Digital"); - HostSoundALSATypeout->setHelpText(QObject::tr("")); + HostSoundALSATypeout->setHelpText(QObject::tr("Select the connection type, Analog or Digital.")); HostSoundALSAAnalog = new HostComboBox("HostSoundALSAAnalog"); + HostSoundALSAAnalog->setLabel(QObject::tr("Default Device")); + HostSoundALSAAnalog->setHelpText(QObject::tr("Select the default audio output device for the system. Chrome, aplay and other programs that use the default system device for audio will use this device. Mplayer will be set to use this device.")); HostSoundALSADigital = new HostComboBox("HostSoundALSADigital"); + HostSoundALSADigital->setLabel(QObject::tr("Default Device")); + HostSoundALSADigital->setHelpText(QObject::tr("Select the default audio output device for the system. Chrome, aplay and other programs that use the default system device for audio will use this device. Mplayer will be set to use this device.")); fillALSAselection(); int findalsaanalog=HostSoundALSAAnalog->findSelection(hostparm.OLDHostSoundALSAAnalog ); int findalsadigital=HostSoundALSADigital->findSelection(hostparm.OLDHostSoundALSADigital ); @@ -3143,10 +3147,10 @@ void SoundALSAsettings::fillALSAselection() break; } //card 0: I82801DBICH4:q [Intel 82801DB-ICH4], device 0: Intel ICH [Intel 82801DB-ICH4] - alsadescription=line.section( "," , 0 ,0 ); + alsadescription=line.section( ", " , 0 ,0 ); alsadescription=alsadescription.section(":",1,1); - alsadescription2=line.section( "," , 1 ,1 ); + alsadescription2=line.section( ", " , 1 ,1 ); //alsadescription2=alsadescription.section(":",0,0); hwdevice=line.section( ":" , 0 ,0 ); @@ -3157,16 +3161,33 @@ void SoundALSAsettings::fillALSAselection() temphwdevice=temphwdevice.section(" ",-1,-1 ); hwdevice.append(","); hwdevice.append(temphwdevice); - simpleitem=alsadescription2 + "(hw:" + hwdevice + ")"; - if (line.contains("IEC958") || line.contains("Digital")) + simpleitem=alsadescription2 + "(plughw:" + hwdevice + ")"; + if (line.contains("IEC958") || line.contains("Digital") || line.contains("PCM") || line.contains("HDMI")) HostSoundALSADigital->addSelection(simpleitem); else HostSoundALSAAnalog->addSelection(simpleitem); } } } + myth_system("aplay -L > /tmp/alsapcm"); + currentfile = "/tmp/alsapcm"; + QFile file1(currentfile); + if ( file1.open(QIODevice::ReadOnly | QIODevice::Text) ) + { + Q3TextStream t( &file1 ); // use a text stream + while ( !t.eof() ) + { + line = t.readLine(); + if (line.startsWith("iec958:") ) + { + alsadescription=line; + simpleitem=alsadescription + "(plug:iec958)"; + HostSoundALSADigital->addSelection(simpleitem); + break; + } + } + } return ; - } void SoundSettings::soundossgathersettings_1 (void) @@ -3215,7 +3236,7 @@ void SoundOSSsettings::soundossgathersettings(void) cmdtxt.append("bin/soundconfig.sh -t test -i OSS -d " + hostparm.ThisHostSoundDevice + "&"); system(cmdtxt); int return_code = 0; - QString msgtext = "Playing sample audio" ; + QString msgtext = "Playing Test Audio" ; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); @@ -3293,10 +3314,10 @@ void SoundALSAsettings::soundalsagathersettings(void) // Add info popup right here QString cmdtxt; cmdtxt=MV_ROOT ; - cmdtxt.append("bin/soundconfig.sh -t test -i ALSA -d " + hostparm.ThisHostSoundDevice + "&"); + cmdtxt.append("bin/soundconfig.sh -t test -i ALSA -d " + hostparm.ThisHostSoundDevice + "&"); system(cmdtxt); int return_code = 0; - QString msgtext = "Playing sample audio" ; + QString msgtext = "Playing Test Audio" ; MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); MythUIBusyDialog *busyPopup = new MythUIBusyDialog(msgtext, popupStack,"installbusy"); if (busyPopup->Create()) @@ -3521,7 +3542,7 @@ void run_systemconfig(QString modulelist, bool restart, QString dbcommand) cmdtxt.append("bin/systemconfig.sh " + modulelist + " &"); myth_system(cmdtxt); int return_code = 0; - QString msgtext = "Please wait while " ; + QString msgtext = "Please wait while " ; msgtext.append(gCoreContext->GetSetting("HostMyhostname")); msgtext.append(" is configured"); MythScreenStack *popupStack = GetMythMainWindow()->GetStack("popup stack"); diff --git a/abs/core/mythinstall/PKGBUILD b/abs/core/mythinstall/PKGBUILD index 19bdf68..c851516 100644 --- a/abs/core/mythinstall/PKGBUILD +++ b/abs/core/mythinstall/PKGBUILD @@ -1,7 +1,7 @@ # Maintainer: Jams pkgname=mythinstall pkgver=8.1 -pkgrel=9 +pkgrel=10 pkgdesc="LinHES installer/systemconfig GUI." arch=('i686' 'x86_64') depends=('mythtv>=0.27') -- cgit v0.12