diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2009-10-27 12:30:12 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2009-10-27 12:30:12 +0000 |
commit | a4855ba34ae239d33e5e272345ff1340a29271d1 (patch) | |
tree | 4a9de5f888e5a59ac15d96a9817afccd1264c40b | |
parent | d946c10994ee5e21bcce188d0a8836ab6417cdfa (diff) |
encode the channels a converter will convert into the converter's
mixer name.
-rw-r--r-- | share/man/man4/azalia.4 | 44 | ||||
-rw-r--r-- | sys/dev/pci/azalia.c | 82 |
2 files changed, 71 insertions, 55 deletions
diff --git a/share/man/man4/azalia.4 b/share/man/man4/azalia.4 index aea250aee33..4cd887a1eee 100644 --- a/share/man/man4/azalia.4 +++ b/share/man/man4/azalia.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: azalia.4,v 1.22 2009/10/20 06:31:26 jakemsr Exp $ +.\" $OpenBSD: azalia.4,v 1.23 2009/10/27 12:30:11 jakemsr Exp $ .\" $NetBSD: azalia.4,v 1.2 2005/06/22 04:19:09 kent Exp $ .\" .\" Copyright (c) 2005 The NetBSD Foundation, Inc. @@ -28,7 +28,7 @@ .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE .\" POSSIBILITY OF SUCH DAMAGE. .\" -.Dd $Mdocdate: October 20 2009 $ +.Dd $Mdocdate: October 27 2009 $ .Dt AZALIA 4 .Os .Sh NAME @@ -106,8 +106,7 @@ The widget type enumerator is used to distinguish different widgets of the same type. The enumeration starts at 2: the first widget of each type is not enumerated. -Except for dac and adc widget types, the enumeration order is -meaningless. +The enumeration order is meaningless. The property is optional. Generally, if there is no property, the mixer item is an amplifier gain control. @@ -117,22 +116,45 @@ The following are the widget type names used in mixer control names: .Bl -tag -width "SPDIF-in" .It Cm dac Digital to analog converter, usually used for playback. -These widgets are enumerated according to the channels they convert. -For example, if a codec has 3 stereo dacs, they would convert the -following channels: dac channels 0 and 1, dac2 channels 2 and 3, -dac3 channels 4 and 5. +The audio stream channels these widgets will convert are encoded into +their name in the form of <start channel>:<end channel>. +For example, +.Cm dac-0:1 +converts channels 0 and 1 (stereo). +However, a dac that is connected to built-in speakers or front +panel headphone jacks by default will convert audio stream channels +starting at 0 if the dac would otherwise not be converting any channels. +For example, if +.Cm dac-2:3 +is the default dac for the built-in speakers in a laptop, +.Cm dac-2:3 +will convert channels 0 and 1 when a stereo audio stream is being played. +This is to allow simultaneous stereo playback on both the built-in speakers +and a line or headphone jack. .Pp .It Cm dig-dac Digital output converter, usually an S/PDIF transmitter. +The audio stream channels these widgets will convert are encoded into +their name in the form of <start channel>:<end channel>. +For example, +.Cm dig-dac-0:1 +converts channels 0 and 1 (stereo). .Pp .It Cm adc Analog to digital converter, usually used for recording. -These widgets are enumerated according to the channels they convert. -For example, if a codec has 2 stereo adcs, they would convert the -following channels: adc channels 0 and 1, adc2 channels 2 and 3. +The audio stream channels these widgets will convert are encoded into +their name in the form of <start channel>:<end channel>. +For example, +.Cm adc-0:1 +converts channels 0 and 1 (stereo). .Pp .It Cm dig-adc Digital input converter, usually an S/PDIF receiver. +The audio stream channels these widgets will convert are encoded into +their name in the form of <start channel>:<end channel>. +For example, +.Cm dig-adc-0:1 +converts channels 0 and 1 (stereo). .Pp .It Cm mix Sums multiple audio sources into a single stream, but diff --git a/sys/dev/pci/azalia.c b/sys/dev/pci/azalia.c index 47c9d73b98e..a6512d65f50 100644 --- a/sys/dev/pci/azalia.c +++ b/sys/dev/pci/azalia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: azalia.c,v 1.158 2009/10/13 19:33:16 pirofti Exp $ */ +/* $OpenBSD: azalia.c,v 1.159 2009/10/27 12:30:11 jakemsr Exp $ */ /* $NetBSD: azalia.c,v 1.20 2006/05/07 08:31:44 kent Exp $ */ /*- @@ -2767,9 +2767,10 @@ int azalia_widget_label_widgets(codec_t *codec) { widget_t *w; + convgroup_t *group; int types[16]; int pins[16]; - int colors_used, use_colors; + int colors_used, use_colors, schan; int i, j; bzero(&pins, sizeof(pins)); @@ -2817,63 +2818,56 @@ azalia_widget_label_widgets(codec_t *codec) case COP_AWTYPE_AUDIO_OUTPUT: if (codec->dacs.ngroups < 1) break; - for (j = 0; j < codec->dacs.groups[0].nconv; j++) { - if (w->nid == codec->dacs.groups[0].conv[j]) { - if (j > 0) - snprintf(w->name, - sizeof(w->name), "%s%d", - wtypes[w->type], j + 1); - else - snprintf(w->name, - sizeof(w->name), "%s", - wtypes[w->type]); - break; + group = &codec->dacs.groups[0]; + schan = 0; + for (j = 0; j < group->nconv; j++) { + if (w->nid == group->conv[j]) { + snprintf(w->name, sizeof(w->name), + "%s-%d:%d", wtypes[w->type], schan, + schan + WIDGET_CHANNELS(w) - 1); } + schan += WIDGET_CHANNELS(w); } if (codec->dacs.ngroups < 2) break; - for (j = 0; j < codec->dacs.groups[1].nconv; j++) { - if (w->nid == codec->dacs.groups[1].conv[j]) { - if (j > 0) - snprintf(w->name, - sizeof(w->name), "dig-%s%d", - wtypes[w->type], j + 1); - else - snprintf(w->name, - sizeof(w->name), "dig-%s", - wtypes[w->type]); + group = &codec->dacs.groups[1]; + schan = 0; + for (j = 0; j < group->nconv; j++) { + if (w->nid == group->conv[j]) { + snprintf(w->name, sizeof(w->name), + "dig-%s-%d:%d", wtypes[w->type], + schan, + schan + WIDGET_CHANNELS(w) - 1); } + schan += WIDGET_CHANNELS(w); } break; case COP_AWTYPE_AUDIO_INPUT: + w->mixer_class = AZ_CLASS_RECORD; if (codec->adcs.ngroups < 1) break; - w->mixer_class = AZ_CLASS_RECORD; - for (j = 0; j < codec->adcs.groups[0].nconv; j++) { - if (w->nid == codec->adcs.groups[0].conv[j]) { - if (j > 0) - snprintf(w->name, - sizeof(w->name), "%s%d", - wtypes[w->type], j + 1); - else - snprintf(w->name, - sizeof(w->name), "%s", - wtypes[w->type]); + group = &codec->adcs.groups[0]; + schan = 0; + for (j = 0; j < group->nconv; j++) { + if (w->nid == group->conv[j]) { + snprintf(w->name, sizeof(w->name), + "%s-%d:%d", wtypes[w->type], schan, + schan + WIDGET_CHANNELS(w) - 1); } + schan += WIDGET_CHANNELS(w); } if (codec->adcs.ngroups < 2) break; - for (j = 0; j < codec->adcs.groups[1].nconv; j++) { - if (w->nid == codec->adcs.groups[1].conv[j]) { - if (j > 0) - snprintf(w->name, - sizeof(w->name), "dig-%s%d", - wtypes[w->type], j + 1); - else - snprintf(w->name, - sizeof(w->name), "dig-%s", - wtypes[w->type]); + group = &codec->adcs.groups[1]; + schan = 0; + for (j = 0; j < group->nconv; j++) { + if (w->nid == group->conv[j]) { + snprintf(w->name, sizeof(w->name), + "dig-%s-%d:%d", wtypes[w->type], + schan, + schan + WIDGET_CHANNELS(w) - 1); } + schan += WIDGET_CHANNELS(w); } break; default: |