From cac43a208d0297a55876c5926eefc1c2ab195067 Mon Sep 17 00:00:00 2001 From: Taylor Holberton Date: Thu, 1 Dec 2016 18:11:24 -0800 Subject: Added const specifier for several mixer functions Functions changed are: - mixer_get_name - mixer_get_num_ctls - mixer_ctl_get_id - mixer_ctl_get_name - mixer_ctl_get_type - mixer_ctl_get_type_string - mixer_ctl_get_num_values - mixer_ctl_get_num_enums - mixer_ctl_get_enum_string - mixer_ctl_get_percent - mixer_ctl_get_value - mixer_ctl_get_array - mixer_ctl_get_range_min - mixer_ctl_get_range_max --- include/tinyalsa/mixer.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/tinyalsa/mixer.h b/include/tinyalsa/mixer.h index 4de6133..fb862f3 100644 --- a/include/tinyalsa/mixer.h +++ b/include/tinyalsa/mixer.h @@ -69,9 +69,9 @@ struct mixer *mixer_open(unsigned int card); void mixer_close(struct mixer *mixer); -const char *mixer_get_name(struct mixer *mixer); +const char *mixer_get_name(const struct mixer *mixer); -unsigned int mixer_get_num_ctls(struct mixer *mixer); +unsigned int mixer_get_num_ctls(const struct mixer *mixer); struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id); @@ -81,17 +81,17 @@ struct mixer_ctl *mixer_get_ctl_by_name_and_index(struct mixer *mixer, const char *name, unsigned int index); -unsigned int mixer_ctl_get_id(struct mixer_ctl *ctl); +unsigned int mixer_ctl_get_id(const struct mixer_ctl *ctl); -const char *mixer_ctl_get_name(struct mixer_ctl *ctl); +const char *mixer_ctl_get_name(const struct mixer_ctl *ctl); -enum mixer_ctl_type mixer_ctl_get_type(struct mixer_ctl *ctl); +enum mixer_ctl_type mixer_ctl_get_type(const struct mixer_ctl *ctl); -const char *mixer_ctl_get_type_string(struct mixer_ctl *ctl); +const char *mixer_ctl_get_type_string(const struct mixer_ctl *ctl); -unsigned int mixer_ctl_get_num_values(struct mixer_ctl *ctl); +unsigned int mixer_ctl_get_num_values(const struct mixer_ctl *ctl); -unsigned int mixer_ctl_get_num_enums(struct mixer_ctl *ctl); +unsigned int mixer_ctl_get_num_enums(const struct mixer_ctl *ctl); const char *mixer_ctl_get_enum_string(struct mixer_ctl *ctl, unsigned int enum_id); @@ -102,13 +102,13 @@ const char *mixer_ctl_get_enum_string(struct mixer_ctl *ctl, unsigned int enum_i void mixer_ctl_update(struct mixer_ctl *ctl); /* Set and get mixer controls */ -int mixer_ctl_get_percent(struct mixer_ctl *ctl, unsigned int id); +int mixer_ctl_get_percent(const struct mixer_ctl *ctl, unsigned int id); int mixer_ctl_set_percent(struct mixer_ctl *ctl, unsigned int id, int percent); -int mixer_ctl_get_value(struct mixer_ctl *ctl, unsigned int id); +int mixer_ctl_get_value(const struct mixer_ctl *ctl, unsigned int id); -int mixer_ctl_get_array(struct mixer_ctl *ctl, void *array, size_t count); +int mixer_ctl_get_array(const struct mixer_ctl *ctl, void *array, size_t count); int mixer_ctl_set_value(struct mixer_ctl *ctl, unsigned int id, int value); @@ -117,9 +117,9 @@ int mixer_ctl_set_array(struct mixer_ctl *ctl, const void *array, size_t count); int mixer_ctl_set_enum_by_string(struct mixer_ctl *ctl, const char *string); /* Determe range of integer mixer controls */ -int mixer_ctl_get_range_min(struct mixer_ctl *ctl); +int mixer_ctl_get_range_min(const struct mixer_ctl *ctl); -int mixer_ctl_get_range_max(struct mixer_ctl *ctl); +int mixer_ctl_get_range_max(const struct mixer_ctl *ctl); #if defined(__cplusplus) } /* extern "C" */ -- cgit v1.2.3 From a94295b6cf85fceb6b06db42b27c88131f1a18b0 Mon Sep 17 00:00:00 2001 From: Taylor Holberton Date: Thu, 1 Dec 2016 18:23:16 -0800 Subject: 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. --- include/tinyalsa/mixer.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/tinyalsa/mixer.h b/include/tinyalsa/mixer.h index fb862f3..a54b5c1 100644 --- a/include/tinyalsa/mixer.h +++ b/include/tinyalsa/mixer.h @@ -73,6 +73,8 @@ const char *mixer_get_name(const struct mixer *mixer); unsigned int mixer_get_num_ctls(const struct mixer *mixer); +const struct mixer_ctl *mixer_get_ctl_const(const struct mixer *mixer, unsigned int id); + struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id); struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name); -- cgit v1.2.3