summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Meuser <jakemsr@cvs.openbsd.org>2007-07-18 19:27:09 +0000
committerJacob Meuser <jakemsr@cvs.openbsd.org>2007-07-18 19:27:09 +0000
commitf78b8ae3170a2c35b484d10b9ef89df2748888e2 (patch)
treece4ad824cdca0f9e25b7d4bb139b95aed8a9dbfe
parent92ef58e006cef6212e23c812a0abff9e0e211629 (diff)
- when traversing mixer fields in the attach routine and connecting
the mixer layer to the audio layer, differentiate between the 'monitor' class and the 'outputs' class instead of lumping them together. not all mixers have a monitor class entry which was causing the outputs class to be ignored. - look for monitor port in the monitor class, but if the monitor port is not found in the monitor class look in the outputs class as well. the code was effectively looking in both the monitor and outputs classes before, so this is no real change. sets up audio_info.play.[gain|balance] correctly on at least emu(4), auich(4), auvia(4) and snapper(4) ... probably most other AC'97 devices as well. as a result, audioctl(1) works much better and the overall volume can be set with /dev/audio instead of needing to go through /dev/mixer. from deanna@ thanks again to those who tested this change
-rw-r--r--sys/dev/audio.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/sys/dev/audio.c b/sys/dev/audio.c
index 3bc8299ddc8..01215dba92c 100644
--- a/sys/dev/audio.c
+++ b/sys/dev/audio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: audio.c,v 1.67 2007/07/18 18:34:32 jakemsr Exp $ */
+/* $OpenBSD: audio.c,v 1.68 2007/07/18 19:27:08 jakemsr Exp $ */
/* $NetBSD: audio.c,v 1.119 1999/11/09 16:50:47 augustss Exp $ */
/*
@@ -235,7 +235,7 @@ audioattach(struct device *parent, struct device *self, void *aux)
void *hdlp = sa->hdl;
int error;
mixer_devinfo_t mi;
- int iclass, oclass;
+ int iclass, oclass, mclass;
printf("\n");
@@ -292,7 +292,7 @@ audioattach(struct device *parent, struct device *self, void *aux)
audio_init_ringbuffer(&sc->sc_pr);
audio_calcwater(sc);
- iclass = oclass = -1;
+ iclass = oclass = mclass = -1;
sc->sc_inports.index = -1;
sc->sc_inports.nports = 0;
sc->sc_inports.isenum = 0;
@@ -310,6 +310,9 @@ audioattach(struct device *parent, struct device *self, void *aux)
iclass = mi.index;
if (mi.type == AUDIO_MIXER_CLASS &&
strcmp(mi.label.name, AudioCmonitor) == 0)
+ mclass = mi.index;
+ if (mi.type == AUDIO_MIXER_CLASS &&
+ strcmp(mi.label.name, AudioCoutputs) == 0)
oclass = mi.index;
}
for(mi.index = 0; ; mi.index++) {
@@ -321,7 +324,10 @@ audioattach(struct device *parent, struct device *self, void *aux)
AudioNsource, AudioNrecord, itable);
au_check_ports(sc, &sc->sc_outports, &mi, oclass,
AudioNoutput, AudioNmaster, otable);
- if (mi.mixer_class == oclass &&
+ if (mi.mixer_class == mclass &&
+ (strcmp(mi.label.name, AudioNmonitor) == 0))
+ sc->sc_monitor_port = mi.index;
+ if ((sc->sc_monitor_port == -1) && (mi.mixer_class == oclass) &&
(strcmp(mi.label.name, AudioNmonitor) == 0))
sc->sc_monitor_port = mi.index;
}