From: James Courtier-Dutton <James@superbug.co.uk>
To: Takashi Iwai <tiwai@suse.de>
Cc: ALSA development <alsa-devel@alsa-project.org>
Subject: Re: dB gain
Date: Mon, 29 May 2006 18:34:06 +0100 [thread overview]
Message-ID: <447B308E.2050502@superbug.co.uk> (raw)
In-Reply-To: <s5hy7wkddyf.wl%tiwai@suse.de>
Takashi Iwai wrote:
>
> I agree to use numid.
> My argument is that numid can belong to the common header block.
>
> The code you find in control.c is anyway a kind of object oriented.
> It's a message to a control element.
> But in this protocol, you get numid at very last, even depending on
> the type. Thus the code looks like
>
> type = get_type();
> len = get_length();
> switch (type) {
> case DB_SCALE:
> numid = get_value();
> kctl = get_kcontrol(numid);
> kctl->info2(kctl, ptr);
> ...
> }
>
> When you add more different types,
>
> type = get_type();
> len = get_length();
> switch (type) {
> case DB_SCALE:
> numid = get_value();
> kctl = get_kcontrol(numid);
> kctl->info2(kctl, ptr);
> ...
> case ANOTHER_DB_SCALE:
> numid = get_value();
> kctl = get_kcontrol(numid);
> kctl->info2(kctl, ptr);
> ...
> case YET_ANOTHER_DATA:
> numid = get_value();
> kctl = get_kcontrol(numid);
> kctl->info2(kctl, ptr);
> ...
>
> }
>
> If the numid is in the common block, we can simply extract numid
> first, then evaluate the type and value later, eventually call the
> callback at the single place.
>
>
> Takashi
My point is that there will only be one DB_SCALE case in the request
handler in control.c in the kernel. It simply calls info2(). The driver
then returns a TLV. The returned TLV will have all the variations on
db_scales. control.c won't care what the actual TLV value means. It will
simply return it to user space, and let alsa-lib work out what it is.
Another call the snd_ctl_misc might not even need a numid. It might
instead be requesting some other information, like card name or some
other future bit of info needed. My point is this is extensible, without
breaking kernel/alsa-lib binary compatibility.
James
next prev parent reply other threads:[~2006-05-29 17:34 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-27 19:03 dB gain James Courtier-Dutton
2006-05-29 13:08 ` Takashi Iwai
2006-05-29 13:47 ` Jaroslav Kysela
2006-05-29 14:17 ` Jaroslav Kysela
2006-05-29 14:28 ` Takashi Iwai
2006-05-29 14:55 ` Jaroslav Kysela
2006-05-29 15:12 ` James Courtier-Dutton
2006-05-29 15:41 ` Takashi Iwai
2006-05-29 18:34 ` Jaroslav Kysela
2006-05-29 19:21 ` James Courtier-Dutton
2006-05-29 14:50 ` James Courtier-Dutton
2006-05-29 15:54 ` Takashi Iwai
2006-05-29 17:34 ` James Courtier-Dutton [this message]
2006-05-29 18:11 ` Takashi Iwai
2006-05-29 18:27 ` Jaroslav Kysela
2006-05-30 18:59 ` James Courtier-Dutton
2006-05-30 19:49 ` Jaroslav Kysela
2006-05-31 10:47 ` Takashi Iwai
2006-05-31 11:04 ` James Courtier-Dutton
2006-05-31 11:31 ` Takashi Iwai
2006-05-31 11:18 ` Takashi Iwai
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=447B308E.2050502@superbug.co.uk \
--to=james@superbug.co.uk \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
/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 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.