2 * \file include/mixer_abst.h
3 * \brief Mixer abstract implementation interface library for the ALSA library
4 * \author Jaroslav Kysela <perex@perex.cz>
7 * Mixer abstact implementation interface library for the ALSA library
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #ifndef __ALSA_MIXER_ABST_H
27 #define __ALSA_MIXER_ABST_H
34 * \defgroup Mixer_Abstract Mixer Abstact Module Interface
35 * The mixer abstact module interface.
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 */
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
63 #define sm_selem(x) ((sm_selem_t *)((x)->private_data))
64 #define sm_selem_ops(x) ((sm_selem_t *)((x)->private_data))->ops
66 typedef struct _sm_selem {
67 snd_mixer_selem_id_t *id;
68 struct sm_elem_ops *ops;
70 unsigned int capture_group;
73 typedef struct _sm_class_basic {
77 snd_ctl_card_info_t *info;
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);
98 int snd_mixer_selem_compare(const snd_mixer_elem_t *c1, const snd_mixer_elem_t *c2);
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));
111 #endif /* __ALSA_MIXER_ABST_H */