Date: Sat, 30 Sep 2000 17:39:57 -0700 (PDT) From: Christopher Shumway <cshumway@bsdi.com> To: freebsd-multimedia@freebsd.org Subject: rc.audi Message-ID: <Pine.BSF.4.21.0009301739130.55185-100000@pike.osd.bsdi.com>
index | next in thread | raw e-mail
I've been giving some thought to a more user tuneable way of setting up the
audio mixer under FreeBSD at boot time. The methiod I have come up with is
with an /etc/rc.audio script, attached below. Feedback is appreciated, for
I am thinking of send-pr'ing it as a change request so we can see it as
part of the base FreeBSD system. Here's the script:
#!/bin/sh
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
case ${mixer_enable} in
[Yy][Ee][Ss])
echo -n "mixer "
# set mixer_program if its not already set
if [ -z "${mixer_program}" ]
then mixer_program="/usr/sbin/mixer"
fi
# set the volume
if [ -n "${mixer_vol}" ]
then ${mixer_program} vol ${mixer_vol} > /dev/null
fi
# set the bass
if [ -n "${mixer_bass}" ]
then ${mixer_program} bass ${mixer_bass} > /dev/null
fi
# set the treble
if [ -n "${mixer_treble}" ]
then ${mixer_program} treble ${mixer_treble} > /dev/null
fi
# set the synthisizer
if [ -n "${mixer_synth}" ]
then ${mixer_program} synth ${mixer_synth} > /dev/null
fi
# set the pcm channel
if [ -n "${mixer_pcm}" ]
then ${mixer_program} pcm ${mixer_pcm} > /dev/null
fi
# set the pc speaker
if [ -n "${mixer_speaker}" ]
then ${mixer_program} speaker ${mixer_speaker} > /dev/null
fi
# set the microphone
if [ -n "${mixer_mic}" ]
then ${mixer_program} mic ${mixer_mic} > /dev/null
fi
# set the cd audio line
if [ -n "${mixer_cd}" ]
then ${mixer_program} cd ${mixer_cd} > /dev/null
fi
# set the mix
if [ -n "${mixer_mix}" ]
then ${mixer_program} mix ${mixer_mix} > /dev/null
fi
# set pcm2
if [ -n "${mixer_pcm2}" ]
then ${mixer_program} pcm2 ${mixer_pcm2} > /dev/null
fi
# set the record level
if [ -n "${mixer_rec}" ]
then ${mixer_program} rec ${mixer_rec} > /dev/null
fi
# set the input gain
if [ -n "${mixer_igain}" ]
then ${mixer_program} igain ${mixer_igain} > /dev/null
fi
# set the outpug gain
if [ -n "${mixer_ogain}" ]
then ${mixer_program} ogain ${mixer_ogain} > /dev/null
fi
# set the input line 1
if [ -n "${mixer_line1}" ]
then ${mixer_program} line1 ${mixer_line1} > /dev/null
fi
# set the input line 2
if [ -n "${mixer_line2}" ]
then ${mixer_program} line2 ${mixer_line2} > /dev/null
fi
# set the input line 3
if [ -n "${mixer_line3}" ]
then ${mixer_program} line3 ${mixer_line3} > /dev/null
fi
;;
*)
;;
esac
-----
And the corresponding patch to /etc/default/rc.conf
--- /usr/src/etc/defaults/rc.conf Mon Sep 11 16:19:19 2000
+++ defaults/rc.conf Sat Sep 30 16:53:51 2000
@@ -264,6 +264,27 @@
moused_flags="" # Any additional flags to moused.
allscreens_flags="" # Set this vidcontrol mode for all virtual screens
+##############################################################
+### Sound Mixer for pcm(4) ##################################
+##############################################################
+mixer_enable="NO" # Run the mixer setup
+mixer_program="/usr/sbin/mixer" #Program to set audio mixer
+mixer_vol="75:75" # master mixer volume
+mixer_bass="50:50" # bass mixer volume
+mixer_treble="50:50" # treble mixer volume
+mixer_synth="50:50" # synthesizer mixer volume
+mixer_pcm="75:75" # pcm mixer volume
+mixer_speaker="100:100" # pc speaker mixer volume
+mixer_mic="0:0" # microphone mixer volume
+mixer_cd="75:75" # cd audio line mixer volume
+mixer_mix="0:0" # mix mixer volume
+mixer_pcm2="0:0" # pcm line two mixer volume
+mixer_rec="0:0" # record volume
+mixer_igain="0:0" # input gain
+mixer_ogain="0:0" # output gain
+mixer_line1="0:0" # line1 mixer volume
+mixer_line2="0:0" # line2 mixer volume
+mixer_line3="0:0" # line3 mixer volume
##############################################################
### Miscellaneous administrative options ###################
---
And finally a place to start it from /etc/rc
--- /usr/src/etc/rc Mon Sep 11 16:19:21 2000
+++ rc Sat Sep 30 17:09:10 2000
@@ -541,6 +541,16 @@
echo .
+# Initial system setup
+#
+echo -n "Setting up "
+
+if [ -r /etc/rc.audio ]; then
+ . /etc/rc.audio
+fi
+
+echo .
+
# Do traditional (but rather obsolete) rc.local file if it exists. If you
# use this file and want to make it programmatic, source /etc/defaults/rc.conf
# in /etc/rc.local and add your custom variables to /etc/rc.conf, as
---
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-multimedia" in the body of the message
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0009301739130.55185-100000>
