OSDN Git Service

Changed descriptors_count
[android-x86/external-alsa-lib.git] / include / control.h
1 /****************************************************************************
2  *                                                                          *
3  *                              control.h                                   *
4  *                          Control Interface                               *
5  *                                                                          *
6  ****************************************************************************/
7
8 typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
9 typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
10 typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
11 typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
12 typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
13 typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;
14 typedef struct _snd_ctl_event snd_ctl_event_t;
15
16 #ifdef SND_ENUM_TYPECHECK
17 typedef struct __snd_card_type *snd_card_type_t;
18 typedef struct __snd_ctl_elem_type *snd_ctl_elem_type_t;
19 typedef struct __snd_ctl_elem_iface *snd_ctl_elem_iface_t;
20 typedef struct __snd_ctl_event_type *snd_ctl_event_type_t;
21 #else
22 typedef enum sndrv_card_type snd_card_type_t;
23 typedef enum sndrv_ctl_elem_type snd_ctl_elem_type_t;
24 typedef enum sndrv_ctl_elem_iface snd_ctl_elem_iface_t;
25 typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
26 #endif
27
28 #define SND_CARD_TYPE_GUS_CLASSIC ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_CLASSIC)
29 #define SND_CARD_TYPE_GUS_EXTREME ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_EXTREME)
30 #define SND_CARD_TYPE_GUS_ACE ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_ACE)
31 #define SND_CARD_TYPE_GUS_MAX ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_MAX)
32 #define SND_CARD_TYPE_AMD_INTERWAVE ((snd_card_type_t) SNDRV_CARD_TYPE_AMD_INTERWAVE)
33 #define SND_CARD_TYPE_SB_10 ((snd_card_type_t) SNDRV_CARD_TYPE_SB_10)
34 #define SND_CARD_TYPE_SB_20 ((snd_card_type_t) SNDRV_CARD_TYPE_SB_20)
35 #define SND_CARD_TYPE_SB_PRO ((snd_card_type_t) SNDRV_CARD_TYPE_SB_PRO)
36 #define SND_CARD_TYPE_SB_16 ((snd_card_type_t) SNDRV_CARD_TYPE_SB_16)
37 #define SND_CARD_TYPE_SB_AWE ((snd_card_type_t) SNDRV_CARD_TYPE_SB_AWE)
38 #define SND_CARD_TYPE_ESS_ES1688 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1688)
39 #define SND_CARD_TYPE_OPL3_SA2 ((snd_card_type_t) SNDRV_CARD_TYPE_OPL3_SA2)
40 #define SND_CARD_TYPE_MOZART ((snd_card_type_t) SNDRV_CARD_TYPE_MOZART)
41 #define SND_CARD_TYPE_S3_SONICVIBES ((snd_card_type_t) SNDRV_CARD_TYPE_S3_SONICVIBES)
42 #define SND_CARD_TYPE_ENS1370 ((snd_card_type_t) SNDRV_CARD_TYPE_ENS1370)
43 #define SND_CARD_TYPE_ENS1371 ((snd_card_type_t) SNDRV_CARD_TYPE_ENS1371)
44 #define SND_CARD_TYPE_CS4232 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4232)
45 #define SND_CARD_TYPE_CS4236 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4236)
46 #define SND_CARD_TYPE_AMD_INTERWAVE_STB ((snd_card_type_t) SNDRV_CARD_TYPE_AMD_INTERWAVE_STB)
47 #define SND_CARD_TYPE_ESS_ES1938 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1938)
48 #define SND_CARD_TYPE_ESS_ES18XX ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES18XX)
49 #define SND_CARD_TYPE_CS4231 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4231)
50 #define SND_CARD_TYPE_OPTI92X ((snd_card_type_t) SNDRV_CARD_TYPE_OPTI92X)
51 #define SND_CARD_TYPE_SERIAL ((snd_card_type_t) SNDRV_CARD_TYPE_SERIAL)
52 #define SND_CARD_TYPE_AD1848 ((snd_card_type_t) SNDRV_CARD_TYPE_AD1848)
53 #define SND_CARD_TYPE_TRID4DWAVEDX ((snd_card_type_t) SNDRV_CARD_TYPE_TRID4DWAVEDX)
54 #define SND_CARD_TYPE_TRID4DWAVENX ((snd_card_type_t) SNDRV_CARD_TYPE_TRID4DWAVENX)
55 #define SND_CARD_TYPE_SGALAXY ((snd_card_type_t) SNDRV_CARD_TYPE_SGALAXY)
56 #define SND_CARD_TYPE_CS46XX ((snd_card_type_t) SNDRV_CARD_TYPE_CS46XX)
57 #define SND_CARD_TYPE_WAVEFRONT ((snd_card_type_t) SNDRV_CARD_TYPE_WAVEFRONT)
58 #define SND_CARD_TYPE_TROPEZ ((snd_card_type_t) SNDRV_CARD_TYPE_TROPEZ)
59 #define SND_CARD_TYPE_TROPEZPLUS ((snd_card_type_t) SNDRV_CARD_TYPE_TROPEZPLUS)
60 #define SND_CARD_TYPE_MAUI ((snd_card_type_t) SNDRV_CARD_TYPE_MAUI)
61 #define SND_CARD_TYPE_CMI8330 ((snd_card_type_t) SNDRV_CARD_TYPE_CMI8330)
62 #define SND_CARD_TYPE_DUMMY ((snd_card_type_t) SNDRV_CARD_TYPE_DUMMY)
63 #define SND_CARD_TYPE_ALS100 ((snd_card_type_t) SNDRV_CARD_TYPE_ALS100)
64 #define SND_CARD_TYPE_SHARE ((snd_card_type_t) SNDRV_CARD_TYPE_SHARE)
65 #define SND_CARD_TYPE_SI_7018 ((snd_card_type_t) SNDRV_CARD_TYPE_SI_7018)
66 #define SND_CARD_TYPE_OPTI93X ((snd_card_type_t) SNDRV_CARD_TYPE_OPTI93X)
67 #define SND_CARD_TYPE_MTPAV ((snd_card_type_t) SNDRV_CARD_TYPE_MTPAV)
68 #define SND_CARD_TYPE_VIRMIDI ((snd_card_type_t) SNDRV_CARD_TYPE_VIRMIDI)
69 #define SND_CARD_TYPE_EMU10K1 ((snd_card_type_t) SNDRV_CARD_TYPE_EMU10K1)
70 #define SND_CARD_TYPE_HAMMERFALL ((snd_card_type_t) SNDRV_CARD_TYPE_HAMMERFALL)
71 #define SND_CARD_TYPE_HAMMERFALL_LIGHT ((snd_card_type_t) SNDRV_CARD_TYPE_HAMMERFALL_LIGHT)
72 #define SND_CARD_TYPE_ICE1712 ((snd_card_type_t) SNDRV_CARD_TYPE_ICE1712)
73 #define SND_CARD_TYPE_CMI8338 ((snd_card_type_t) SNDRV_CARD_TYPE_CMI8338)
74 #define SND_CARD_TYPE_CMI8738 ((snd_card_type_t) SNDRV_CARD_TYPE_CMI8738)
75 #define SND_CARD_TYPE_AD1816A ((snd_card_type_t) SNDRV_CARD_TYPE_AD1816A)
76 #define SND_CARD_TYPE_INTEL8X0 ((snd_card_type_t) SNDRV_CARD_TYPE_INTEL8X0)
77 #define SND_CARD_TYPE_ESS_ESOLDM1 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ESOLDM1)
78 #define SND_CARD_TYPE_ESS_ES1968 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1968)
79 #define SND_CARD_TYPE_ESS_ES1978 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1978)
80 #define SND_CARD_TYPE_DIGI96 ((snd_card_type_t) SNDRV_CARD_TYPE_DIGI96)
81 #define SND_CARD_TYPE_VIA82C686A ((snd_card_type_t) SNDRV_CARD_TYPE_VIA82C686A)
82 #define SND_CARD_TYPE_FM801 ((snd_card_type_t) SNDRV_CARD_TYPE_FM801)
83 #define SND_CARD_TYPE_AZT2320 ((snd_card_type_t) SNDRV_CARD_TYPE_AZT2320)
84 #define SND_CARD_TYPE_PRODIF_PLUS ((snd_card_type_t) SNDRV_CARD_TYPE_PRODIF_PLUS)
85 #define SND_CARD_TYPE_YMFPCI ((snd_card_type_t) SNDRV_CARD_TYPE_YMFPCI)
86 #define SND_CARD_TYPE_CS4281 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4281)
87 #define SND_CARD_TYPE_MPU401_UART ((snd_card_type_t) SNDRV_CARD_TYPE_MPU401_UART)
88 #define SND_CARD_TYPE_ALS4000 ((snd_card_type_t) SNDRV_CARD_TYPE_ALS4000)
89 #define SND_CARD_TYPE_ALLEGRO_1 ((snd_card_type_t) SNDRV_CARD_TYPE_ALLEGRO_1)
90 #define SND_CARD_TYPE_ALLEGRO ((snd_card_type_t) SNDRV_CARD_TYPE_ALLEGRO)
91 #define SND_CARD_TYPE_MAESTRO3 ((snd_card_type_t) SNDRV_CARD_TYPE_MAESTRO3)
92 #define SND_CARD_TYPE_AWACS ((snd_card_type_t) SNDRV_CARD_TYPE_AWACS)
93 #define SND_CARD_TYPE_NM256AV ((snd_card_type_t) SNDRV_CARD_TYPE_NM256AV)
94 #define SND_CARD_TYPE_NM256ZX ((snd_card_type_t) SNDRV_CARD_TYPE_NM256ZX)
95 #define SND_CARD_TYPE_VIA8233 ((snd_card_type_t) SNDRV_CARD_TYPE_VIA8233)
96 #define SND_CARD_TYPE_LAST ((snd_card_type_t) SNDRV_CARD_TYPE_LAST)
97
98 #define SND_CTL_ELEM_TYPE_NONE ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_NONE)
99 #define SND_CTL_ELEM_TYPE_BOOLEAN ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_BOOLEAN)
100 #define SND_CTL_ELEM_TYPE_INTEGER ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_INTEGER)
101 #define SND_CTL_ELEM_TYPE_ENUMERATED ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_ENUMERATED)
102 #define SND_CTL_ELEM_TYPE_BYTES ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_BYTES)
103 #define SND_CTL_ELEM_TYPE_IEC958 ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_IEC958)
104 #define SND_CTL_ELEM_TYPE_LAST ((snd_ctl_elem_type_t) SNDRV_CTL_ELEM_TYPE_LAST)
105
106 #define SND_CTL_ELEM_IFACE_CARD ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_CARD)
107 #define SND_CTL_ELEM_IFACE_HWDEP ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_HWDEP)
108 #define SND_CTL_ELEM_IFACE_MIXER ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_MIXER)
109 #define SND_CTL_ELEM_IFACE_PCM ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_PCM)
110 #define SND_CTL_ELEM_IFACE_RAWMIDI ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_RAWMIDI)
111 #define SND_CTL_ELEM_IFACE_TIMER ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_TIMER)
112 #define SND_CTL_ELEM_IFACE_SEQUENCER ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_SEQUENCER)
113 #define SND_CTL_ELEM_IFACE_LAST ((snd_ctl_elem_iface_t) SNDRV_CTL_ELEM_IFACE_LAST)
114
115 #define SND_CTL_EVENT_ELEM ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_ELEM)
116 #define SND_CTL_EVENT_LAST ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_LAST)
117
118 #define SND_CTL_EVENT_MASK_ADD SNDRV_CTL_EVENT_MASK_ADD
119 #define SND_CTL_EVENT_MASK_INFO SNDRV_CTL_EVENT_MASK_INFO
120 #define SND_CTL_EVENT_MASK_VALUE SNDRV_CTL_EVENT_MASK_VALUE
121 #define SND_CTL_EVENT_MASK_REMOVE SNDRV_CTL_EVENT_MASK_REMOVE
122
123 enum _snd_ctl_type {
124         SND_CTL_TYPE_HW,
125         SND_CTL_TYPE_SHM,
126         SND_CTL_TYPE_INET
127 };
128
129 #ifdef SND_ENUM_TYPECHECK
130 typedef struct __snd_ctl_type *snd_ctl_type_t;
131 #else
132 typedef enum _snd_ctl_type snd_ctl_type_t;
133 #endif
134
135 #define SND_CTL_TYPE_HW ((snd_ctl_type_t) SND_CTL_TYPE_HW)
136 #define SND_CTL_TYPE_SHM ((snd_ctl_type_t) SND_CTL_TYPE_SHM)
137 #define SND_CTL_TYPE_INET ((snd_ctl_type_t) SND_CTL_TYPE_INET)
138
139 typedef struct _snd_ctl snd_ctl_t;
140
141 #ifdef __cplusplus
142 extern "C" {
143 #endif
144
145 int snd_card_load(int card);
146 int snd_card_next(int *card);
147 int snd_card_get_index(const char *name);
148 int snd_card_get_name(int card, char **name);
149 int snd_card_get_longname(int card, char **name);
150
151 int snd_defaults_card(void);
152 int snd_defaults_mixer_card(void);
153 int snd_defaults_pcm_card(void);
154 int snd_defaults_pcm_device(void);
155 int snd_defaults_rawmidi_card(void);
156 int snd_defaults_rawmidi_device(void);
157
158 snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
159 int snd_ctl_open(snd_ctl_t **ctl, const char *name);
160 int snd_ctl_close(snd_ctl_t *ctl);
161 int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
162 int snd_ctl_async(snd_ctl_t *ctl, int sig, pid_t pid);
163 int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
164 int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);
165 int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);
166 int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);
167 int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t * list);
168 int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);
169 int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);
170 int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);
171 int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);
172 int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);
173 int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);
174 int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);
175 int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
176 int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
177 int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
178 int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
179
180 int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);
181 int snd_ctl_wait(snd_ctl_t *ctl, int timeout);
182 const char *snd_ctl_name(snd_ctl_t *ctl);
183 snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
184
185 void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size);
186 const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
187 const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
188 const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
189
190 unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
191 unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);
192 void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);
193 snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);
194 unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);
195 unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);
196 const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);
197 unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);
198
199 int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);
200 void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);
201
202 #ifdef __cplusplus
203 }
204 #endif
205
206 /*
207  *  Highlevel API for controls
208  */
209
210 typedef struct _snd_hctl_elem snd_hctl_elem_t;
211
212 typedef struct _snd_hctl snd_hctl_t;
213
214 #ifdef __cplusplus
215 extern "C" {
216 #endif
217
218 typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
219                                   const snd_hctl_elem_t *e2);
220 typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
221                                    unsigned int mask,
222                                    snd_hctl_elem_t *elem);
223 typedef int (*snd_hctl_elem_callback_t)(snd_hctl_elem_t *elem,
224                                         unsigned int mask);
225
226 int snd_hctl_open(snd_hctl_t **hctl, const char *name);
227 int snd_hctl_close(snd_hctl_t *hctl);
228 int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
229 int snd_hctl_async(snd_hctl_t *hctl, int sig, pid_t pid);
230 int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
231 int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
232 unsigned int snd_hctl_get_count(snd_hctl_t *hctl);
233 int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t hsort);
234 snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl);
235 snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl);
236 snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id);
237 void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback);
238 void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *data);
239 void *snd_hctl_get_callback_private(snd_hctl_t *hctl);
240 int snd_hctl_load(snd_hctl_t *hctl);
241 int snd_hctl_free(snd_hctl_t *hctl);
242 int snd_hctl_handle_event(snd_hctl_t *hctl, snd_ctl_event_t *event);
243 int snd_hctl_handle_events(snd_hctl_t *hctl);
244 const char *snd_hctl_name(snd_hctl_t *hctl);
245 snd_ctl_type_t snd_hctl_type(snd_hctl_t *hctl);
246 int snd_hctl_wait(snd_hctl_t *hctl, int timeout);
247
248 snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem);
249 snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem);
250 int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t * info);
251 int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
252 int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
253
254 snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem);
255
256 #ifdef __cplusplus
257 }
258 #endif
259