|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
azalia: converter channel namesthis diff encodes the audio stream channel numbers converters will
process into converter mixer names. e.g. inputs.dac -> inputs.dac-0:1 inputs.dac2 -> inputs.dac-2:3 inputs.dac3 -> inputs.dac-4:5 pros: * easier to understand what channels are going where * very similar in format to aucat channel numbering cons: * different than any other driver overcoming the con is not hard. software looking for 'dac' can also look for 'dac-0:'. woudn't be surprised if programs are confused by 'dac2' already anyway though. otoh, it wouldn't really bother me to make such a change universal, but I'm not really pushing that either, at this point. btw, this part of the manual change: However, a dac that is connected to built-in speaker(s) or front panel headphone jack(s) by default will convert audio stream channels starting at 0 if the dac would otherwise not be converting any channels. For example, if dac-2:3 is the default dac for the built-in speakers in a laptop, 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. is not new behaviour, it just wasn't explained before. -- jakemsr@... SDF Public Access UNIX System - http://sdf.lonestar.org Index: share/man/man4/azalia.4 =================================================================== RCS file: /cvs/src/share/man/man4/azalia.4,v retrieving revision 1.22 diff -u -p share/man/man4/azalia.4 --- share/man/man4/azalia.4 20 Oct 2009 06:31:26 -0000 1.22 +++ share/man/man4/azalia.4 23 Oct 2009 00:44:35 -0000 @@ -106,8 +106,7 @@ The widget type enumerator is used to distinguish diff 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 .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 channel(s) 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 speaker(s) or front +panel headphone jack(s) 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 channel(s) 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 channel(s) 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 channel(s) 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 Index: sys/dev/pci/azalia.c =================================================================== RCS file: /cvs/src/sys/dev/pci/azalia.c,v retrieving revision 1.158 diff -u -p sys/dev/pci/azalia.c --- sys/dev/pci/azalia.c 13 Oct 2009 19:33:16 -0000 1.158 +++ sys/dev/pci/azalia.c 23 Oct 2009 00:44:36 -0000 @@ -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: |
|
|
Re: azalia: converter channel namesno comments?
On Fri, Oct 23, 2009 at 01:16:18AM +0000, Jacob Meuser wrote: > this diff encodes the audio stream channel numbers converters will > process into converter mixer names. > > e.g. > > inputs.dac -> inputs.dac-0:1 > inputs.dac2 -> inputs.dac-2:3 > inputs.dac3 -> inputs.dac-4:5 > > pros: > * easier to understand what channels are going where > * very similar in format to aucat channel numbering > > cons: > * different than any other driver > > overcoming the con is not hard. software looking for 'dac' can also > look for 'dac-0:'. woudn't be surprised if programs are confused by > 'dac2' already anyway though. otoh, it wouldn't really bother me to > make such a change universal, but I'm not really pushing that either, > at this point. > > btw, this part of the manual change: > > However, a dac that is connected to built-in speaker(s) or front > panel headphone jack(s) by default will convert audio stream channels > starting at 0 if the dac would otherwise not be converting any channels. > For example, if dac-2:3 is the default dac for the built-in speakers in > a laptop, 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. > > is not new behaviour, it just wasn't explained before. > > -- > jakemsr@... > SDF Public Access UNIX System - http://sdf.lonestar.org > > Index: share/man/man4/azalia.4 > =================================================================== > RCS file: /cvs/src/share/man/man4/azalia.4,v > retrieving revision 1.22 > diff -u -p share/man/man4/azalia.4 > --- share/man/man4/azalia.4 20 Oct 2009 06:31:26 -0000 1.22 > +++ share/man/man4/azalia.4 23 Oct 2009 00:44:35 -0000 > @@ -106,8 +106,7 @@ The widget type enumerator is used to distinguish diff > 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 > .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 channel(s) 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 speaker(s) or front > +panel headphone jack(s) 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 channel(s) 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 channel(s) 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 channel(s) 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 > Index: sys/dev/pci/azalia.c > =================================================================== > RCS file: /cvs/src/sys/dev/pci/azalia.c,v > retrieving revision 1.158 > diff -u -p sys/dev/pci/azalia.c > --- sys/dev/pci/azalia.c 13 Oct 2009 19:33:16 -0000 1.158 > +++ sys/dev/pci/azalia.c 23 Oct 2009 00:44:36 -0000 > @@ -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: -- jakemsr@... SDF Public Access UNIX System - http://sdf.lonestar.org |
|
|
Re: azalia: converter channel namesOn Tue, Oct 27, 2009 at 4:26 AM, Jacob Meuser <jakemsr@...> wrote:
> no comments? It looks more sane and explicit, i like it. Landry |
| Free embeddable forum powered by Nabble | Forum Help |