<br><br><div class="gmail_quote">On Fri, Nov 14, 2008 at 3:29 AM, Michael T. Dean <span dir="ltr">&lt;<a href="mailto:mtdean@thirdcontact.com">mtdean@thirdcontact.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On 11/14/2008 01:41 AM, Nick Morrott wrote:<br>
&gt; One way to accomplish this across all of MythTV is to disable &quot;Use<br>
&gt; internal volume controls&quot; in the particular mythfrontend&#39;s<br>
&gt; configuration. You can bind your VOL+/VOL- remote keys to scripts<br>
&gt; which control the ALSA system/PCM volume using amixer directly.<br>
&gt;<br>
&gt; A script which increases the ALSA PCM volume by 5% each time it is<br>
&gt; called could be:<br>
&gt;<br>
&gt; #!/bin/bash<br>
&gt; /path/to/amixer - c 0 set PCM 5%+<br>
&gt;<br>
<br>
</div>Though an approach like this will have issues when running up against<br>
the limits (i.e. 0% or 100%) and can get &quot;stuck&quot; due to rounding error,<br>
depending on the card/resolution of the volume slider. &nbsp;I posted a<br>
script a while ago (<br>
<a href="http://www.gossamer-threads.com/lists/mythtv/users/216149#216149" target="_blank">http://www.gossamer-threads.com/lists/mythtv/users/216149#216149</a> ) that<br>
handles these and many other issues, and have improved it since (see<br>
attached).<br>
<div class="Ih2E3d"><br>
&gt; The amixer manpage contains the details. These will not show anything<br>
&gt; on the screen (so not trigger the OSD)<br>
<br>
</div>The script I posted will (the current one using either mythtvosd or<br>
xosd&#39;s osd_cat). &nbsp;;)<br>
<br>
You&#39;ll need to configure the script by editing the variable values at<br>
the top as described in the comments.<br>
<br>
Mike<br>
<br>#!/bin/bash<br>
# volume<br>
#<br>
# Copyright 2007, Michael T. Dean (mtdean at thirdcontact dt com)<br>
#<br>
# This program is free software; you can redistribute it and/or modify it under<br>
# the terms of the GNU General Public License as published by the Free Software<br>
# Foundation; either version 2 of the License, or (at your option) any later<br>
# version.<br>
#<br>
# This program is distributed in the hope that it will be useful, but WITHOUT<br>
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS<br>
# FOR A PARTICULAR PURPOSE. &nbsp;See the GNU General Public License for more<br>
# details.<br>
#<br>
# You should have received a copy of the GNU General Public License along with<br>
# this program; if not, write to the Free Software Foundation, Inc., 51<br>
# Franklin St, Fifth Floor, Boston, MA &nbsp;02110-1301 &nbsp;USA<br>
#<br>
# Description:<br>
# &nbsp; This script can be used to adjust the volume of any control provided by your<br>
# &nbsp; sound card and can optionally display a message using either xosd or<br>
# &nbsp; mythtvosd. &nbsp;The script is useful to MythTV users whose sound cards require<br>
# &nbsp; changing some volume control other than PCM or Master (the only two choices<br>
# &nbsp; MythTV supports) or who wish to modify multiple controls; or to anyone<br>
# &nbsp; wishing to add a low-dependency volume control with OSD to any system using,<br>
# &nbsp; for example, multimedia keys (i.e. XF86AudioRaiseVolume,<br>
# &nbsp; XF86AudioLowerVolume, XF86AudioMute) or LIRC.<br>
#<br>
# Version: 0.2<br>
#<br>
# Revision History:<br>
# &nbsp; 0.2 (20070310): complete rewrite; added support for xosd; added volume<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; control override; added mute toggle; changed script to use<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; control limits (rather than percents--which pose rounding<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; problems); each control is modified relative to current<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; value (instead of setting all to the same value); removed<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usage of linefeed IFS; added error checking and defaults<br>
# &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for robustness; put some code in functions<br>
# &nbsp; 0.1 (20060123): initial version<br>
#<br>
# Quickstart:<br>
# &nbsp; Verify your amixer reports sane values as described in the first paragraph<br>
# &nbsp; of &quot;Usage&quot; below. &nbsp;Then, run the script as shown below:<br>
# &nbsp; &nbsp; ./volume up PCM<br>
# &nbsp; &nbsp; ./volume down PCM<br>
# &nbsp; &nbsp; ./volume mute PCM<br>
# &nbsp; &nbsp; ./volume unmute PCM<br>
# &nbsp; &nbsp; ./volume toggle PCM<br>
#<br>
# Usage:<br>
# &nbsp; volume {up|down|mute|unmute|toggle} [control1 [control2 [...]]]<br>
#<br>
# &nbsp; First, verify that amixer reports sane values for the control limits and<br>
# &nbsp; current volume. &nbsp;Control limits must be specified in the format &quot; &nbsp;Limits:<br>
# &nbsp; Playback 0 - 31&quot; in any line of output. &nbsp;Current volume must be specified<br>
# &nbsp; in the format &quot;&lt;anything&gt;: Playback 28 [90%]&quot; in any line of output.<br>
# &nbsp; Please test that your version of amixer does this for each control you&#39;ve<br>
# &nbsp; specified in VOLUME_CONTROLS or you may blow out your speakers.<br>
#<br>
# &nbsp; Then, modify the default values specified below to allow usage of the<br>
# &nbsp; script in most cases without listing control names in the command line<br>
# &nbsp; (i.e. ./volume {up|down|mute|unmute|toggle}).<br>
#<br>
# &nbsp; To use with multimedia keys or other keyboard controls, map the appropriate<br>
# &nbsp; commands to the desired keys in your window manager&#39;s or some other key<br>
# &nbsp; handler&#39;s keybindings.<br>
#<br>
# &nbsp; To use with LIRC, you must run irexec (i.e. add the lines, &quot;killall irexec&quot;<br>
# &nbsp; and &quot;irexec -d&quot; (no quotes)--and in the order given)--to your X start<br>
# &nbsp; script (i.e. ~/.xinitrc). &nbsp;Then, add the following lines to your LIRC<br>
# &nbsp; configuration (i.e. ~/.lircrc) and adjust button names and config path as<br>
# &nbsp; appropriate:<br>
#<br>
# &nbsp; &nbsp; begin<br>
# &nbsp; &nbsp; &nbsp; prog = irexec<br>
# &nbsp; &nbsp; &nbsp; button = volume-up<br>
# &nbsp; &nbsp; &nbsp; config = /path/to/volume up &amp;<br>
# &nbsp; &nbsp; &nbsp; repeat = 2<br>
# &nbsp; &nbsp; end<br>
# &nbsp; &nbsp; begin<br>
# &nbsp; &nbsp; &nbsp; prog = irexec<br>
# &nbsp; &nbsp; &nbsp; button = volume-down<br>
# &nbsp; &nbsp; &nbsp; config = /path/to/volume down &amp;<br>
# &nbsp; &nbsp; &nbsp; repeat = 2<br>
# &nbsp; &nbsp; end<br>
# &nbsp; &nbsp; begin<br>
# &nbsp; &nbsp; &nbsp; prog = irexec<br>
# &nbsp; &nbsp; &nbsp; button = mute<br>
# &nbsp; &nbsp; &nbsp; config = /path/to/volume mute &amp;<br>
# &nbsp; &nbsp; &nbsp; config = /path/to/volume unmute &amp;<br>
# &nbsp; &nbsp; &nbsp; repeat = 0<br>
# &nbsp; &nbsp; end<br>
#<br>
<br>
# Modify the following default values as appropriate for your system.<br>
<br>
# Set the VOLUME_CONTROLS to the array of volume controls you want the script<br>
# to adjust. &nbsp;Place spaces (no commas) between elements of the array. &nbsp;Use<br>
# single quotes around elements with spaces, and optionally on elements without<br>
# spaces).<br>
# The list of volume controls may be overriden by specifying the names of<br>
# controls to modify at the end of the command-line. &nbsp;When overriding the<br>
# volume controls, each control will be adjusted by only 1 unit. &nbsp;See, also,<br>
# MIXER_ADJ_AMOUNT, below.<br>
#VOLUME_CONTROLS=(&#39;PCM&#39; &#39;Surround&#39; &#39;Center&#39; &#39;LFE&#39; &#39;Analog Front&#39;)<br>
#VOLUME_CONTROLS=(&#39;PCM&#39;)<br>
VOLUME_CONTROLS=(&#39;Master&#39;)<br>
<br>
# Set the MIXER_ADJ_AMOUNT to the array of the desired number of units by which<br>
# you want to adjust the volume of each control specified in VOLUME_CONTROLS.<br>
# You should specify the same number of adjustments as you specified controls<br>
# in VOLUME_CONTROLS.<br>
# The units used are specific to the sound card control. &nbsp;The range of<br>
# available values is reported by &quot;amixer sget &lt;control&gt;&quot; on the line that<br>
# starts with &quot; &nbsp;Limits:&quot; and may differ for the controls you&#39;ve specified.<br>
# By choosing appropriate values, you can ensure all controls change by the<br>
# same relative volume.<br>
# If not specified, all controls will be adjusted by 1 unit.<br>
#MIXER_ADJ_AMOUNT=(1 1 1 1 1)<br>
#MIXER_ADJ_AMOUNT=(1)<br>
<br>
# Set the OSD_VOLUME_CONTROL to the name of the ALSA control whose volume<br>
# should be reported when using the OSD.<br>
# This control must be included in VOLUME_CONTROLS above or the volume will<br>
# always be set to the same value;<br>
# If not specified, the first value in VOLUME_CONTROLS will be used.<br>
#OSD_VOLUME_CONTROL=&#39;Center&#39;<br>
#OSD_VOLUME_CONTROL=&#39;PCM&#39;<br>
#OSD_VOLUME_CONTROL=&#39;Master&#39;<br>
<br>
# Display the current volume using the specified OSD application (Currently,<br>
# only &#39;xosd&#39; and &#39;mythtvosd&#39; are supported). &nbsp;Use &#39;&#39; or comment out if you do<br>
# not want to display the volume<br>
# Note that if using mythtvosd, the volume message will only be displayed when<br>
# using Myth&#39;s internal player to play back videos. &nbsp;When using xosd, the<br>
# volume message will be displayed whether playing back videos or in the<br>
# frontend menus (or anywhere else in X).<br>
USE_OSD=&#39;xosd&#39;<br>
#USE_OSD=&#39;mythtvosd&#39;<br>
#USE_OSD=&#39;&#39;<br>
<br>
# OSD application executables.<br>
# Provide the full path to the executable if it is not in your PATH.<br>
XOSD=&#39;osd_cat&#39;<br>
MYTHTVOSD=&#39;mythtvosd&#39;<br>
<br>
# Arguments to pass to xosd (do not specify -b, -P, and -T).<br>
# This is the location at which to specify font, position, alignment, offset,<br>
# delay, lines, shadow, and color<br>
XOSD_ARGS=&#39;-f -adobe-helvetica-bold-r-normal-*-*-240-100-100-p-*-iso8859-1 -p bottom -A center -o 80 -d 1 -l 1 -s 2 -c Green&#39;<br>
<br>
# xosd barmode to use--either percentage or slider<br>
XOSD_BARMODE=percentage<br>
#XOSD_BARMODE=slider<br>
<br>
# Set the BROADCAST_ADDRESS to the address of the frontend on which you want to<br>
# display the volume OSD when using mythtvosd.<br>
# Using <a href="http://127.0.0.1" target="_blank">127.0.0.1</a> will generally work.<br>
BROADCAST_ADDRESS=&#39;<a href="http://127.0.0.1" target="_blank">127.0.0.1</a>&#39;<br>
<br>
# No changes should be required below this line.<br>
<br>
ACTION=$1<br>
shift<br>
<br>
if [ $# -gt 0 ]; then<br>
 &nbsp;unset VOLUME_CONTROLS MIXER_ADJ_AMOUNT OSD_VOLUME_CONTROL<br>
 &nbsp;for INDEX in `seq 0 $(($# - 1))`; do<br>
 &nbsp; &nbsp;VOLUME_CONTROLS[${INDEX}]=&quot;$1&quot;<br>
 &nbsp; &nbsp;shift<br>
 &nbsp;done<br>
fi<br>
<br>
if [ &quot;x${OSD_VOLUME_CONTROL}&quot; = &quot;x&quot; ]; then<br>
 &nbsp;OSD_VOLUME_CONTROL=${VOLUME_CONTROLS[0]}<br>
fi<br>
<br>
NUM_CONTROLS=$((${#VOLUME_CONTROLS[*]} - 1))<br>
<br>
set_volume() {<br>
 &nbsp; &nbsp;for INDEX in `seq 0 ${NUM_CONTROLS}`; do<br>
 &nbsp; &nbsp; &nbsp;unset CONTROL RANGE VOLUME ADJUST_AMOUNT<br>
 &nbsp; &nbsp; &nbsp;CONTROL=${VOLUME_CONTROLS[$INDEX]}<br>
<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x${CONTROL}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;continue<br>
 &nbsp; &nbsp; &nbsp;fi<br>
<br>
 &nbsp; &nbsp; &nbsp;# Relies on amixer reporting limits in the format<br>
 &nbsp; &nbsp; &nbsp;# &quot; &nbsp;Limits: Playback 0 - 31&quot; in any line of output. &nbsp;Please test that<br>
 &nbsp; &nbsp; &nbsp;# your version of amixer does this for each control you&#39;ve specified in<br>
 &nbsp; &nbsp; &nbsp;# VOLUME_CONTROLS or you may blow out your speakers.<br>
 &nbsp; &nbsp; &nbsp;RANGE=(`amixer sget &quot;${CONTROL}&quot; | awk &#39;/Limits/ {split($0,a); print a[3] &quot; &quot; a[5]; exit }&#39;`)<br>
<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x${RANGE[0]}&quot; = &quot;x&quot; -o &quot;x${RANGE[1]}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# Couldn&#39;t get the range. &nbsp;Skip this control<br>
 &nbsp; &nbsp; &nbsp; &nbsp;continue<br>
 &nbsp; &nbsp; &nbsp;fi<br>
<br>
 &nbsp; &nbsp; &nbsp;# Relies on amixer reporting volume in the format<br>
 &nbsp; &nbsp; &nbsp;# &quot;&lt;anything&gt;: Playback 28 [90%]&quot; in any line of output. &nbsp;Please test<br>
 &nbsp; &nbsp; &nbsp;# that your version of amixer does this for each control you&#39;ve specified<br>
 &nbsp; &nbsp; &nbsp;# in VOLUME_CONTROLS or you may blow out your speakers.<br>
 &nbsp; &nbsp; &nbsp;VOLUME=`amixer sget &quot;${CONTROL}&quot; | awk &#39;/[%]/ {split($0,a,&quot;:&quot;); split(a[2],a); print a[2]; exit}&#39;`<br>
<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x${VOLUME}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# Couldn&#39;t get the volume. &nbsp;Skip this control<br>
 &nbsp; &nbsp; &nbsp; &nbsp;continue<br>
 &nbsp; &nbsp; &nbsp;fi<br>
<br>
 &nbsp; &nbsp; &nbsp;ADJUST_AMOUNT=${MIXER_ADJ_AMOUNT[$INDEX]}<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x${ADJUST_AMOUNT}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ADJUST_AMOUNT=1<br>
 &nbsp; &nbsp; &nbsp;fi<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x$1&quot; != &quot;xup&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;ADJUST_AMOUNT=-${ADJUST_AMOUNT}<br>
 &nbsp; &nbsp; &nbsp;fi<br>
 &nbsp; &nbsp; &nbsp;NEW_VOLUME=&quot;$((${VOLUME} + ${ADJUST_AMOUNT}))&quot;<br>
 &nbsp; &nbsp; &nbsp;if [ ${NEW_VOLUME} -lt ${RANGE[0]} ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;NEW_VOLUME=${RANGE[0]}<br>
 &nbsp; &nbsp; &nbsp;elif [ ${NEW_VOLUME} -gt ${RANGE[1]} ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;NEW_VOLUME=${RANGE[1]}<br>
 &nbsp; &nbsp; &nbsp;fi<br>
 &nbsp; &nbsp; &nbsp;amixer -q set ${CONTROL} ${NEW_VOLUME} &amp;<br>
 &nbsp; &nbsp;done<br>
}<br>
<br>
simple_message() {<br>
 &nbsp;MESSAGE=$1<br>
 &nbsp;if [ &quot;x${MESSAGE}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp;return<br>
 &nbsp;fi<br>
 &nbsp;if [ &quot;x${USE_OSD}&quot; = &quot;xxosd&quot; ]; then<br>
 &nbsp; &nbsp;if [ &quot;x${XOSD}&quot; != &quot;x&quot; -a &quot;x${DISPLAY}&quot; != &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp;# Kill any running xosd processes (to clear the previous message)<br>
 &nbsp; &nbsp; &nbsp;killall -q ${XOSD} &gt; /dev/null 2&gt;&amp;1<br>
 &nbsp; &nbsp; &nbsp;echo ${MESSAGE} | ${XOSD} ${XOSD_ARGS} &gt; /dev/null 2&gt;&amp;1 &amp;<br>
 &nbsp; &nbsp;fi<br>
 &nbsp;elif [ &quot;x${USE_OSD}&quot; = &quot;xmythtvosd&quot; ]; then<br>
 &nbsp; &nbsp;if [ &quot;x${MYTHTVOSD}&quot; != &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp;${MYTHTVOSD} --bcastaddr=&quot;${BROADCAST_ADDRESS}&quot; \<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --template=&#39;alert&#39; \<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --alert_text=&quot;${MESSAGE}&quot; &gt; /dev/null 2&gt;&amp;1 &amp;<br>
 &nbsp; &nbsp;fi<br>
 &nbsp;fi<br>
}<br>
<br>
show_percent() {<br>
 &nbsp;if [ &quot;x${USE_OSD}&quot; = &quot;xxosd&quot; ]; then<br>
 &nbsp; &nbsp;# Relies on amixer reporting volume in the format &quot;[90%]&quot; in any line of<br>
 &nbsp; &nbsp;# output.<br>
 &nbsp; &nbsp;NEW_VOLUME_PCT=`amixer sget &quot;${OSD_VOLUME_CONTROL}&quot; | awk &#39;/[%]/ {split($0,a,&quot;[&quot;); split(a[2],a,&quot;%&quot;); print a[1]; exit}&#39;`<br>
 &nbsp; &nbsp;if [ &quot;x${NEW_VOLUME_PCT}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp;# Couldn&#39;t get the volume. &nbsp;Do not display the OSD.<br>
 &nbsp; &nbsp; &nbsp;return<br>
 &nbsp; &nbsp;fi<br>
 &nbsp; &nbsp;if [ &quot;x${XOSD}&quot; != &quot;x&quot; -a &quot;x${DISPLAY}&quot; != &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp;# Kill any running xosd processes (to clear the previous message)<br>
 &nbsp; &nbsp; &nbsp;killall -q ${XOSD} &gt; /dev/null 2&gt;&amp;1<br>
 &nbsp; &nbsp; &nbsp;${XOSD} -b ${XOSD_BARMODE} -P ${NEW_VOLUME_PCT} \<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-T &quot;${OSD_VOLUME_CONTROL} Volume: ${NEW_VOLUME_PCT}%&quot; ${XOSD_ARGS} &gt; /dev/null 2&gt;&amp;1 &amp;<br>
 &nbsp; &nbsp;fi<br>
 &nbsp;elif [ &quot;x${USE_OSD}&quot; = &quot;xmythtvosd&quot; ]; then<br>
 &nbsp; &nbsp;if [ &quot;x${MYTHTVOSD}&quot; != &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp;${MYTHTVOSD} --bcastaddr=&quot;${BROADCAST_ADDRESS}&quot; \<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --template=&#39;alert&#39; \<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --alert_text=&quot;${OSD_VOLUME_CONTROL} Volume: ${NEW_VOLUME_PCT}%&quot; \<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &gt; /dev/null 2&gt;&amp;1 &amp;<br>
 &nbsp; &nbsp;fi<br>
 &nbsp;fi<br>
}<br>
<br>
case &quot;${ACTION}&quot; in<br>
 &nbsp;up|down)<br>
 &nbsp; &nbsp;set_volume &quot;${ACTION}&quot;<br>
 &nbsp; &nbsp;show_percent<br>
 &nbsp; &nbsp;;;<br>
 &nbsp;mute|unmute)<br>
 &nbsp; &nbsp;for INDEX in `seq 0 ${NUM_CONTROLS}`; do<br>
 &nbsp; &nbsp; &nbsp;unset CONTROL<br>
 &nbsp; &nbsp; &nbsp;CONTROL=${VOLUME_CONTROLS[$INDEX]}<br>
 &nbsp; &nbsp; &nbsp;amixer -q set ${CONTROL} ${ACTION} &amp;<br>
 &nbsp; &nbsp;done<br>
 &nbsp; &nbsp;MESSAGE=`echo &quot;${ACTION}&quot; | tr &nbsp;[:lower:] [:upper:]` &gt; /dev/null 2&gt;&amp;1<br>
 &nbsp; &nbsp;simple_message ${MESSAGE}<br>
 &nbsp; &nbsp;;;<br>
 &nbsp;toggle)<br>
 &nbsp; &nbsp;for INDEX in `seq 0 ${NUM_CONTROLS}`; do<br>
 &nbsp; &nbsp; &nbsp;unset CONTROL CURRENT_STATE<br>
 &nbsp; &nbsp; &nbsp;CONTROL=${VOLUME_CONTROLS[$INDEX]}<br>
 &nbsp; &nbsp; &nbsp;# Relies on amixer reporting mute state in the format<br>
 &nbsp; &nbsp; &nbsp;# &quot;&lt;anything&gt;[90%] [7.50dB] [on]&quot; in any line of output. &nbsp;Please test<br>
 &nbsp; &nbsp; &nbsp;# that your version of amixer does this for each control you&#39;ve specified<br>
 &nbsp; &nbsp; &nbsp;# in VOLUME_CONTROLS.<br>
 &nbsp; &nbsp; &nbsp;CURRENT_STATE=`amixer sget &quot;${CONTROL}&quot; | awk &#39;/[%]/ {split($0,a,&quot;[&quot;); split(a[4],a,&quot;]&quot;); print a[1]; exit}&#39;`<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x${CURRENT_STATE}&quot; = &quot;x&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;# Couldn&#39;t get the mute state. &nbsp;Skip this control.<br>
 &nbsp; &nbsp; &nbsp; &nbsp;continue<br>
 &nbsp; &nbsp; &nbsp;fi<br>
 &nbsp; &nbsp; &nbsp;if [ &quot;x${CURRENT_STATE}&quot; = &quot;xoff&quot; ]; then<br>
 &nbsp; &nbsp; &nbsp; &nbsp;MUTE=unmute<br>
 &nbsp; &nbsp; &nbsp;else<br>
 &nbsp; &nbsp; &nbsp; &nbsp;MUTE=mute<br>
 &nbsp; &nbsp; &nbsp;fi<br>
 &nbsp; &nbsp; &nbsp;amixer -q set ${CONTROL} ${MUTE} &amp;<br>
 &nbsp; &nbsp;done<br>
 &nbsp; &nbsp;# Assume the mute state of all controls is the same as that of the<br>
 &nbsp; &nbsp;# last successfully set control. &nbsp;Using toggle with multiple controls<br>
 &nbsp; &nbsp;# in different states doesn&#39;t make much sense.<br>
 &nbsp; &nbsp;MESSAGE=`echo &quot;${MUTE}&quot; | tr &nbsp;[:lower:] [:upper:]` &gt; /dev/null 2&gt;&amp;1<br>
 &nbsp; &nbsp;simple_message ${MESSAGE}<br>
 &nbsp; &nbsp;;;<br>
 &nbsp;*)<br>
 &nbsp; &nbsp;echo &quot;Usage: $0 {up|down|mute|unmute|toggle} [control1 [control2 [...]]]&quot;<br>
 &nbsp; &nbsp;exit 1<br>
 &nbsp; &nbsp;;;<br>
esac<br>
<br>
<br>_______________________________________________<br>
mythtv-users mailing list<br>
<a href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a><br>
<a href="http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users" target="_blank">http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users</a><br>
<br></blockquote><div><br>Wow, thanks, Nick, thanks Mike.<br><br>&nbsp; These look like what the doctor ordered. So far, I had added<br>a button to my frontend for a shell script to toggle the &quot;status&quot;<br>portion of the OSD, but both these look like more what I had in<br>
mind. I had also installed xosd to give me some feedback from<br>the shell script, looks like that will come in more handy with Mike&#39;s<br>script.<br><br>Pat<br></div></div>