Dne 26. 03. 20 v 13:02 Kai Vehmanen napsal(a):
Hey,
On Wed, 25 Mar 2020, sylvain.bertrand@xxxxxxxxx wrote:
On this issue, I am doing something fundamentaly wrong, but I don't see how to
do it right.
While configuring a pcm, I should not use sw_params if it is a "direct-ed"
(direct::dmix) real hw pcm: in pcm_direct.c, snd_pcm_direct_sw_params
function is empty and it seems coherent with the fact the real hw pcm is
actually shared and was probably already configured.
how does the problem appear in your program?
Applications should just use the ALSA PCM API and not have any special
casing for different types of PCMs (unless the differences show up via the
public PCM API). If applications started doing plugin specifics, writing
and deploying new ALSA plugins would become much harder and kind of defeat
the whole purpose of the plugin API. In case of dmix, the
pcm.c:snd_pcm_sw_params() should do the right thing and your application
should get the cached values.
I agree. Also, the snd_pcm_direct_sw_params() does nothing, because the
sw_params are already cached in the pcm structure (see comment). It means that
the dmix (direct) plugins operates with those cached values. Just set
sw_params like for any other PCM handle. The dmix uses those values (if possible).
Jaroslav
Br, Kai
--
Jaroslav Kysela <perex@xxxxxxxx>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.