ALSA Volume Setting function

Warren Togami <[email protected]>
Newsgroups gmane.linux.terminal-server.devel
Message-ID <[email protected]>
Problem:
ALSA devices are set to some preset value like 74% on Fedora or 80% 
(some other distro).  Pulseaudio exposes no way to adjust these values, 
so it is impossible to bring volume up to audible on some machines 
through the mixer applet in a user session alone.

Gadi has the code below based upon lts.conf options from LTSP-4.2 that 
were removed for some reason for LTSP5.  I plan on improving upon this 
code further by using the same basic idea, except setting each volume 
value to 100% for Master* and 95% for the others by default if they are 
not specified from lts.conf.

I plan on putting this in into ltsp-init-common as a function that can 
be called from either Debian or Fedora-style init scripts (since they 
are separate.)

Any objections?

# Set up sound
### for ALSA, we use amixer
if [ -n "$VOLUME" ]; then
   amixer sset Master,0 ${VOLUME}% unmute 2>/dev/null
   amixer sset 'Master Digital',0 ${VOLUME}% unmute 2>/dev/null
fi
[ -n "$HEADPHONE_VOLUME" ] && \
   amixer sset Headphone,0 ${HEADPHONE_VOLUME:-$VOLUME}% unmute 2>/dev/null
[ -n "$PCM_VOLUME" ] && \
   amixer sset PCM,0 ${PCM_VOLUME}% unmute 2>/dev/null
[ -n "$MIC_VOLUME" ] && \
   amixer sset Mic,0 ${MIC_VOLUME}% unmute cap 2>/dev/null
[ -n "$CD_VOLUME" ] && \
   amixer sset CD,0 ${CD_VOLUME}% unmute cap 2>/dev/null
[ -n "$FRONT_VOLUME" ] && \
   amixer sset Front,0 ${FRONT_VOLUME}% unmute cap 2>/dev/null

Warren Togami
[email protected]

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_____________________________________________________________________
Ltsp-developer mailing list.   To un-subscribe, or change prefs, goto:
      https://lists.sourceforge.net/lists/listinfo/ltsp-developer
For additional LTSP help,   try #ltsp channel on irc.freenode.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.