From 63257a7b4b47cd654c96511366645eb2b6025956 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 17 Feb 2009 17:29:17 +0100 Subject: oss: Add numid check in ctl plugin Added the check of non-zero numid to optimize the look-up for the element. Signed-off-by: Takashi Iwai --- oss/ctl_oss.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/oss/ctl_oss.c b/oss/ctl_oss.c index b589f74..b8847b1 100644 --- a/oss/ctl_oss.c +++ b/oss/ctl_oss.c @@ -151,7 +151,21 @@ static snd_ctl_ext_key_t oss_find_elem(snd_ctl_ext_t *ext, { snd_ctl_oss_t *oss = ext->private_data; const char *name; - unsigned int i, key; + unsigned int i, key, numid; + + numid = snd_ctl_elem_id_get_numid(id); + if (numid > 0) { + numid--; + if (numid < oss->num_vol_ctls) + return oss->vol_ctl[numid]; + numid -= oss->num_vol_ctls; + if (oss->exclusive_input) { + if (!numid) + return OSS_KEY_CAPTURE_MUX; + } else if (numid < oss->num_rec_items) + return oss->rec_item[numid] | + OSS_KEY_CAPTURE_FLAG; + } name = snd_ctl_elem_id_get_name(id); if (! strcmp(name, "Capture Source")) { -- cgit