1 /****************************************************************************
6 ****************************************************************************/
8 typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
10 /** CTL card info container */
11 typedef struct _snd_ctl_card_info snd_ctl_card_info_t;
13 /** CTL element identificator container */
14 typedef struct _snd_ctl_elem_id snd_ctl_elem_id_t;
16 /** CTL element identificator list container */
17 typedef struct _snd_ctl_elem_list snd_ctl_elem_list_t;
19 /** CTL element info container */
20 typedef struct _snd_ctl_elem_info snd_ctl_elem_info_t;
22 /** CTL element value container */
23 typedef struct _snd_ctl_elem_value snd_ctl_elem_value_t;
25 /** CTL event container */
26 typedef struct _snd_ctl_event snd_ctl_event_t;
29 typedef enum _snd_card_type {
30 SND_CARD_TYPE_GUS_CLASSIC = SNDRV_CARD_TYPE_GUS_CLASSIC,
31 SND_CARD_TYPE_GUS_EXTREME = SNDRV_CARD_TYPE_GUS_EXTREME,
32 SND_CARD_TYPE_GUS_ACE = SNDRV_CARD_TYPE_GUS_ACE,
33 SND_CARD_TYPE_GUS_MAX = SNDRV_CARD_TYPE_GUS_MAX,
34 SND_CARD_TYPE_AMD_INTERWAVE = SNDRV_CARD_TYPE_AMD_INTERWAVE,
35 SND_CARD_TYPE_SB_10 = SNDRV_CARD_TYPE_SB_10,
36 SND_CARD_TYPE_SB_20 = SNDRV_CARD_TYPE_SB_20,
37 SND_CARD_TYPE_SB_PRO = SNDRV_CARD_TYPE_SB_PRO,
38 SND_CARD_TYPE_SB_16 = SNDRV_CARD_TYPE_SB_16,
39 SND_CARD_TYPE_SB_AWE = SNDRV_CARD_TYPE_SB_AWE,
40 SND_CARD_TYPE_ESS_ES1688 = SNDRV_CARD_TYPE_ESS_ES1688,
41 SND_CARD_TYPE_OPL3_SA2 = SNDRV_CARD_TYPE_OPL3_SA2,
42 SND_CARD_TYPE_MOZART = SNDRV_CARD_TYPE_MOZART,
43 SND_CARD_TYPE_S3_SONICVIBES = SNDRV_CARD_TYPE_S3_SONICVIBES,
44 SND_CARD_TYPE_ENS1370 = SNDRV_CARD_TYPE_ENS1370,
45 SND_CARD_TYPE_ENS1371 = SNDRV_CARD_TYPE_ENS1371,
46 SND_CARD_TYPE_CS4232 = SNDRV_CARD_TYPE_CS4232,
47 SND_CARD_TYPE_CS4236 = SNDRV_CARD_TYPE_CS4236,
48 SND_CARD_TYPE_AMD_INTERWAVE_STB = SNDRV_CARD_TYPE_AMD_INTERWAVE_STB,
49 SND_CARD_TYPE_ESS_ES1938 = SNDRV_CARD_TYPE_ESS_ES1938,
50 SND_CARD_TYPE_ESS_ES18XX = SNDRV_CARD_TYPE_ESS_ES18XX,
51 SND_CARD_TYPE_CS4231 = SNDRV_CARD_TYPE_CS4231,
52 SND_CARD_TYPE_OPTI92X = SNDRV_CARD_TYPE_OPTI92X,
53 SND_CARD_TYPE_SERIAL = SNDRV_CARD_TYPE_SERIAL,
54 SND_CARD_TYPE_AD1848 = SNDRV_CARD_TYPE_AD1848,
55 SND_CARD_TYPE_TRID4DWAVEDX = SNDRV_CARD_TYPE_TRID4DWAVEDX,
56 SND_CARD_TYPE_TRID4DWAVENX = SNDRV_CARD_TYPE_TRID4DWAVENX,
57 SND_CARD_TYPE_SGALAXY = SNDRV_CARD_TYPE_SGALAXY,
58 SND_CARD_TYPE_CS46XX = SNDRV_CARD_TYPE_CS46XX,
59 SND_CARD_TYPE_WAVEFRONT = SNDRV_CARD_TYPE_WAVEFRONT,
60 SND_CARD_TYPE_TROPEZ = SNDRV_CARD_TYPE_TROPEZ,
61 SND_CARD_TYPE_TROPEZPLUS = SNDRV_CARD_TYPE_TROPEZPLUS,
62 SND_CARD_TYPE_MAUI = SNDRV_CARD_TYPE_MAUI,
63 SND_CARD_TYPE_CMI8330 = SNDRV_CARD_TYPE_CMI8330,
64 SND_CARD_TYPE_DUMMY = SNDRV_CARD_TYPE_DUMMY,
65 SND_CARD_TYPE_ALS100 = SNDRV_CARD_TYPE_ALS100,
66 SND_CARD_TYPE_SHARE = SNDRV_CARD_TYPE_SHARE,
67 SND_CARD_TYPE_SI_7018 = SNDRV_CARD_TYPE_SI_7018,
68 SND_CARD_TYPE_OPTI93X = SNDRV_CARD_TYPE_OPTI93X,
69 SND_CARD_TYPE_MTPAV = SNDRV_CARD_TYPE_MTPAV,
70 SND_CARD_TYPE_VIRMIDI = SNDRV_CARD_TYPE_VIRMIDI,
71 SND_CARD_TYPE_EMU10K1 = SNDRV_CARD_TYPE_EMU10K1,
72 SND_CARD_TYPE_HAMMERFALL = SNDRV_CARD_TYPE_HAMMERFALL,
73 SND_CARD_TYPE_HAMMERFALL_LIGHT = SNDRV_CARD_TYPE_HAMMERFALL_LIGHT,
74 SND_CARD_TYPE_ICE1712 = SNDRV_CARD_TYPE_ICE1712,
75 SND_CARD_TYPE_CMI8338 = SNDRV_CARD_TYPE_CMI8338,
76 SND_CARD_TYPE_CMI8738 = SNDRV_CARD_TYPE_CMI8738,
77 SND_CARD_TYPE_AD1816A = SNDRV_CARD_TYPE_AD1816A,
78 SND_CARD_TYPE_INTEL8X0 = SNDRV_CARD_TYPE_INTEL8X0,
79 SND_CARD_TYPE_ESS_ESOLDM1 = SNDRV_CARD_TYPE_ESS_ESOLDM1,
80 SND_CARD_TYPE_ESS_ES1968 = SNDRV_CARD_TYPE_ESS_ES1968,
81 SND_CARD_TYPE_ESS_ES1978 = SNDRV_CARD_TYPE_ESS_ES1978,
82 SND_CARD_TYPE_DIGI96 = SNDRV_CARD_TYPE_DIGI96,
83 SND_CARD_TYPE_VIA82C686A = SNDRV_CARD_TYPE_VIA82C686A,
84 SND_CARD_TYPE_FM801 = SNDRV_CARD_TYPE_FM801,
85 SND_CARD_TYPE_AZT2320 = SNDRV_CARD_TYPE_AZT2320,
86 SND_CARD_TYPE_PRODIF_PLUS = SNDRV_CARD_TYPE_PRODIF_PLUS,
87 SND_CARD_TYPE_YMFPCI = SNDRV_CARD_TYPE_YMFPCI,
88 SND_CARD_TYPE_CS4281 = SNDRV_CARD_TYPE_CS4281,
89 SND_CARD_TYPE_MPU401_UART = SNDRV_CARD_TYPE_MPU401_UART,
90 SND_CARD_TYPE_ALS4000 = SNDRV_CARD_TYPE_ALS4000,
91 SND_CARD_TYPE_ALLEGRO_1 = SNDRV_CARD_TYPE_ALLEGRO_1,
92 SND_CARD_TYPE_ALLEGRO = SNDRV_CARD_TYPE_ALLEGRO,
93 SND_CARD_TYPE_MAESTRO3 = SNDRV_CARD_TYPE_MAESTRO3,
94 SND_CARD_TYPE_AWACS = SNDRV_CARD_TYPE_AWACS,
95 SND_CARD_TYPE_NM256AV = SNDRV_CARD_TYPE_NM256AV,
96 SND_CARD_TYPE_NM256ZX = SNDRV_CARD_TYPE_NM256ZX,
97 SND_CARD_TYPE_VIA8233 = SNDRV_CARD_TYPE_VIA8233,
98 SND_CARD_TYPE_LAST = SNDRV_CARD_TYPE_LAST,
101 /** CTL element type */
102 typedef enum _snd_ctl_elem_type {
104 SND_CTL_ELEM_TYPE_NONE = SNDRV_CTL_ELEM_TYPE_NONE,
105 /** Boolean contents */
106 SND_CTL_ELEM_TYPE_BOOLEAN = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
107 /** Integer contents */
108 SND_CTL_ELEM_TYPE_INTEGER = SNDRV_CTL_ELEM_TYPE_INTEGER,
109 /** Enumerated contents */
110 SND_CTL_ELEM_TYPE_ENUMERATED = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
111 /** Bytes contents */
112 SND_CTL_ELEM_TYPE_BYTES = SNDRV_CTL_ELEM_TYPE_BYTES,
113 /** IEC958 (S/PDIF) setting content */
114 SND_CTL_ELEM_TYPE_IEC958 = SNDRV_CTL_ELEM_TYPE_IEC958,
115 SND_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_LAST,
116 } snd_ctl_elem_type_t;
118 /** CTL related interface */
119 typedef enum _snd_ctl_elem_iface {
121 SND_CTL_ELEM_IFACE_CARD = SNDRV_CTL_ELEM_IFACE_CARD,
122 /** Hardware dependent device */
123 SND_CTL_ELEM_IFACE_HWDEP = SNDRV_CTL_ELEM_IFACE_HWDEP,
125 SND_CTL_ELEM_IFACE_MIXER = SNDRV_CTL_ELEM_IFACE_MIXER,
127 SND_CTL_ELEM_IFACE_PCM = SNDRV_CTL_ELEM_IFACE_PCM,
129 SND_CTL_ELEM_IFACE_RAWMIDI = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
131 SND_CTL_ELEM_IFACE_TIMER = SNDRV_CTL_ELEM_IFACE_TIMER,
133 SND_CTL_ELEM_IFACE_SEQUENCER = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
134 SND_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_LAST,
135 } snd_ctl_elem_iface_t;
138 typedef enum _snd_ctl_event_type {
139 /** Elements related event */
140 SND_CTL_EVENT_ELEM = SNDRV_CTL_EVENT_ELEM,
141 SND_CTL_EVENT_LAST = SNDRV_CTL_EVENT_LAST,
142 }snd_ctl_event_type_t;
144 /** Element has been removed (Warning: test this first and if set don't
145 * test the other masks) \hideinitializer */
146 #define SND_CTL_EVENT_MASK_REMOVE SNDRV_CTL_EVENT_MASK_REMOVE
147 /** Element has been added \hideinitializer */
148 #define SND_CTL_EVENT_MASK_ADD SNDRV_CTL_EVENT_MASK_ADD
149 /** Element info has been changed \hideinitializer */
150 #define SND_CTL_EVENT_MASK_INFO SNDRV_CTL_EVENT_MASK_INFO
151 /** Element value has been changed \hideinitializer */
152 #define SND_CTL_EVENT_MASK_VALUE SNDRV_CTL_EVENT_MASK_VALUE
154 #define SND_CTL_NAME_IEC958 SNDRV_CTL_NAME_IEC958
157 typedef enum _snd_ctl_type {
158 /** Kernel level CTL */
160 /** Shared memory client CTL */
162 /** INET client CTL (not yet implemented) */
166 /** Non blocking mode \hideinitializer */
167 #define SND_CTL_NONBLOCK 0x0001
169 /** Async notification \hideinitializer */
170 #define SND_CTL_ASYNC 0x0002
173 typedef struct _snd_ctl snd_ctl_t;
179 int snd_card_load(int card);
180 int snd_card_next(int *card);
181 int snd_card_get_index(const char *name);
182 int snd_card_get_name(int card, char **name);
183 int snd_card_get_longname(int card, char **name);
185 int snd_defaults_card(void);
186 int snd_defaults_mixer_card(void);
187 int snd_defaults_pcm_card(void);
188 int snd_defaults_pcm_device(void);
189 int snd_defaults_rawmidi_card(void);
190 int snd_defaults_rawmidi_device(void);
192 snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
193 int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
194 int snd_ctl_close(snd_ctl_t *ctl);
195 int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
196 int snd_ctl_async(snd_ctl_t *ctl, int sig, pid_t pid);
197 int snd_ctl_poll_descriptors_count(snd_ctl_t *ctl);
198 int snd_ctl_poll_descriptors(snd_ctl_t *ctl, struct pollfd *pfds, unsigned int space);
199 int snd_ctl_subscribe_events(snd_ctl_t *ctl, int subscribe);
200 int snd_ctl_card_info(snd_ctl_t *ctl, snd_ctl_card_info_t *info);
201 int snd_ctl_elem_list(snd_ctl_t *ctl, snd_ctl_elem_list_t * list);
202 int snd_ctl_elem_info(snd_ctl_t *ctl, snd_ctl_elem_info_t *info);
203 int snd_ctl_elem_read(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);
204 int snd_ctl_elem_write(snd_ctl_t *ctl, snd_ctl_elem_value_t *value);
205 int snd_ctl_hwdep_next_device(snd_ctl_t *ctl, int * device);
206 int snd_ctl_hwdep_info(snd_ctl_t *ctl, snd_hwdep_info_t * info);
207 int snd_ctl_pcm_next_device(snd_ctl_t *ctl, int *device);
208 int snd_ctl_pcm_info(snd_ctl_t *ctl, snd_pcm_info_t * info);
209 int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *ctl, int subdev);
210 int snd_ctl_rawmidi_next_device(snd_ctl_t *ctl, int * device);
211 int snd_ctl_rawmidi_info(snd_ctl_t *ctl, snd_rawmidi_info_t * info);
212 int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *ctl, int subdev);
214 int snd_ctl_read(snd_ctl_t *ctl, snd_ctl_event_t *event);
215 int snd_ctl_wait(snd_ctl_t *ctl, int timeout);
216 const char *snd_ctl_name(snd_ctl_t *ctl);
217 snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
219 void snd_ctl_elem_set_bytes(snd_ctl_elem_value_t *obj, void *data, size_t size);
220 const char *snd_ctl_elem_type_name(snd_ctl_elem_type_t type);
221 const char *snd_ctl_elem_iface_name(snd_ctl_elem_iface_t iface);
222 const char *snd_ctl_event_type_name(snd_ctl_event_type_t type);
224 unsigned int snd_ctl_event_elem_get_mask(const snd_ctl_event_t *obj);
225 unsigned int snd_ctl_event_elem_get_numid(const snd_ctl_event_t *obj);
226 void snd_ctl_event_elem_get_id(const snd_ctl_event_t *obj, snd_ctl_elem_id_t *ptr);
227 snd_ctl_elem_iface_t snd_ctl_event_elem_get_interface(const snd_ctl_event_t *obj);
228 unsigned int snd_ctl_event_elem_get_device(const snd_ctl_event_t *obj);
229 unsigned int snd_ctl_event_elem_get_subdevice(const snd_ctl_event_t *obj);
230 const char *snd_ctl_event_elem_get_name(const snd_ctl_event_t *obj);
231 unsigned int snd_ctl_event_elem_get_index(const snd_ctl_event_t *obj);
233 int snd_ctl_elem_list_alloc_space(snd_ctl_elem_list_t *obj, unsigned int entries);
234 void snd_ctl_elem_list_free_space(snd_ctl_elem_list_t *obj);
241 * Highlevel API for controls
244 /** HCTL element handle */
245 typedef struct _snd_hctl_elem snd_hctl_elem_t;
248 typedef struct _snd_hctl snd_hctl_t;
255 * \brief Compare function for sorting HCTL elements
256 * \param e1 First element
257 * \param e2 Second element
258 * \return -1 if e1 < e2, 0 if e1 == e2, 1 if e1 > e2
260 typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
261 const snd_hctl_elem_t *e2);
263 * \brief HCTL callback function
264 * \param hctl HCTL handle
265 * \param mask event mask
266 * \param elem related HCTL element (if any)
267 * \return 0 on success otherwise a negative error code
269 typedef int (*snd_hctl_callback_t)(snd_hctl_t *hctl,
271 snd_hctl_elem_t *elem);
273 * \brief HCTL element callback function
274 * \param elem HCTL element
275 * \param mask event mask
276 * \return 0 on success otherwise a negative error code
278 typedef int (*snd_hctl_elem_callback_t)(snd_hctl_elem_t *elem,
281 int snd_hctl_open(snd_hctl_t **hctl, const char *name, int mode);
282 int snd_hctl_close(snd_hctl_t *hctl);
283 int snd_hctl_nonblock(snd_hctl_t *hctl, int nonblock);
284 int snd_hctl_async(snd_hctl_t *hctl, int sig, pid_t pid);
285 int snd_hctl_poll_descriptors_count(snd_hctl_t *hctl);
286 int snd_hctl_poll_descriptors(snd_hctl_t *hctl, struct pollfd *pfds, unsigned int space);
287 unsigned int snd_hctl_get_count(snd_hctl_t *hctl);
288 int snd_hctl_set_compare(snd_hctl_t *hctl, snd_hctl_compare_t hsort);
289 snd_hctl_elem_t *snd_hctl_first_elem(snd_hctl_t *hctl);
290 snd_hctl_elem_t *snd_hctl_last_elem(snd_hctl_t *hctl);
291 snd_hctl_elem_t *snd_hctl_find_elem(snd_hctl_t *hctl, const snd_ctl_elem_id_t *id);
292 void snd_hctl_set_callback(snd_hctl_t *hctl, snd_hctl_callback_t callback);
293 void snd_hctl_set_callback_private(snd_hctl_t *hctl, void *data);
294 void *snd_hctl_get_callback_private(snd_hctl_t *hctl);
295 int snd_hctl_load(snd_hctl_t *hctl);
296 int snd_hctl_free(snd_hctl_t *hctl);
297 int snd_hctl_handle_events(snd_hctl_t *hctl);
298 const char *snd_hctl_name(snd_hctl_t *hctl);
299 snd_ctl_type_t snd_hctl_type(snd_hctl_t *hctl);
300 int snd_hctl_wait(snd_hctl_t *hctl, int timeout);
302 snd_hctl_elem_t *snd_hctl_elem_next(snd_hctl_elem_t *elem);
303 snd_hctl_elem_t *snd_hctl_elem_prev(snd_hctl_elem_t *elem);
304 int snd_hctl_elem_info(snd_hctl_elem_t *elem, snd_ctl_elem_info_t * info);
305 int snd_hctl_elem_read(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
306 int snd_hctl_elem_write(snd_hctl_elem_t *elem, snd_ctl_elem_value_t * value);
308 snd_hctl_t *snd_hctl_elem_get_hctl(snd_hctl_elem_t *elem);