Subject: Re: cdplay
To: None <netbsd-help@netbsd.org>
From: Amitai Schlair <schmonz@dailyjolt.com>
List: netbsd-help
Date: 01/01/2001 16:25:28
Chris Pinnock wrote:

> Something like
>         mixerctl -w inputs.cd.mute=off
> or
>         mixerctl -w inputs.line.mute=off
> fixed it. I put these in my /etc/rc.local although there's probably
> a better way of doing it.

FWIW, I handled this with the following (rough) /etc/rc.d/mixerctl:

    #!/bin/sh
    #
    # PROVIDE: mixerctl
    # REQUIRE: LOGIN

    . /etc/rc.subr

    name="mixerctl"
    command="/usr/bin/${name}"
    start_cmd="mixerctl_start"
    stop_cmd="mixerctl_stop"

    mixerctl_start()
    {
        if [ -r /etc/mixerctl.conf ]; then
            echo "Setting mixerctl variables:"
            ${command} -a > /tmp/mixerctl.orig
            ${command} -w `sed -e "s/#.*$//" -e "/^$/d"
/etc/mixerctl.conf`
        fi
    }

    mixerctl_stop()
    {
        if [ -r /tmp/mixerctl.orig ]; then
            echo "Unsetting mixerctl variables:"
            ${command} -w `cat /tmp/mixerctl.orig`
        fi
    }

    load_rc_config $name
    run_rc_command "$1"


This lets me have an /etc/mixerctl.conf, which looks like this:

    # mixerctl(8) variables to set at boot time.

    # Pipe CD output through the sound card
    inputs.cd.mute=off

    # Pump up the volume
    inputs.cd=255,255
    inputs.dac=255,255
    outputs.master=255,255


Finally, of course, you need

    mixerctl=YES

in /etc/rc.conf.

Hope this helps,

- Amitai