aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2016-12-01 18:23:16 -0800
committerTaylor Holberton <taylorcholberton@gmail.com>2016-12-01 18:23:16 -0800
commita94295b6cf85fceb6b06db42b27c88131f1a18b0 (patch)
tree72cce744d670cf7a6c10ef90d03aba47f2512250 /src
parentcac43a208d0297a55876c5926eefc1c2ab195067 (diff)
Added mixer_get_ctl_const
This function was added to make available a mixer control accessor in a function that does not modify its value.
Diffstat (limited to 'src')
-rw-r--r--src/mixer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/mixer.c b/src/mixer.c
index 5fed4a8..4bb1756 100644
--- a/src/mixer.c
+++ b/src/mixer.c
@@ -195,6 +195,22 @@ unsigned int mixer_get_num_ctls(const struct mixer *mixer)
}
/** Gets a mixer control handle, by the mixer control's id.
+ * For non-const access, see @ref mixer_get_ctl
+ * @param mixer An initialized mixer handle.
+ * @param id The control's id in the given mixer.
+ * @returns A handle to the mixer control.
+ * @ingroup libtinyalsa-mixer
+ */
+const struct mixer_ctl *mixer_get_ctl_const(const struct mixer *mixer, unsigned int id)
+{
+ if (mixer && (id < mixer->count))
+ return mixer->ctl + id;
+
+ return NULL;
+}
+
+/** Gets a mixer control handle, by the mixer control's id.
+ * For const access, see @ref mixer_get_ctl_const
* @param mixer An initialized mixer handle.
* @param id The control's id in the given mixer.
* @returns A handle to the mixer control.