mixer: sleep/snooze: Close mixer during sleep.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 23 Mar 2019 15:51:56 +0000 (16:51 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 2 Jun 2019 10:09:50 +0000 (12:09 +0200)
commitac289a22fd438a97d5eda86793a47377d0d570ce
tree4941628f3eddc88a2a7606c062ea0af8e4bf11f1
parent522112ac291393b5a9cbeea550dfd5e7de3863bb
mixer: sleep/snooze: Close mixer during sleep.

This makes these subcommands work in case the audio device goes away
temporarily during the sleep interval. This does not work at the moment
because we connect to the mixer only once at startup. The mixer handle
becomes invalid when the audio device goes away, so fade-in fails.

Another drawback of this "connect only once" design is that the
mixer device is opened even for the help subcommand, which is not
only silly but also has the effect that the help subcommand fails if
the mixer device can not be opened.

To improve on this, we have the individual subcommand handlers open and
close the mixer device. Consequently, the command handlers no longer
take a struct mixer_handle * argument. To obtain a mixer handle,
command handlers must now call the new open_mixer_and_set_channel()
at startup, and m->close() on return to free the handle.
mixer.c