#!/bin/bash

function menuchoices {
    if [ "$choice" = "A" ]; then
	DRIVER=alsa
	clear
	exec_command remove_modules
	make_alsa_configfile
	/etc/rc.d/init.d/alsasound start
	sleep 1
	alsactl store $SOUNDCARD
	load_mixer_settings
	grep 'snd-pcm-oss' /proc/modules || modprobe snd-pcm-oss
	restore_conf $CONFIGFILE
    fi

    if [ "$choice" = "A1" ]; then
	DRIVER=creative
	clear
	exec_command remove_modules
	make_sblive_configfile
	/sbin/modprobe emu10k1
	load_mixer_settings
	restore_conf $CONFIGFILE
    fi

    if [ "$choice" = "A3" ]; then
	DRIVER=osslite
	clear
	exec_command remove_modules
	make_sb16_osslite_configfile
	/sbin/insmod soundcore
#	/sbin/insmod soundlow
	/sbin/insmod sound
	/sbin/insmod uart401
	/sbin/insmod sb io=$IOPORT irq=$IRQ dma=1 mpu_io=$MPUPORT
	load_mixer_settings
	restore_conf $CONFIGFILE
    fi

    if [ "$choice" = "B" ]; then
	DRIVER=oss
	clear
	exec_command remove_modules
	make_oss_configfile
	soundon
	load_mixer_settings
	restore_conf $CONFIGFILE
    fi

    if [ "$choice" = "C" ]; then
	exec_command remove_modules
	make_oss_configfile
	soundconf
	restore_conf $CONFIGFILE
    fi

    if [ "$choice" = "D" ]; then
	save_mixer_settings
    fi

    if [ "$choice" = "E" ]; then
	configure_sound
    fi

    if [ "$choice" = "F" ]; then
	exec_command remove_modules
    fi

    if [ "$choice" = "G" ]; then
	exec_command /sbin/lsmod
    fi

    if [ "$choice" = "H" ]; then
	[ -z "$DISPLAY" ] && $EDITOR $CONFIGFILE || $XTRM -e $EDITOR $CONFIGFILE
    fi

    if [ "$choice" = "I" ]; then
	chmod 666 /dev/dsp* \
		  /dev/audio* \
		  /dev/mixer* \
		  /dev/midi* \
		  /dev/sequencer*
    fi

    sound
}
