From d2cb5030091760256fcc8e755e686aab746b7697 Mon Sep 17 00:00:00 2001 From: Simon Wilson Date: Sat, 4 Jun 2011 00:57:17 -0700 Subject: Improve mixer support - support get/set of multiple values - add parameter checking to functions - add api function to get control type - add tinymix utility to list mixer controls --- include/tinyalsa/asoundlib.h | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/tinyalsa/asoundlib.h b/include/tinyalsa/asoundlib.h index f9920ce..34e5f8c 100644 --- a/include/tinyalsa/asoundlib.h +++ b/include/tinyalsa/asoundlib.h @@ -56,6 +56,19 @@ struct pcm_config { enum pcm_format format; }; +/* Mixer control types */ +enum mixer_ctl_type { + MIXER_CTL_TYPE_BOOL, + MIXER_CTL_TYPE_INT, + MIXER_CTL_TYPE_ENUM, + MIXER_CTL_TYPE_BYTE, + MIXER_CTL_TYPE_IEC958, + MIXER_CTL_TYPE_INT64, + MIXER_CTL_TYPE_UNKNOWN, + + MIXER_CTL_TYPE_MAX, +}; + /* Open and close a stream */ struct pcm *pcm_open(unsigned int card, unsigned int device, unsigned int flags, struct pcm_config *config); @@ -97,20 +110,25 @@ struct mixer *mixer_open(unsigned int card); void mixer_close(struct mixer *mixer); /* Obtain mixer controls */ -int mixer_get_num_ctls(struct mixer *mixer); +unsigned int mixer_get_num_ctls(struct mixer *mixer); 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); +/* Get info about mixer controls */ +int mixer_ctl_get_name(struct mixer_ctl *ctl, char *name, unsigned int size); +enum mixer_ctl_type mixer_ctl_get_type(struct mixer_ctl *ctl); +const char *mixer_ctl_get_type_string(struct mixer_ctl *ctl); +unsigned int mixer_ctl_get_num_values(struct mixer_ctl *ctl); + /* Set and get mixer controls */ -int mixer_ctl_get_percent(struct mixer_ctl *ctl); -int mixer_ctl_set_percent(struct mixer_ctl *ctl, int percent); +int mixer_ctl_get_percent(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_int(struct mixer_ctl *ctl); -int mixer_ctl_set_int(struct mixer_ctl *ctl, int); -int mixer_ctl_get_step(struct mixer_ctl *ctl); +int mixer_ctl_get_int(struct mixer_ctl *ctl, unsigned int id); +int mixer_ctl_set_int(struct mixer_ctl *ctl, unsigned int id, int value); int mixer_ctl_get_enum(struct mixer_ctl *ctl, const char *string, unsigned int size); -int mixer_ctl_set_enum(struct mixer_ctl *ctl, unsigned int id); +int mixer_ctl_set_enum(struct mixer_ctl *ctl, unsigned int value); int mixer_ctl_set_enum_by_name(struct mixer_ctl *ctl, const char *string); #endif -- cgit v1.2.3