1d5ac70f0Sopenharmony_ci/** 2d5ac70f0Sopenharmony_ci * \file include/mixer_abst.h 3d5ac70f0Sopenharmony_ci * \brief Mixer abstract implementation interface library for the ALSA library 4d5ac70f0Sopenharmony_ci * \author Jaroslav Kysela <perex@perex.cz> 5d5ac70f0Sopenharmony_ci * \date 2005 6d5ac70f0Sopenharmony_ci * 7d5ac70f0Sopenharmony_ci * Mixer abstact implementation interface library for the ALSA library 8d5ac70f0Sopenharmony_ci */ 9d5ac70f0Sopenharmony_ci/* 10d5ac70f0Sopenharmony_ci * This library is free software; you can redistribute it and/or modify 11d5ac70f0Sopenharmony_ci * it under the terms of the GNU Lesser General Public License as 12d5ac70f0Sopenharmony_ci * published by the Free Software Foundation; either version 2.1 of 13d5ac70f0Sopenharmony_ci * the License, or (at your option) any later version. 14d5ac70f0Sopenharmony_ci * 15d5ac70f0Sopenharmony_ci * This program is distributed in the hope that it will be useful, 16d5ac70f0Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 17d5ac70f0Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18d5ac70f0Sopenharmony_ci * GNU Lesser General Public License for more details. 19d5ac70f0Sopenharmony_ci * 20d5ac70f0Sopenharmony_ci * You should have received a copy of the GNU Lesser General Public 21d5ac70f0Sopenharmony_ci * License along with this library; if not, write to the Free Software 22d5ac70f0Sopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23d5ac70f0Sopenharmony_ci * 24d5ac70f0Sopenharmony_ci */ 25d5ac70f0Sopenharmony_ci 26d5ac70f0Sopenharmony_ci#ifndef __ALSA_MIXER_ABST_H 27d5ac70f0Sopenharmony_ci#define __ALSA_MIXER_ABST_H 28d5ac70f0Sopenharmony_ci 29d5ac70f0Sopenharmony_ci#ifdef __cplusplus 30d5ac70f0Sopenharmony_ciextern "C" { 31d5ac70f0Sopenharmony_ci#endif 32d5ac70f0Sopenharmony_ci 33d5ac70f0Sopenharmony_ci/** 34d5ac70f0Sopenharmony_ci * \defgroup Mixer_Abstract Mixer Abstact Module Interface 35d5ac70f0Sopenharmony_ci * The mixer abstact module interface. 36d5ac70f0Sopenharmony_ci * \{ 37d5ac70f0Sopenharmony_ci */ 38d5ac70f0Sopenharmony_ci 39d5ac70f0Sopenharmony_ci#define SM_PLAY 0 40d5ac70f0Sopenharmony_ci#define SM_CAPT 1 41d5ac70f0Sopenharmony_ci 42d5ac70f0Sopenharmony_ci#define SM_CAP_GVOLUME (1<<1) 43d5ac70f0Sopenharmony_ci#define SM_CAP_GSWITCH (1<<2) 44d5ac70f0Sopenharmony_ci#define SM_CAP_PVOLUME (1<<3) 45d5ac70f0Sopenharmony_ci#define SM_CAP_PVOLUME_JOIN (1<<4) 46d5ac70f0Sopenharmony_ci#define SM_CAP_PSWITCH (1<<5) 47d5ac70f0Sopenharmony_ci#define SM_CAP_PSWITCH_JOIN (1<<6) 48d5ac70f0Sopenharmony_ci#define SM_CAP_CVOLUME (1<<7) 49d5ac70f0Sopenharmony_ci#define SM_CAP_CVOLUME_JOIN (1<<8) 50d5ac70f0Sopenharmony_ci#define SM_CAP_CSWITCH (1<<9) 51d5ac70f0Sopenharmony_ci#define SM_CAP_CSWITCH_JOIN (1<<10) 52d5ac70f0Sopenharmony_ci#define SM_CAP_CSWITCH_EXCL (1<<11) 53d5ac70f0Sopenharmony_ci#define SM_CAP_PENUM (1<<12) 54d5ac70f0Sopenharmony_ci#define SM_CAP_CENUM (1<<13) 55d5ac70f0Sopenharmony_ci/* SM_CAP_* 24-31 => private for module use */ 56d5ac70f0Sopenharmony_ci 57d5ac70f0Sopenharmony_ci#define SM_OPS_IS_ACTIVE 0 58d5ac70f0Sopenharmony_ci#define SM_OPS_IS_MONO 1 59d5ac70f0Sopenharmony_ci#define SM_OPS_IS_CHANNEL 2 60d5ac70f0Sopenharmony_ci#define SM_OPS_IS_ENUMERATED 3 61d5ac70f0Sopenharmony_ci#define SM_OPS_IS_ENUMCNT 4 62d5ac70f0Sopenharmony_ci 63d5ac70f0Sopenharmony_ci#define sm_selem(x) ((sm_selem_t *)((x)->private_data)) 64d5ac70f0Sopenharmony_ci#define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops 65d5ac70f0Sopenharmony_ci 66d5ac70f0Sopenharmony_citypedef struct _sm_selem { 67d5ac70f0Sopenharmony_ci snd_mixer_selem_id_t *id; 68d5ac70f0Sopenharmony_ci struct sm_elem_ops *ops; 69d5ac70f0Sopenharmony_ci unsigned int caps; 70d5ac70f0Sopenharmony_ci unsigned int capture_group; 71d5ac70f0Sopenharmony_ci} sm_selem_t; 72d5ac70f0Sopenharmony_ci 73d5ac70f0Sopenharmony_citypedef struct _sm_class_basic { 74d5ac70f0Sopenharmony_ci char *device; 75d5ac70f0Sopenharmony_ci snd_ctl_t *ctl; 76d5ac70f0Sopenharmony_ci snd_hctl_t *hctl; 77d5ac70f0Sopenharmony_ci snd_ctl_card_info_t *info; 78d5ac70f0Sopenharmony_ci} sm_class_basic_t; 79d5ac70f0Sopenharmony_ci 80d5ac70f0Sopenharmony_cistruct sm_elem_ops { 81d5ac70f0Sopenharmony_ci int (*is)(snd_mixer_elem_t *elem, int dir, int cmd, int val); 82d5ac70f0Sopenharmony_ci int (*get_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max); 83d5ac70f0Sopenharmony_ci int (*set_range)(snd_mixer_elem_t *elem, int dir, long min, long max); 84d5ac70f0Sopenharmony_ci int (*get_dB_range)(snd_mixer_elem_t *elem, int dir, long *min, long *max); 85d5ac70f0Sopenharmony_ci int (*ask_vol_dB)(snd_mixer_elem_t *elem, int dir, long value, long *dbValue); 86d5ac70f0Sopenharmony_ci int (*ask_dB_vol)(snd_mixer_elem_t *elem, int dir, long dbValue, long *value, int xdir); 87d5ac70f0Sopenharmony_ci int (*get_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value); 88d5ac70f0Sopenharmony_ci int (*get_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long *value); 89d5ac70f0Sopenharmony_ci int (*set_volume)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value); 90d5ac70f0Sopenharmony_ci int (*set_dB)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value, int xdir); 91d5ac70f0Sopenharmony_ci int (*get_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int *value); 92d5ac70f0Sopenharmony_ci int (*set_switch)(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value); 93d5ac70f0Sopenharmony_ci int (*enum_item_name)(snd_mixer_elem_t *elem, unsigned int item, size_t maxlen, char *buf); 94d5ac70f0Sopenharmony_ci int (*get_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *itemp); 95d5ac70f0Sopenharmony_ci int (*set_enum_item)(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int item); 96d5ac70f0Sopenharmony_ci}; 97d5ac70f0Sopenharmony_ci 98d5ac70f0Sopenharmony_ciint snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2); 99d5ac70f0Sopenharmony_ci 100d5ac70f0Sopenharmony_ciint snd_mixer_sbasic_info(const snd_mixer_class_t *mixer_class, sm_class_basic_t *info); 101d5ac70f0Sopenharmony_civoid *snd_mixer_sbasic_get_private(const snd_mixer_class_t *mixer_class); 102d5ac70f0Sopenharmony_civoid snd_mixer_sbasic_set_private(const snd_mixer_class_t *mixer_class, void *private_data); 103d5ac70f0Sopenharmony_civoid snd_mixer_sbasic_set_private_free(const snd_mixer_class_t *mixer_class, void (*private_free)(snd_mixer_class_t *mixer_class)); 104d5ac70f0Sopenharmony_ci 105d5ac70f0Sopenharmony_ci/** \} */ 106d5ac70f0Sopenharmony_ci 107d5ac70f0Sopenharmony_ci#ifdef __cplusplus 108d5ac70f0Sopenharmony_ci} 109d5ac70f0Sopenharmony_ci#endif 110d5ac70f0Sopenharmony_ci 111d5ac70f0Sopenharmony_ci#endif /* __ALSA_MIXER_ABST_H */ 112d5ac70f0Sopenharmony_ci 113