Perhaps can this helps someone to adjust fast automaticaly default Sound Unit
I have switched full to Bourne shell from Bash and here is new Version
cat /home/bin/headset
#!/bin/sh
# Author nemysis
echo ""
echo "$0"
echo ""
echo ""
echo You are `whoami`
echo""
echo "Start this as root!"
echo ""
# Without root no chance
euid=`ps -o uid= $$`
if [ $euid -ne 0 ]
then
echo "This script needs root privileges. Aborting now..."
echo ""
exit 1
fi
echo ""
echo -n "Which Sound Device would You use? Please use only Number."
echo ""
echo ""
cat /dev/sndstat
echo ""
read HEADPHONES
echo ""
echo ""
echo -n "Would You adjust Sound Device for Headphones? (y,n)"
echo ""
echo ""
read SOUNDDEVICE
if [ "${SOUNDDEVICE}" = "Y" -o "${SOUNDDEVICE}" = "y" ]
then
sysctl hw.snd.default_unit=$HEADPHONES
else
echo ""
echo "Sound Device for Headphones isn't adjusted"
echo ""
fi
echo ""
cat /dev/sndstat
echo ""
playsound /usr/local/share/sounds/local/bounce.wav
echo ""
playsound is from FreeBSD Port audio/sdl_sound
/usr/local/share/sounds/local/bounce.wav is from FreeBSD Port net-im/gajim
Please look
http://forums.pcbsd.org/showthread.php?t=16034 this is fast the same as here.