1 /****************************************************************************
6 ****************************************************************************/
8 typedef struct sndrv_aes_iec958 snd_aes_iec958_t;
9 typedef union sndrv_digital_audio snd_digital_audio_t;
10 typedef struct sndrv_ctl_hw_info snd_ctl_hw_info_t;
11 typedef struct sndrv_control_id snd_control_id_t;
12 typedef struct sndrv_control_list snd_control_list_t;
13 typedef struct sndrv_control_info snd_control_info_t;
14 typedef struct sndrv_control snd_control_t;
15 typedef struct sndrv_ctl_event snd_ctl_event_t;
17 #ifdef SND_ENUM_TYPECHECK
18 typedef enum sndrv_card_type snd_card_type;
19 typedef enum sndrv_control_type snd_control_type_t;
20 typedef enum sndrv_control_iface snd_control_iface_t;
21 typedef enum sndrv_ctl_event_type snd_ctl_event_type_t;
23 typedef struct __snd_card_type *snd_card_type;
24 typedef struct __snd_control_type *snd_control_type_t;
25 typedef struct __snd_control_iface *snd_control_iface_t;
26 typedef struct __snd_ctl_event_type *snd_ctl_event_type_t;
29 #define SND_CARD_TYPE_GUS_CLASSIC ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_CLASSIC)
30 #define SND_CARD_TYPE_GUS_EXTREME ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_EXTREME)
31 #define SND_CARD_TYPE_GUS_ACE ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_ACE)
32 #define SND_CARD_TYPE_GUS_MAX ((snd_card_type_t) SNDRV_CARD_TYPE_GUS_MAX)
33 #define SND_CARD_TYPE_AMD_INTERWAVE ((snd_card_type_t) SNDRV_CARD_TYPE_AMD_INTERWAVE)
34 #define SND_CARD_TYPE_SB_10 ((snd_card_type_t) SNDRV_CARD_TYPE_SB_10)
35 #define SND_CARD_TYPE_SB_20 ((snd_card_type_t) SNDRV_CARD_TYPE_SB_20)
36 #define SND_CARD_TYPE_SB_PRO ((snd_card_type_t) SNDRV_CARD_TYPE_SB_PRO)
37 #define SND_CARD_TYPE_SB_16 ((snd_card_type_t) SNDRV_CARD_TYPE_SB_16)
38 #define SND_CARD_TYPE_SB_AWE ((snd_card_type_t) SNDRV_CARD_TYPE_SB_AWE)
39 #define SND_CARD_TYPE_ESS_ES1688 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1688)
40 #define SND_CARD_TYPE_OPL3_SA2 ((snd_card_type_t) SNDRV_CARD_TYPE_OPL3_SA2)
41 #define SND_CARD_TYPE_MOZART ((snd_card_type_t) SNDRV_CARD_TYPE_MOZART)
42 #define SND_CARD_TYPE_S3_SONICVIBES ((snd_card_type_t) SNDRV_CARD_TYPE_S3_SONICVIBES)
43 #define SND_CARD_TYPE_ENS1370 ((snd_card_type_t) SNDRV_CARD_TYPE_ENS1370)
44 #define SND_CARD_TYPE_ENS1371 ((snd_card_type_t) SNDRV_CARD_TYPE_ENS1371)
45 #define SND_CARD_TYPE_CS4232 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4232)
46 #define SND_CARD_TYPE_CS4236 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4236)
47 #define SND_CARD_TYPE_AMD_INTERWAVE_STB ((snd_card_type_t) SNDRV_CARD_TYPE_AMD_INTERWAVE_STB)
48 #define SND_CARD_TYPE_ESS_ES1938 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1938)
49 #define SND_CARD_TYPE_ESS_ES18XX ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES18XX)
50 #define SND_CARD_TYPE_CS4231 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4231)
51 #define SND_CARD_TYPE_OPTI92X ((snd_card_type_t) SNDRV_CARD_TYPE_OPTI92X)
52 #define SND_CARD_TYPE_SERIAL ((snd_card_type_t) SNDRV_CARD_TYPE_SERIAL)
53 #define SND_CARD_TYPE_AD1848 ((snd_card_type_t) SNDRV_CARD_TYPE_AD1848)
54 #define SND_CARD_TYPE_TRID4DWAVEDX ((snd_card_type_t) SNDRV_CARD_TYPE_TRID4DWAVEDX)
55 #define SND_CARD_TYPE_TRID4DWAVENX ((snd_card_type_t) SNDRV_CARD_TYPE_TRID4DWAVENX)
56 #define SND_CARD_TYPE_SGALAXY ((snd_card_type_t) SNDRV_CARD_TYPE_SGALAXY)
57 #define SND_CARD_TYPE_CS46XX ((snd_card_type_t) SNDRV_CARD_TYPE_CS46XX)
58 #define SND_CARD_TYPE_WAVEFRONT ((snd_card_type_t) SNDRV_CARD_TYPE_WAVEFRONT)
59 #define SND_CARD_TYPE_TROPEZ ((snd_card_type_t) SNDRV_CARD_TYPE_TROPEZ)
60 #define SND_CARD_TYPE_TROPEZPLUS ((snd_card_type_t) SNDRV_CARD_TYPE_TROPEZPLUS)
61 #define SND_CARD_TYPE_MAUI ((snd_card_type_t) SNDRV_CARD_TYPE_MAUI)
62 #define SND_CARD_TYPE_CMI8330 ((snd_card_type_t) SNDRV_CARD_TYPE_CMI8330)
63 #define SND_CARD_TYPE_DUMMY ((snd_card_type_t) SNDRV_CARD_TYPE_DUMMY)
64 #define SND_CARD_TYPE_ALS100 ((snd_card_type_t) SNDRV_CARD_TYPE_ALS100)
65 #define SND_CARD_TYPE_SHARE ((snd_card_type_t) SNDRV_CARD_TYPE_SHARE)
66 #define SND_CARD_TYPE_SI_7018 ((snd_card_type_t) SNDRV_CARD_TYPE_SI_7018)
67 #define SND_CARD_TYPE_OPTI93X ((snd_card_type_t) SNDRV_CARD_TYPE_OPTI93X)
68 #define SND_CARD_TYPE_MTPAV ((snd_card_type_t) SNDRV_CARD_TYPE_MTPAV)
69 #define SND_CARD_TYPE_VIRMIDI ((snd_card_type_t) SNDRV_CARD_TYPE_VIRMIDI)
70 #define SND_CARD_TYPE_EMU10K1 ((snd_card_type_t) SNDRV_CARD_TYPE_EMU10K1)
71 #define SND_CARD_TYPE_HAMMERFALL ((snd_card_type_t) SNDRV_CARD_TYPE_HAMMERFALL)
72 #define SND_CARD_TYPE_HAMMERFALL_LIGHT ((snd_card_type_t) SNDRV_CARD_TYPE_HAMMERFALL_LIGHT)
73 #define SND_CARD_TYPE_ICE1712 ((snd_card_type_t) SNDRV_CARD_TYPE_ICE1712)
74 #define SND_CARD_TYPE_CMI8338 ((snd_card_type_t) SNDRV_CARD_TYPE_CMI8338)
75 #define SND_CARD_TYPE_CMI8738 ((snd_card_type_t) SNDRV_CARD_TYPE_CMI8738)
76 #define SND_CARD_TYPE_AD1816A ((snd_card_type_t) SNDRV_CARD_TYPE_AD1816A)
77 #define SND_CARD_TYPE_INTEL8X0 ((snd_card_type_t) SNDRV_CARD_TYPE_INTEL8X0)
78 #define SND_CARD_TYPE_ESS_ESOLDM1 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ESOLDM1)
79 #define SND_CARD_TYPE_ESS_ES1968 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1968)
80 #define SND_CARD_TYPE_ESS_ES1978 ((snd_card_type_t) SNDRV_CARD_TYPE_ESS_ES1978)
81 #define SND_CARD_TYPE_DIGI96 ((snd_card_type_t) SNDRV_CARD_TYPE_DIGI96)
82 #define SND_CARD_TYPE_VIA82C686A ((snd_card_type_t) SNDRV_CARD_TYPE_VIA82C686A)
83 #define SND_CARD_TYPE_FM801 ((snd_card_type_t) SNDRV_CARD_TYPE_FM801)
84 #define SND_CARD_TYPE_AZT2320 ((snd_card_type_t) SNDRV_CARD_TYPE_AZT2320)
85 #define SND_CARD_TYPE_PRODIF_PLUS ((snd_card_type_t) SNDRV_CARD_TYPE_PRODIF_PLUS)
86 #define SND_CARD_TYPE_YMFPCI ((snd_card_type_t) SNDRV_CARD_TYPE_YMFPCI)
87 #define SND_CARD_TYPE_CS4281 ((snd_card_type_t) SNDRV_CARD_TYPE_CS4281)
88 #define SND_CARD_TYPE_MPU401_UART ((snd_card_type_t) SNDRV_CARD_TYPE_MPU401_UART)
89 #define SND_CARD_TYPE_ALS4000 ((snd_card_type_t) SNDRV_CARD_TYPE_ALS4000)
90 #define SND_CARD_TYPE_ALLEGRO_1 ((snd_card_type_t) SNDRV_CARD_TYPE_ALLEGRO_1)
91 #define SND_CARD_TYPE_ALLEGRO ((snd_card_type_t) SNDRV_CARD_TYPE_ALLEGRO)
92 #define SND_CARD_TYPE_MAESTRO3 ((snd_card_type_t) SNDRV_CARD_TYPE_MAESTRO3)
93 #define SND_CARD_TYPE_AWACS ((snd_card_type_t) SNDRV_CARD_TYPE_AWACS)
94 #define SND_CARD_TYPE_NM256AV ((snd_card_type_t) SNDRV_CARD_TYPE_NM256AV)
95 #define SND_CARD_TYPE_NM256ZX ((snd_card_type_t) SNDRV_CARD_TYPE_NM256ZX)
96 #define SND_CARD_TYPE_VIA8233 ((snd_card_type_t) SNDRV_CARD_TYPE_VIA8233)
97 #define SND_CARD_TYPE_LAST ((snd_card_type_t) SNDRV_CARD_TYPE_LAST)
99 #define SND_CONTROL_TYPE_NONE ((snd_control_type_t) SNDRV_CONTROL_TYPE_NONE)
100 #define SND_CONTROL_TYPE_BOOLEAN ((snd_control_type_t) SNDRV_CONTROL_TYPE_BOOLEAN)
101 #define SND_CONTROL_TYPE_INTEGER ((snd_control_type_t) SNDRV_CONTROL_TYPE_INTEGER)
102 #define SND_CONTROL_TYPE_ENUMERATED ((snd_control_type_t) SNDRV_CONTROL_TYPE_ENUMERATED)
103 #define SND_CONTROL_TYPE_BYTES ((snd_control_type_t) SNDRV_CONTROL_TYPE_BYTES)
104 #define SND_CONTROL_TYPE_IEC958 ((snd_control_type_t) SNDRV_CONTROL_TYPE_IEC958)
106 #define SND_CONTROL_IFACE_CARD ((snd_control_iface_t) SNDRV_CONTROL_IFACE_CARD)
107 #define SND_CONTROL_IFACE_HWDEP ((snd_control_iface_t) SNDRV_CONTROL_IFACE_HWDEP)
108 #define SND_CONTROL_IFACE_MIXER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_MIXER)
109 #define SND_CONTROL_IFACE_PCM ((snd_control_iface_t) SNDRV_CONTROL_IFACE_PCM)
110 #define SND_CONTROL_IFACE_RAWMIDI ((snd_control_iface_t) SNDRV_CONTROL_IFACE_RAWMIDI)
111 #define SND_CONTROL_IFACE_TIMER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_TIMER)
112 #define SND_CONTROL_IFACE_SEQUENCER ((snd_control_iface_t) SNDRV_CONTROL_IFACE_SEQUENCER)
114 #define SND_CTL_EVENT_REBUILD ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REBUILD)
115 #define SND_CTL_EVENT_VALUE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_VALUE)
116 #define SND_CTL_EVENT_CHANGE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_CHANGE)
117 #define SND_CTL_EVENT_ADD ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_ADD)
118 #define SND_CTL_EVENT_REMOVE ((snd_ctl_event_type_t) SNDRV_CTL_EVENT_REMOVE)
120 #define SND_CONTROL_ACCESS_READ SNDRV_CONTROL_ACCESS_READ
121 #define SND_CONTROL_ACCESS_WRITE SNDRV_CONTROL_ACCESS_WRITE
122 #define SND_CONTROL_ACCESS_READWRITE SNDRV_CONTROL_ACCESS_READWRITE
123 #define SND_CONTROL_ACCESS_VOLATILE SNDRV_CONTROL_ACCESS_VOLATILE
124 #define SND_CONTROL_ACCESS_INACTIVE SNDRV_CONTROL_ACCESS_INACTIVE
125 #define SND_CONTROL_ACCESS_LOCK SNDRV_CONTROL_ACCESS_LOCK
126 #define SND_CONTROL_ACCESS_INDIRECT SNDRV_CONTROL_ACCESS_INDIRECT
134 #ifdef SND_ENUM_TYPECHECK
135 typedef struct __snd_ctl_type *snd_ctl_type_t;
137 typedef enum _snd_ctl_type snd_ctl_type_t;
140 #define SND_CTL_TYPE_HW ((snd_ctl_type_t) SND_CTL_TYPE_HW)
141 #define SND_CTL_TYPE_SHM ((snd_ctl_type_t) SND_CTL_TYPE_SHM)
142 #define SND_CTL_TYPE_INET ((snd_ctl_type_t) SND_CTL_TYPE_INET)
144 typedef struct _snd_ctl snd_ctl_t;
146 typedef struct _snd_ctl_callbacks {
147 void *private_data; /* may be used by an application */
148 void (*rebuild) (snd_ctl_t *handle, void *private_data);
149 void (*value) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
150 void (*change) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
151 void (*add) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
152 void (*remove) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
153 void *reserved[58]; /* reserved for the future use - must be NULL!!! */
154 } snd_ctl_callbacks_t;
160 int snd_card_load(int card);
161 int snd_card_next(int *card);
162 int snd_card_get_index(const char *name);
163 int snd_card_get_name(int card, char **name);
164 int snd_card_get_longname(int card, char **name);
166 int snd_defaults_card(void);
167 int snd_defaults_mixer_card(void);
168 int snd_defaults_pcm_card(void);
169 int snd_defaults_pcm_device(void);
170 int snd_defaults_rawmidi_card(void);
171 int snd_defaults_rawmidi_device(void);
173 snd_ctl_type_t snd_ctl_type(snd_ctl_t *handle);
174 int snd_ctl_open(snd_ctl_t **handle, char *name);
175 int snd_ctl_close(snd_ctl_t *handle);
176 int snd_ctl_card(snd_ctl_t *handle);
177 int snd_ctl_poll_descriptor(snd_ctl_t *handle);
178 int snd_ctl_hw_info(snd_ctl_t *handle, snd_ctl_hw_info_t *info);
179 int snd_ctl_clist(snd_ctl_t *handle, snd_control_list_t * list);
180 int snd_ctl_cinfo(snd_ctl_t *handle, snd_control_info_t * sw);
181 int snd_ctl_cread(snd_ctl_t *handle, snd_control_t * control);
182 int snd_ctl_cwrite(snd_ctl_t *handle, snd_control_t * control);
183 int snd_ctl_hwdep_next_device(snd_ctl_t *handle, int * device);
184 int snd_ctl_hwdep_info(snd_ctl_t *handle, snd_hwdep_info_t * info);
185 int snd_ctl_pcm_next_device(snd_ctl_t *handle, int *device);
186 int snd_ctl_pcm_info(snd_ctl_t *handle, snd_pcm_info_t * info);
187 int snd_ctl_pcm_prefer_subdevice(snd_ctl_t *handle, int subdev);
188 int snd_ctl_rawmidi_next_device(snd_ctl_t *handle, int * device);
189 int snd_ctl_rawmidi_info(snd_ctl_t *handle, snd_rawmidi_info_t * info);
190 int snd_ctl_rawmidi_prefer_subdevice(snd_ctl_t *handle, int subdev);
192 int snd_ctl_read(snd_ctl_t *handle, snd_ctl_callbacks_t * callbacks);
199 * Highlevel API for controls
202 #define LIST_HEAD_IS_DEFINED
204 struct list_head *next, *prev;
208 * list_entry - get the struct for this entry
209 * @ptr: the &struct list_head pointer.
210 * @type: the type of the struct this is embedded in.
211 * @member: the name of the list_struct within the struct.
213 #define list_entry(ptr, type, member) \
214 ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
217 typedef struct _snd_hcontrol_list snd_hcontrol_list_t;
218 typedef struct _snd_hcontrol snd_hcontrol_t;
220 struct _snd_hcontrol_list {
221 unsigned int controls_offset; /* W: first control ID to get */
222 unsigned int controls_request; /* W: count of control IDs to get */
223 unsigned int controls_count; /* R: count of available (set) controls */
224 unsigned int controls; /* R: count of all available controls */
225 snd_control_id_t *pids; /* W: IDs */
228 struct _snd_hcontrol {
229 snd_control_id_t id; /* must be always on top */
230 struct list_head list; /* links for list of all hcontrols */
231 int change: 1, /* structure change */
232 value: 1; /* value change */
233 /* event callbacks */
234 void (*event_change)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
235 void (*event_value)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
236 void (*event_remove)(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
239 void (*private_free)(void *private_data);
241 snd_ctl_t *handle; /* associated handle */
248 typedef int (snd_ctl_hsort_t)(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2);
249 typedef void (snd_ctl_hcallback_rebuild_t)(snd_ctl_t *handle, void *private_data);
250 typedef void (snd_ctl_hcallback_add_t)(snd_ctl_t *handle, void *private_data, snd_hcontrol_t *hcontrol);
252 int snd_ctl_hbuild(snd_ctl_t *handle, snd_ctl_hsort_t *csort);
253 int snd_ctl_hfree(snd_ctl_t *handle);
254 snd_hcontrol_t *snd_ctl_hfirst(snd_ctl_t *handle);
255 snd_hcontrol_t *snd_ctl_hlast(snd_ctl_t *handle);
256 snd_hcontrol_t *snd_ctl_hnext(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
257 snd_hcontrol_t *snd_ctl_hprev(snd_ctl_t *handle, snd_hcontrol_t *hcontrol);
258 int snd_ctl_hcount(snd_ctl_t *handle);
259 snd_hcontrol_t *snd_ctl_hfind(snd_ctl_t *handle, snd_control_id_t *id);
260 int snd_ctl_hlist(snd_ctl_t *handle, snd_hcontrol_list_t *hlist);
261 int snd_ctl_hsort(const snd_hcontrol_t *c1, const snd_hcontrol_t *c2);
262 int snd_ctl_hresort(snd_ctl_t *handle, snd_ctl_hsort_t *csort);
263 int snd_ctl_hcallback_rebuild(snd_ctl_t *handle, snd_ctl_hcallback_rebuild_t *callback, void *private_data);
264 int snd_ctl_hcallback_add(snd_ctl_t *handle, snd_ctl_hcallback_add_t *callback, void *private_data);
265 int snd_ctl_hevent(snd_ctl_t *handle);
267 int snd_ctl_hbag_create(void **bag);
268 int snd_ctl_hbag_destroy(void **bag, void (*hcontrol_free)(snd_hcontrol_t *hcontrol));
269 int snd_ctl_hbag_add(void **bag, snd_hcontrol_t *hcontrol);
270 int snd_ctl_hbag_del(void **bag, snd_hcontrol_t *hcontrol);
271 snd_hcontrol_t *snd_ctl_hbag_find(void **bag, snd_control_id_t *id);