Thanks for the reply.. We followed your suggestions and we see the PCM stream controls from the user space after we have created the controls at the driver using IFACE_PCM tags..
But when I try to set the 'index' in 'snd_ctl_elem_id' to reflect the PCM substream number, it seems to always get reset to '0'. Can you please suggest, how to set the index.
--- snapshot of the code -------- snd_ctl_elem_info_alloca(&info); snd_ctl_elem_id_alloca(&id); snd_ctl_elem_value_alloca(&control); snd_ctl_elem_id_set_numid(id, ctl_num); snd_ctl_elem_id_set_interface(id, SND_CTL_ELEM_IFACE_PCM);
fprintf(stdout,"setting the mute/unmute for stream index 0x%x \n", (unsigned int) stream_id); snd_ctl_elem_id_set_index(id,(unsigned int) stream_id);
if (handle == NULL && (err = snd_ctl_open(&handle, card, 0)) < 0) { fprintf(stderr,"Control %s open error: %s\n", card, snd_strerror(err)); return err; } snd_ctl_elem_info_set_id(info, id); if ((err = snd_ctl_elem_info(handle, info)) < 0) { fprintf(stderr,"Cannot find the given element from control %s\n", card); return err; } snd_ctl_elem_info_get_id(info, id); /* FIXME: Remove it when hctl find works ok !!! */ type = snd_ctl_elem_info_get_type(info); count = snd_ctl_elem_info_get_count(info); snd_ctl_elem_value_set_id(control, id);
show_control_id(id); printf("\n"); fprintf(stdout, "Retrieving the stream index 0x%x \n",snd_ctl_elem_id_get_index(id)); ----------------------------------------------------------------
Thanks a bunch !! Hari
-----Original Message----- From: Takashi Iwai [mailto:tiwai@suse.de] Sent: Wednesday, April 04, 2007 11:21 AM To: Nagalla, Hari Cc: alsa-devel@alsa-project.org Subject: Re: [alsa-devel] Individual PCM stream control
At Fri, 30 Mar 2007 05:47:11 -0500, Nagalla, Hari wrote:
Thanks for the advice.. Couple of inline questions below..
-----Original Message-----
I am new to ALSA, so some help from experienced folks would
help..
We are trying to develop ALSA support for our DSP based mixer.
In
our
architecture DSP performs the mixing, sample rate conversion
etc. My
question is how, can does the user space applications exercise controlling individual PCM stream to the mixer? Ex: individual
stream
gain control, individual stream mute, etc.. Any user space
example
code
would be useful too..
Most drivers create PCM volume controls with IFACE_PCM tag, and
set up
the volume appropriately at each PCM open, or let alsa-lib configs
to
set up the initial volumes. Usually, the control element index corresponds to the PCM substream number.
Which alsa library API lets us to set up the PCM stream volume? And
can
it be used dynamically when the stream is active?
It is controlled via the normal control API. Open the snd_ctl_t handle for the same card (e.g. "hw:0" or "default"), and change the value of the element. However, there is no standard name for the individual PCM volume controls, and currrently depending on the driver implementation...
I could n't figure out 'index' of the control element.
It's the index in snd_ctl_elem_id. You can access via snd_ctl_elem_id_{get|set}_index() in alsa-lib.
Takashi