#!/bin/sh
#
# Configure the PCSP-driver

cat <<END

PC Speaker Driver

The new driver 0.4 can simulate the /dev/mixer device.
This is only usefull if you have Stereo-on-One or Stereo-DACs,
because Mono-devices will ignore the 2 volumes and use only the
left volume (PC-Speaker however use the mean value).
The /dev/mixer simulation supports only the Master-Volume device.
If you don't include /dev/mixer support, you can use pcsel to
change only the PC-Speaker volume, DACs will play 100 %. 

END

echo "/*  Generated by configure. Don't edit! */" >local.h

echo -n "Do you want the /dev/mixer simulation [Y/n] "
read answer
if [ "$answer" = "n" ] ; then
	echo "#undef PCSP_MIXER" >>local.h
	echo "#define DEFAULT_LEFT	100" >>local.h
	echo "#define DEFAULT_RIGHT	100" >>local.h
else
	echo "#define PCSP_MIXER" >>local.h
	while true
	do
		echo -n "Left volume at startup (0-100)  :" 
		read left
		left=${left:-100}
		if [ $left -le 100 ] ; then
			if [ $left -ge 0 ] ; then
				break 
			fi
		fi
		echo "Must be in the range 0 - 100"
	done
	echo "#define DEFAULT_LEFT	$left" >>local.h
	while true
	do
		echo -n "Right volume at startup (0-100) :"
		read right
		right=${right:-100}
		if [ $right -le 100 ] ; then
			if [ $right -ge 0 ] ; then
				break
			fi
		fi
		echo "Must be in the range 0 - 100"
	done
	echo "#define DEFAULT_RIGHT	$right" >>local.h
fi
