Hello !

I tried to be Luke ;-), and found following rules for the hammerfall cards:

(Maybe I interpret these false)

A) rule_channel which set the limits to channels

->min to double speed channels and channels max to hdsp->singlespeed channels

(in hdsp double speed channels is 13 and ss speed are 26, 
in hdspm they are 32 and 64)

Why ? Is there a reason to let channels min not to be 1 ?

-> In my opninion I would drop these and also set 
   .channels_min = 1; 
   in ..._playback and ..._record_subinfo.


B) Rule set channel according to rate

Here if rate->min is greater than 48000 ( which means double speed rate),  set
 channelslimit max to double speed channel. thats ok.

but why also set channel->min in the interval also to nummer of double speed 
channels and not 1 (or leave it to be as is).

-> So i suggest to set t interval to min=1 (or .channels_min from the subinfo).

C) Rule set rate according to channels:

  if channel->min count is bigger than ss_speed channels (which means more then 
  max channels  of the card), than set rate limits to singlespeed.

first this should never happen (since in subinfo limited) and 
if then should  it be if channel->min is bigger than double speed channels set
rate to single speed which would be

        if (c->min >= hdsp->ds_channels) {
                snd_interval_t t = {
                        .min = 32000,
                        .max = 48000,
                        .integer = 1,
                };
        }

and the else tree (will never be evaluated) says

 if channels max < double speed channels use double speed rate

Why is it not allowed to use single speed wenn less channels than double speed
can handle are needed ?

-> I would suggest to drop the else tree.

In my hdspm driver the changes  works until now (playback only tested) 
but maybe there is a reason i dont know.

  mfg winfried

PS: Here the source for other Lukes ;-)

Rule A)
static int snd_hdsp_hw_rule_channels(snd_pcm_hw_params_t *params,
                                        snd_pcm_hw_rule_t *rule)
{
        hdsp_t *hdsp = rule->private;
        snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
        unsigned int list[2] = { hdsp->ds_channels, hdsp->ss_channels };
        return snd_interval_list(c, 2, list, 0);
}


Rule B)
static int snd_hdsp_hw_rule_channels_rate(snd_pcm_hw_params_t *params,
                                             snd_pcm_hw_rule_t *rule)
{
        hdsp_t *hdsp = rule->private;
        snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
        snd_interval_t *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
        if (r->min > 48000) {
                snd_interval_t t = {
                        .min = hdsp->ds_channels,
                        .max = hdsp->ds_channels,
                        .integer = 1,
                };
                return snd_interval_refine(c, &t);
        } else if (r->max < 64000) {
                snd_interval_t t = {
                        .min = hdsp->ss_channels,
                        .max = hdsp->ss_channels,
                        .integer = 1,
                };
                return snd_interval_refine(c, &t);
        }
        return 0;
}


Rule C)
static int snd_hdsp_hw_rule_rate_channels(snd_pcm_hw_params_t *params,
                                             snd_pcm_hw_rule_t *rule)
{
        hdsp_t *hdsp = rule->private;
        snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS);
        snd_interval_t *r = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE);
        if (c->min >= hdsp->ss_channels) {
                snd_interval_t t = {
                        .min = 32000,
                        .max = 48000,
                        .integer = 1,
                };
                return snd_interval_refine(r, &t);
        } else if (c->max <= hdsp->ds_channels) {
                snd_interval_t t = {
                        .min = 64000,
                        .max = 96000,
                        .integer = 1,
                };
                return snd_interval_refine(r, &t);
        }
        return 0;
}


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to