]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
ctl: elem-value: retrieve fixed-sized array by getter method for boolean values
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 29 Jun 2022 02:49:00 +0000 (11:49 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Wed, 29 Jun 2022 02:49:00 +0000 (11:49 +0900)
In UAPI of Linux sound subsystem, 'struct snd_ctl_elem_values' has
fixed-sized array. It's natural to retrieve the array as is.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/ctl/elem-value.c
src/ctl/elem-value.h

index aeb0a3c5452095f079942d3aed42e427861ca620..10271fa6f9f131c5479f60a05127f95c59d7a0cf 100644 (file)
@@ -118,13 +118,11 @@ void alsactl_elem_value_set_bool(ALSACtlElemValue *self, const gboolean *values,
 /**
  * alsactl_elem_value_get_bool:
  * @self: A [class@ElemValue].
- * @values: (array length=value_count) (out) (transfer none): The array for boolean values.
- * @value_count: The number of values up to 128.
+ * @values: (array fixed-size=128) (out) (transfer none): The array for boolean values.
  * 
  * Refer to the array specific to [enum@ElemType].BOOLEAN element in internal storage.
  */
-void alsactl_elem_value_get_bool(ALSACtlElemValue *self, const gboolean **values,
-                                 gsize *value_count)
+void alsactl_elem_value_get_bool(ALSACtlElemValue *self, const gboolean **values)
 {
     ALSACtlElemValuePrivate *priv;
     struct snd_ctl_elem_value *value;
@@ -134,14 +132,12 @@ void alsactl_elem_value_get_bool(ALSACtlElemValue *self, const gboolean **values
     priv = alsactl_elem_value_get_instance_private(self);
 
     g_return_if_fail(values != NULL);
-    g_return_if_fail(value_count != NULL);
 
     value = &priv->value;
     for (i = 0; i < G_N_ELEMENTS(value->value.integer.value); ++i)
         priv->boolean[i] = value->value.integer.value[i] > 0;
 
     *values = priv->boolean;
-    *value_count = G_N_ELEMENTS(value->value.integer.value);
 }
 
 /**
index 8d9f89860acd5ce724ed14dec7d861a58406f34f..6607562d1ea296f61639af3cac18a18ee70cd112 100644 (file)
@@ -18,8 +18,7 @@ ALSACtlElemValue *alsactl_elem_value_new();
 
 void alsactl_elem_value_set_bool(ALSACtlElemValue *self,
                                  const gboolean *values, gsize value_count);
-void alsactl_elem_value_get_bool(ALSACtlElemValue *self,
-                                 const gboolean **values, gsize *value_count);
+void alsactl_elem_value_get_bool(ALSACtlElemValue *self, const gboolean **values);
 
 void alsactl_elem_value_set_int(ALSACtlElemValue *self, const gint32 *values,
                                 gsize value_count);