On Mon, Feb 24, 2014 at 07:53:58PM -0500, Paul Davis wrote: > On Mon, Feb 24, 2014 at 6:19 PM, Fons Adriaensen <[email protected]>wrote: > > > > > The problem I guess is due to the way the HW related params > > are set: > > > > 1. Allocate a hw_params struct > > 2. Fill in the params using set_*** functions > > 3. Submit the hw_params struct. > > v> > In step 2, the set_*** functions are aware of the acceptable > > ranges/values and will report error if anything is not possible. > > The backend code sets the sample rate before anything related > > to channel counts is set or tested. So if the ALSA code still > > reports that 8 channels are available after the sample rate > > is set to 48 kHz, that looks to me like a bug in the driver. > > > > No, this is based on a misconception. > > 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.
Depends on the driver. For the hdspm driver for example, once the sample rate is set to 96 kHz in the hw_params (and thus before any real HW configuration is done), both snd_pcm_hw_params_get_channels_max() and ..._min() return 32 instead of 64. This depends *only* on the contents of the partially filled-in hw_params struct, not on the actual rate used at the time. And it is the only way user code can find out the value to use (apart from trying a zillion combinations). > 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. That works only if the driver _lets you set the correct values_ in the first place. If for example snd_hdspm would not work as described above, it would be impossible to set the channel count to the correct value. Both min and max would be 64, and snd_pcm_hw_params_set_channels() would refuse to accept the correct value, 32. > 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. Wrong, at least for snd_hdspm (and I did my homework before posting this message and the previous one). Ciao, -- FA A world of exhaustive, reliable metadata would be an utopia. It's also a pipe-dream, founded on self-delusion, nerd hubris and hysterically inflated market opportunities. (Cory Doctorow) _______________________________________________ Linux-audio-dev mailing list [email protected] http://lists.linuxaudio.org/listinfo/linux-audio-dev
