All of lore.kernel.org
 help / color / mirror / Atom feed
* How exactly snd_pcm_hw_rule_add() should to be used?
@ 2013-02-05 10:24 Peter Ujfalusi
  2013-02-05 11:13 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2013-02-05 10:24 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela; +Cc: alsa-devel@alsa-project.org

Hi,

I got confused (again) regarding to how to use correctly the
snd_pcm_hw_rule_add(). Looking at the documentation [1] and to the code in
kernel seams to be suggesting the opposite.

[A]
using the 5.6. example from [1]:
snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
		    hw_rule_channels_by_format, 0, SNDRV_PCM_HW_PARAM_FORMAT,
		    -1);

The [1] tells me that the SNDRV_PCM_HW_PARAM_FORMAT will be refined based on
the SNDRV_PCM_HW_PARAM_CHANNELS.

In 5.7. of [1] the reverse rule is placed:
snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT,
		    hw_rule_channels_by_format, 0,
		    SNDRV_PCM_HW_PARAM_CHANNELS, -1);

Which according to the example will refine the SNDRV_PCM_HW_PARAM_CHANNELS
based on the SNDRV_PCM_HW_PARAM_FORMAT.

However when looking at the code in the kernel the opposite seams to be what
is actually happening.

[B]
using the same 5.6. example from [1]:
snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
		    hw_rule_channels_by_format, 0, SNDRV_PCM_HW_PARAM_FORMAT,
		    -1);

It looks like the SNDRV_PCM_HW_PARAM_CHANNELS should be refined based on the
SNDRV_PCM_HW_PARAM_FORMAT.

Which one is the correct interpretation?

The reason I'm asking is that I need to have a rule which would place
constraint (step) on the BUFFER_SIZE based on the used RATE, but I can not use
a single snd_pcm_hw_constraint_step(,,BUFFER_TIME,) because of HW limitation.

Thank you,
Péter

[1] http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s09.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-05 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 10:24 How exactly snd_pcm_hw_rule_add() should to be used? Peter Ujfalusi
2013-02-05 11:13 ` Takashi Iwai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.