Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Eliot Blennerhassett <bigblen@icqmail.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: snd_kcontrol_new_t
Date: Fri, 16 May 2003 11:28:00 +0200	[thread overview]
Message-ID: <s5hr86zdyvz.wl@alsa2.suse.de> (raw)
In-Reply-To: <20030515195544.22379.h003.c012.wm@mail.icqmail.com.criticalpath.net>

At Thu, 15 May 2003 19:55:44 -0700 (PDT),
Eliot Blennerhassett wrote:
> 
> typedef struct _snd_kcontrol_new {
> 	snd_ctl_elem_iface_t iface;	/* interface identifier */
> 	unsigned int device;		/* device/client number */
> 	unsigned int subdevice;		/* subdevice (substream) number */
> 	unsigned char *name;		/* ASCII name of item */
> 	unsigned int index;		/* index of item */
> 	unsigned int access;		/* access rights */
> 	unsigned int count;		/* count of same elements */
> 	snd_kcontrol_info_t *info;
> 	snd_kcontrol_get_t *get;
> 	snd_kcontrol_put_t *put;
> 	unsigned long private_value;
> } snd_kcontrol_new_t;
> 
> I'd like some explanation (or pointer to where I can read about) the meaning/use
> of some fields.  (The comments say what they are, but not what they are FOR).
> 
> What is the effect of setting the device,subdevice or index number when creating
> a control?  It seems that I can leave them set to 0 as long as the name is
> unique.

yes.

the device and subdevice are used to specify the corresponding
device.  they are for pcm or other interfaces.  in the case of mixer,
they are only zero because there is only one mixer (although you are
allowed to set them).

the index is used for multiple controls with the same name, e.g.
multiple ac97 codecs.  this field is used also for accessing the
matrix-type control.  you need to convert multi-dimension to a linear
address by yourself, though.


> (as I mentioned in another post) I get trouble if I try to create two controls
> with the same name and different indices (by two calls to snd_ctl_add)
> Perhaps the only legal way to do this is to set count > 1 and create a set of
> controls with one call to snd_ctl_add()?

no, calling snd_ctl_add() twice is ok.  (in fact, snd_ctl_add()
even doesn't check the double entries :)

the counts > 1 is used when there are really identical controls with
different indices.  that means, the same callback is used with the
same private_data and private_value closures but with a different
index.  so it's suitable for a matrix-mixer style control, or controls
bundled with the (multi-channel/play) pcm streams.


Takashi


-------------------------------------------------------
Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
The only event dedicated to issues related to Linux enterprise solutions
www.enterpriselinuxforum.com

  reply	other threads:[~2003-05-16  9:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-16  2:55 snd_kcontrol_new_t Eliot Blennerhassett
2003-05-16  9:28 ` Takashi Iwai [this message]
2003-05-16 15:29 ` snd_kcontrol_new_t Paul Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hr86zdyvz.wl@alsa2.suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=bigblen@icqmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox