All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de, perex@perex.cz
Cc: alsa-devel@alsa-project.org
Subject: [PATCH 1/5] control: initialize element channel values according to identification number
Date: Mon, 15 Feb 2016 22:33:09 +0900	[thread overview]
Message-ID: <1455543193-28109-2-git-send-email-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <1455543193-28109-1-git-send-email-o-takashi@sakamocchi.jp>

In ALSA Ctl core, there're two ways to identify elements. One is by numid.
Another is by name/index. The former way is lighter than the latter way.

In control API, after adding elements by snd_ctl_elem_add_integer() and
snd_ctl_elem_add_integer64(), these functions manage to initialize value
of each channel. When executing this operation, used ID information is
still given by applications. Although, in this time, the element can be
identified according to numid.

This commit uses the numid instead of name/index pair.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 src/control/control.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/control/control.c b/src/control/control.c
index 328920d..691b69c 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -292,7 +292,7 @@ int snd_ctl_elem_add_integer(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
 	if (err < 0)
 		return err;
 	snd_ctl_elem_value_alloca(&val);
-	val->id = *id;
+	val->id = info->id;
 	for (i = 0; i < count; i++)
 		val->value.integer.value[i] = min;
 	err = ctl->ops->element_write(ctl, val);
@@ -330,7 +330,7 @@ int snd_ctl_elem_add_integer64(snd_ctl_t *ctl, const snd_ctl_elem_id_t *id,
 	if (err < 0)
 		return err;
 	snd_ctl_elem_value_alloca(&val);
-	val->id = *id;
+	val->id = info->id;
 	for (i = 0; i < count; i++)
 		val->value.integer64.value[i] = min;
 	err = ctl->ops->element_write(ctl, val);
-- 
2.5.0

  reply	other threads:[~2016-02-15 13:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-15 13:33 [RFC][PATCH 0/5] alsa-lib: add APIs for control element set Takashi Sakamoto
2016-02-15 13:33 ` Takashi Sakamoto [this message]
2016-02-15 13:33 ` [PATCH 2/5] control: rename variables so that it represents the number of channels which an element has Takashi Sakamoto
2016-02-15 13:33 ` [PATCH 3/5] control: improve API documentation Takashi Sakamoto
2016-02-15 13:33 ` [PATCH 4/5] control: add a function to add an element of bytes type Takashi Sakamoto
2016-02-15 13:33 ` [PATCH 5/5] control: add functions to add element set Takashi Sakamoto

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=1455543193-28109-2-git-send-email-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=perex@perex.cz \
    --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.