<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Feb 24, 2014 at 6:19 PM, Fons Adriaensen <span dir="ltr"><<a href="mailto:fons@linuxaudio.org" target="_blank">fons@linuxaudio.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
The problem I guess is due to the way the HW related params<br>
are set:<br>
<br>
1.  Allocate a hw_params struct<br>
2.  Fill in the params using set_*** functions<br>
3.  Submit the hw_params struct.<br>
<br>
In step 2, the set_*** functions are aware of the acceptable<br>
ranges/values and will report error if anything is not possible.<br>
The backend code sets the sample rate before anything related<br>
to channel counts is set or tested. So if the ALSA code still<br>
reports that 8 channels are available after the sample rate<br>
is set to 48 kHz, that looks to me like a bug in the driver.<br></blockquote><div><br></div><div>No, this is based on a misconception.<br><br>The legal ALSA driver parameters form a sparse multi-dimensional space. The driver knows the legal intervals along each dimensional axis, but it does not know the shape of the intersecting space.<br>
<br></div><div>Thus the only way to find out if a given combination of parameters is legal is to try to set them and see if the hardware accepts them.<br><br></div><div>I only know the RME Hammerfall driver well, but in that case, where the channel count changes depending on whether you do <88.2kHz or >= 88.2kHz, there is no way that the driver can tell you that your attempt to use too many channels is wrong until you submit the entire h/w params struct. <br>
</div><div><br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
The HW itself is not set up before step 3, so it is probably<br>
still set to 44.1 kHz while the hw_params is filled in, and it<br>
reports 8 channels.<br></blockquote><div><br></div><div>No. The driver just gives you some values based on a possible (or maybe even most likely) scenario. The driver does not know the number of channels in a definitive way. This is partly an ALSA API issue and partly a h/w issue - in some cases, you just don't know (or it is very fiddly and complex to find out - e.g. is there a daughterboard present that increases the channel count in some cases).<br>
</div><div> <br></div></div></div></div>