ALSA project - the C library reference
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mixer.h
Go to the documentation of this file.
1 
11 /*
12  * This library is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License as
14  * published by the Free Software Foundation; either version 2.1 of
15  * the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU Lesser General Public License for more details.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 #ifndef __ALSA_MIXER_H
29 #define __ALSA_MIXER_H
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
42 typedef struct _snd_mixer snd_mixer_t;
44 typedef struct _snd_mixer_class snd_mixer_class_t;
46 typedef struct _snd_mixer_elem snd_mixer_elem_t;
47 
55 typedef int (*snd_mixer_callback_t)(snd_mixer_t *ctl,
56  unsigned int mask,
57  snd_mixer_elem_t *elem);
58 
66  unsigned int mask);
67 
74 typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
75  const snd_mixer_elem_t *e2);
76 
85 typedef int (*snd_mixer_event_t)(snd_mixer_class_t *class_, unsigned int mask,
86  snd_hctl_elem_t *helem, snd_mixer_elem_t *melem);
87 
88 
90 typedef enum _snd_mixer_elem_type {
91  /* Simple mixer elements */
92  SND_MIXER_ELEM_SIMPLE,
93  SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE
95 
96 int snd_mixer_open(snd_mixer_t **mixer, int mode);
97 int snd_mixer_close(snd_mixer_t *mixer);
101 int snd_mixer_attach(snd_mixer_t *mixer, const char *name);
102 int snd_mixer_attach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
103 int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
104 int snd_mixer_detach_hctl(snd_mixer_t *mixer, snd_hctl_t *hctl);
105 int snd_mixer_get_hctl(snd_mixer_t *mixer, const char *name, snd_hctl_t **hctl);
107 int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
108 int snd_mixer_poll_descriptors_revents(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
109 int snd_mixer_load(snd_mixer_t *mixer);
110 void snd_mixer_free(snd_mixer_t *mixer);
111 int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
115 void snd_mixer_set_callback_private(snd_mixer_t *obj, void * val);
116 unsigned int snd_mixer_get_count(const snd_mixer_t *obj);
118 
125 
129  int compare_weight,
130  void *private_data,
131  void (*private_free)(snd_mixer_elem_t *elem));
140 void *snd_mixer_elem_get_private(const snd_mixer_elem_t *melem);
141 
142 size_t snd_mixer_class_sizeof(void);
147 #define snd_mixer_class_alloca(ptr) __snd_alloca(ptr, snd_mixer_class)
156 int snd_mixer_class_set_private(snd_mixer_class_t *class_, void *private_data);
157 int snd_mixer_class_set_private_free(snd_mixer_class_t *class_, void (*private_free)(snd_mixer_class_t *));
159 
167 /* Simple mixer elements API */
168 
170 typedef enum _snd_mixer_selem_channel_id {
191  SND_MIXER_SCHN_LAST = 31,
195 
202 };
203 
207  int ver;
211  const char *device;
216 };
217 
219 typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
220 
222 
224  struct snd_mixer_selem_regopt *options,
225  snd_mixer_class_t **classp);
228 const char *snd_mixer_selem_get_name(snd_mixer_elem_t *elem);
229 unsigned int snd_mixer_selem_get_index(snd_mixer_elem_t *elem);
231  const snd_mixer_selem_id_t *id);
232 
250 
251 int snd_mixer_selem_ask_playback_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
252 int snd_mixer_selem_ask_capture_vol_dB(snd_mixer_elem_t *elem, long value, long *dBvalue);
253 int snd_mixer_selem_ask_playback_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
254 int snd_mixer_selem_ask_capture_dB_vol(snd_mixer_elem_t *elem, long dBvalue, int dir, long *value);
263 int snd_mixer_selem_set_playback_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
264 int snd_mixer_selem_set_capture_dB(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, long value, int dir);
267 int snd_mixer_selem_set_playback_dB_all(snd_mixer_elem_t *elem, long value, int dir);
268 int snd_mixer_selem_set_capture_dB_all(snd_mixer_elem_t *elem, long value, int dir);
274  long *min, long *max);
276  long *min, long *max);
278  long min, long max);
280  long *min, long *max);
282  long *min, long *max);
284  long min, long max);
285 
290 int snd_mixer_selem_get_enum_item_name(snd_mixer_elem_t *elem, unsigned int idx, size_t maxlen, char *str);
291 int snd_mixer_selem_get_enum_item(snd_mixer_elem_t *elem, snd_mixer_selem_channel_id_t channel, unsigned int *idxp);
293 
294 size_t snd_mixer_selem_id_sizeof(void);
299 #define snd_mixer_selem_id_alloca(ptr) __snd_alloca(ptr, snd_mixer_selem_id)
303 const char *snd_mixer_selem_id_get_name(const snd_mixer_selem_id_t *obj);
304 unsigned int snd_mixer_selem_id_get_index(const snd_mixer_selem_id_t *obj);
305 void snd_mixer_selem_id_set_name(snd_mixer_selem_id_t *obj, const char *val);
306 void snd_mixer_selem_id_set_index(snd_mixer_selem_id_t *obj, unsigned int val);
307 
312 #ifdef __cplusplus
313 }
314 #endif
315 
316 #endif /* __ALSA_MIXER_H */
317