All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH alsa-lib 1/2] control: fix typo
@ 2021-06-24 17:15 Nihal Jere
  2021-06-24 17:16 ` [PATCH alsa-lib 2/2] control: improve documentation for snd_ctl_elem_info_t Nihal Jere
  0 siblings, 1 reply; 2+ messages in thread
From: Nihal Jere @ 2021-06-24 17:15 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nihal Jere

Signed-off-by: Nihal Jere <nihal@nihaljere.xyz>
---
 src/control/control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/control/control.c b/src/control/control.c
index 91415b51..3930c7b1 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -390,7 +390,7 @@ int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info)
 /**
  * \brief Get a list of element identifiers
  *
- * Before calling this function, memoru must be allocated using
+ * Before calling this function, memory must be allocated using
  * snd_ctl_elem_list_malloc().
  *
  * This function obtains data from the sound card driver and puts it
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH alsa-lib 2/2] control: improve documentation for snd_ctl_elem_info_t
  2021-06-24 17:15 [PATCH alsa-lib 1/2] control: fix typo Nihal Jere
@ 2021-06-24 17:16 ` Nihal Jere
  0 siblings, 0 replies; 2+ messages in thread
From: Nihal Jere @ 2021-06-24 17:16 UTC (permalink / raw)
  To: alsa-devel; +Cc: Nihal Jere

Signed-off-by: Nihal Jere <nihal@nihaljere.xyz>
---
 include/control.h     | 38 +++++++++++++++++++++++++++++++++++++-
 src/control/control.c |  5 +++++
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/include/control.h b/include/control.h
index e386ecec..47e462fd 100644
--- a/include/control.h
+++ b/include/control.h
@@ -152,7 +152,43 @@ typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
  */
 typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
 
-/** CTL element info container */
+/** CTL element info container
+ *
+ * snd_ctl_elem_info_t can be allocated, cleared, and copied in the same
+ * way as #snd_ctl_elem_value_t, using the analogous functions.
+ *
+ * The ID can be filled in in the same way as for snd_ctl_elem_value_t,
+ * substituting snd_ctl_elem_value_* functions for snd_ctl_elem_info_*
+ * functions. See #snd_ctl_elem_value_t for details.
+ *
+ * The ID or numid must be set before calling snd_ctl_elem_info.
+ *
+ * \code
+ *   snd_ctl_t* ctl;
+ *   snd_ctl_elem_info_t* info;
+ *   snd_ctl_elem_id_t* id;
+ *
+ *   // Allocate info
+ *   snd_ctl_elem_info_malloc(&info);
+ *
+ *   // Obtain id, setup ctl...
+ *
+ *   // set id
+ *   snd_ctl_elem_info_set_id(info, id);
+ *   // OR just set numid (more applicable if you don't have an id)
+ *   snd_ctl_elem_info_set_id(info, snd_ctl_elem_id_get_numid(id));
+ *
+ *   // Get info from driver
+ *   snd_ctl_elem_info(ctl, info);
+ *
+ *   // Do things with info...
+ *
+ *   // Cleanup
+ *   snd_ctl_elem_info_free(info);
+ * \endcode
+ *
+ * The above example excludes error checking for the sake of readability.
+ */
 typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
 
 /** CTL element value container.
diff --git a/src/control/control.c b/src/control/control.c
index 3930c7b1..e346fa6b 100644
--- a/src/control/control.c
+++ b/src/control/control.c
@@ -417,6 +417,11 @@ int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t *list)
 
 /**
  * \brief Get CTL element information
+ * 
+ * The object "info" must be allocated and the ID or numid must be filled
+ * prior to calling this function.
+ * See #snd_ctl_elem_info_t to learn more.
+ *
  * \param ctl CTL handle
  * \param info CTL element id/information pointer
  * \return 0 on success otherwise a negative error code
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-24 17:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24 17:15 [PATCH alsa-lib 1/2] control: fix typo Nihal Jere
2021-06-24 17:16 ` [PATCH alsa-lib 2/2] control: improve documentation for snd_ctl_elem_info_t Nihal Jere

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.