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