restructuring
[rrq/lsp-utils.git] / lsp-alsa / libasound-control.lsp
1 ;; == Control Interface
2 ; https://alsa-project.org/alsa-doc/alsa-lib/group___control.html
3
4 ;;***************************************************************************
5 ; Highlevel control interface
6
7 ;; Function: int snd_hctl_compare_fast
8 ;; [in] const snd_hctl_elem_t *c1
9 ;; [in] const snd_hctl_elem_t *c2)
10 ; A "don't care" fast compare functions that may be used with
11 ; snd_hctl_set_compare.
12 ;
13 ; Returns -1 if c1<c2, 0 if c1==c2, 1 if c1>c2
14
15 ;; Function: int snd_hctl_open
16 ;; [out] snd_hctl_t **hctl = Returned HCTL handle
17 ;; [in] const char *name = ASCII identifier of the underlying CTL handle
18 ;; [in] int mode = Open mode (see SND_CTL_NONBLOCK, SND_CTL_ASYNC)
19 ; Opens an HCTL. 
20
21 ;; Function: int snd_hctl_open_ctl
22 ;; [out] snd_hctl_t **hctlp = Returned HCTL handle
23 ;; [in] snd_ctl_t *ctl = underlying CTL handle
24 ; Opens an HCTL. 
25  
26 ;; Function: int snd_hctl_close
27 ;; [in] snd_hctl_t *hctl = HCTL handle
28 ; Closes the specified HCTL handle and frees all associated resources.
29  
30 ;; Function: int snd_hctl_nonblock
31 ;; [in] snd_hctl_t *hctl
32 ;; [in] int nonblock
33 ; set nonblock mode. 0 = block, 1 = nonblock.
34  
35 ;; Function: int snd_hctl_poll_descriptors_count
36 ;; [in] snd_hctl_t *hctl
37 ; Get count of poll descriptors for HCTL handle.
38
39 ;; Function: int snd_hctl_poll_descriptors
40 ;; [in] snd_hctl_t *hctl = HCTL handle
41 ;; [out] struct pollfd *pfds = array of poll descriptors
42 ;; [in] unsigned int space = space in the poll descriptor array
43 ; Get poll descriptors; fills the array and retuns count of filled
44 ; descriptors.
45  
46 ;; Function: int snd_hctl_poll_descriptors_revents
47 ;; [in] snd_hctl_t *ctl = HCTL handle
48 ;; [in] struct pollfd *pfds = array of poll descriptors
49 ;; [in] unsigned int nfds = count of poll descriptors
50 ;; [out] unsigned short *revents = returned events
51 ; Get returned events from poll descriptors. Returns 0 on success,
52 ; otherwise a negative error code
53  
54 ;; Function: unsigned int snd_hctl_get_count
55 ; [in] snd_hctl_t *hctl = HCTL handle
56 ; Get number of loaded elements for an HCTL.
57  
58 ;; Function: int snd_hctl_set_compare
59 ;; [in] snd_hctl_t *hctl = HCTL handle
60 ;; [in] snd_hctl_compare_t hsort = Element compare function
61 ; Change HCTL compare function and reorder elements. Returns 0 on
62 ; success otherwise a negative error code
63  
64 ;; Function: snd _hctl_elem_t * snd_hctl_first_elem
65 ;; [in] snd_hctl_t *hctl = HCTL handle
66 ; get first element for an HCTL.
67
68 ;; Function snd _hctl_elem_t * snd_hctl_last_elem
69 ;; [in] snd_hctl_t *hctl = HCTL handle
70 ; get last element for an HCTL.
71
72 ;; Function: snd _hctl_elem_t * snd_hctl_find_elem
73 ;; [in] snd_hctl_t *hctl = HCTL handle
74 ;; [in] const snd_ctl_elem_id_t *id = Element identifier
75 ; Find an HCTL element by id. Returns pointer to found HCTL element or
76 ; NULL if not found.
77
78 ;; Function: void snd_hctl_set_callback
79 ;; [in] snd_hctl_t *hctl
80 ;; [in] snd_hctl_callback_t callback
81 ; Set callback function for an HCTL.
82
83 ;; Function: void snd_hctl_set_callback_private
84 ;; [in] snd_hctl_t *hctl
85 ;; [in] void *data
86 ; Set callback private value for an HCTL.
87  
88 ;; Function: void * snd_hctl_get_callback_private
89 ;; [in] snd_hctl_t *hctl
90 ; Get callback private value for an HCTL.
91
92 ;; Function: int snd_hctl_load
93 ;; [int] snd_hctl_t *hctl
94 ; Load an HCTL with all elements and sort them.
95
96 ;; Function: int snd_hctl_free
97 ;; [in] snd_hctl_t *hctl
98 ; Free HCTL loaded elements
99
100 ;; Function: int snd_hctl_handle_events
101 ;; [in] snd_hctl_t *hctl
102 ; Handle pending HCTL events invoking callbacks.
103
104 ;; Function: const char * snd_hctl_name
105 ;; [in] snd_hctl_t *hctl
106 ; Get identifier of HCTL handle. Returns the ASCII identifier of given
107 ; HCTL handle. It's the same identifier specified in snd_hctl_open().
108
109 ;; Function: int snd_hctl_wait
110 ;; [in] snd_hctl_t *hctl = HCTL handle
111 ;; [in] int timeout = maximum time in milliseconds to wait
112 ; Wait for a HCTL to become ready (i.e. at least one event pending).
113 ; Returns a positive value on success otherwise a negative error code.
114 ; 0 timeout occurred; 1 an event is pending.
115
116 ;; Function: snd _ctl_t * snd_hctl_ctl
117 ;; [in] snd_hctl_t *hctl
118 ; Get a ctl handle associated to the given hctl handle.
119
120 ;; Function: snd _hctl_elem_t * snd_hctl_elem_next
121 ;; [in] snd_hctl_elem_t *elem
122 ; get next HCTL element. Returns pointer to next element.
123
124 ;; Function: snd _hctl_elem_t * snd_hctl_elem_prev
125 ;; [in] snd_hctl_elem_t *elem
126 ; Get previous HCTL element. Returns pointer to next element.
127  
128 ;; Function: int snd_hctl_elem_info
129 ;; [in] snd_hctl_elem_t *elem
130 ;; [out] snd_ctl_elem_info_t *info
131 ; Get information for an HCTL element.
132  
133 ;; Function: int snd_hctl_elem_read
134 ;; [in] snd_hctl_elem_t *elem
135 ;; [out] snd_ctl_elem_value_t *value
136 ; Get value for an HCTL element.
137
138 ;; Function: int snd_hctl_elem_write
139 ;; [in] snd_hctl_elem_t *elem
140 ;; [in] snd_ctl_elem_value_t *value
141 ; Set value for an HCTL element.
142
143 ;; Function: int snd_hctl_elem_tlv_read
144 ;; [in] snd_hctl_elem_t *elem
145 ;; [out] unsigned int *tlv = TLV array for value
146 ;; [in] unsigned int tlv_size = byte size of TLV array
147 ; Get TLV value for an HCTL element. Returns 0 otherwise a negative
148 ; error code on failure.
149
150 ;; Function: int snd_hctl_elem_tlv_write
151 ;; [in] snd_hctl_elem_t *elem
152 ;; [in] const unsigned int *tlv = TLV array for value
153 ; Set TLV value for an HCTL element. Returns 0 on success, >1 on
154 ; success when value was changed, and <0 a negative error code on
155 ; failure.
156
157  
158 ;; Function: int snd_hctl_elem_tlv_command
159 ;; [in] snd_hctl_elem_t *elem
160 ;; [in] const unsigned int *tlv = TLV array for value
161 ; Set TLV value for an HCTL element. Returns 0 on success, >1 on
162 ; success when value was changed, and <0 a negative error code on
163 ; failure.
164  
165 ;; Function: snd _hctl_t * snd_hctl_elem_get_hctl
166 ;; [in] snd_hctl_elem_t *elem
167 ; Get HCTL handle for an HCTL element.
168
169 ;; Function: void snd_hctl_elem_get_id
170 ;; [in] const snd_hctl_elem_t *obj
171 ;; [out] snd_ctl_elem_id_t *ptr = Pointer to returned CTL element identifier
172 ; Get CTL element identifier of a CTL element id/value.
173  
174 ;; Functionunsigned int snd_hctl_elem_get_numid
175 ;; [in] const snd_hctl_elem_t *obj
176 ; Get element numeric identifier of a CTL element id/value.
177
178 ;; Function: snd _ctl_elem_iface_t snd_hctl_elem_get_interface
179 ;; [in] const snd_hctl_elem_t *obj
180 ; Get interface part of CTL element identifier of a CTL element
181 ; id/value.
182
183 ;; Function: unsigned int snd_hctl_elem_get_device
184 ;; [in] const snd_hctl_elem_t *obj
185 ; Get device part of CTL element identifier of a CTL element id/value.
186
187 ;; Function: unsigned int snd_hctl_elem_get_subdevice
188 ;; [in] const snd_hctl_elem_t *obj
189 ; Get subdevice part of CTL element identifier of a CTL element
190 ; id/value.
191
192 ;; Function: const char * snd_hctl_elem_get_name
193 ;; [in] const snd_hctl_elem_t *obj
194 ; Get name part of CTL element identifier of a CTL element id/value.
195
196 ;; Function: unsigned int snd_hctl_elem_get_index
197 ;; [in] const snd_hctl_elem_t *obj
198 ; Get index part of CTL element identifier of a CTL element id/value.
199  
200 ;; Function: void snd_hctl_elem_set_callback
201 ;; [in] snd_hctl_elem_t *obj
202 ;; snd_hctl_elem_callback_t val
203 ; Set callback function for an HCTL element.
204  
205 ;; Function: void * snd_hctl_elem_get_callback_private
206 ;; [in] const snd_hctl_elem_t *obj
207 ; Get callback private value for an HCTL element.
208
209 ;; Function: void snd_hctl_elem_set_callback_private
210 ;; [in] snd_hctl_elem_t *obj
211 ;; [in]  void *val
212 ; Set callback private value for an HCTL element.
213
214 ;***************************************************************************
215 ; Setup Control Interface
216
217 ;; Function: int snd_sctl_build
218 ;; [out] snd_sctl_t **ctl = Result - setup control handle
219 ;; [in] snd_ctl_t *handle = Master control handle
220 ;; [in] snd_config_t *config = Setup configuration
221 ;; [in] snd_config_t *private_data = Private data for runtime evaluation
222 ;; [in] int mode = Build mode - SND_SCTL_xxxx
223 ; Build setup control handle.
224  
225 ;; Function: int snd_sctl_free
226 ;; [in] snd_sctl_t *handle
227 ; Free setup control handle.
228  
229 ;; Function: int snd_sctl_install
230 ;; [in] snd_sctl_t *handle
231 ; Install given values to control elements.
232  
233 ;; Function: int snd_sctl_remove
234 ;; [in] (snd_sctl_t *handle
235 ; Remove (restore) previous values from control elements.
236
237 ;***************************************************************************
238
239 (constant
240  ;;'SND_CONTROL_DLSYM_VERSION   "_dlsym_control_001"
241  ;;'SND_CTL_EVENT_MASK_REMOVE ??
242  ;;'SND_CTL_EVENT_MASK_VALUE ??
243  ;;'SND_CTL_EVENT_MASK_INFO ??
244  ;;'SND_CTL_EVENT_MASK_ADD ??
245  ;;'SND_CTL_EVENT_MASK_TLV ??
246  'SND_CTL_NAME_NONE   ""
247  'SND_CTL_NAME_PLAYBACK   "Playback "
248  'SND_CTL_NAME_CAPTURE   "Capture "
249  'SND_CTL_NAME_IEC958_NONE   ""
250  'SND_CTL_NAME_IEC958_SWITCH   "Switch"
251  'SND_CTL_NAME_IEC958_VOLUME   "Volume"
252  'SND_CTL_NAME_IEC958_DEFAULT   "Default"
253  'SND_CTL_NAME_IEC958_MASK   "Mask"
254  'SND_CTL_NAME_IEC958_CON_MASK   "Con Mask"
255  'SND_CTL_NAME_IEC958_PRO_MASK   "Pro Mask"
256  'SND_CTL_NAME_IEC958_PCM_STREAM   "PCM Stream"
257
258  ;;'SND_CTL_NAME_IEC958(expl, direction, what)   "IEC958 " expl SND_CTL_NAME_##direction SND_CTL_NAME_IEC958_##what
259  
260  'SND_CTL_POWER_MASK   0xff00
261  'SND_CTL_POWER_D0   0x0000
262  'SND_CTL_POWER_D1   0x0100
263  'SND_CTL_POWER_D2   0x0200
264  'SND_CTL_POWER_D3   0x0300
265  'SND_CTL_POWER_D3hot   (or SND_CTL_POWER_D3 0x0000)
266  'SND_CTL_POWER_D3cold (or SND_CTL_POWER_D3 0x0001)
267  'SND_CTL_TLVT_CONTAINER   0x0000
268  'SND_CTL_TLVT_DB_SCALE   0x0001
269  'SND_CTL_TLVT_DB_LINEAR   0x0002
270  'SND_CTL_TLVT_DB_RANGE   0x0003
271  'SND_CTL_TLVT_DB_MINMAX   0x0004
272  'SND_CTL_TLVT_DB_MINMAX_MUTE   0x0005
273  'SND_CTL_TLV_DB_GAIN_MUTE   -9999999
274  'SND_CTL_TLVT_CHMAP_FIXED   0x00101
275  'SND_CTL_TLVT_CHMAP_VAR   0x00102
276  'SND_CTL_TLVT_CHMAP_PAIRED   0x00103
277  ;;'SND_CTL_NONBLOCK
278  ;;'SND_CTL_ASYNC
279  ;;'SND_CTL_READONLY
280  'SND_SCTL_NOFREE   0x0001
281
282  ;;snd_ctl_elem_id_alloca(ptr)
283  ;; allocate an invalid snd_ctl_elem_id_t using standard alloca More...
284
285  ;;snd_ctl_card_info_alloca(ptr)
286  ;; Allocate an invalid snd_ctl_card_info_t on the stack. More...
287
288  ;;snd_ctl_event_alloca(ptr)
289  ;; allocate an invalid snd_ctl_event_t using standard alloca More...
290
291  ;;snd_ctl_elem_list_alloca(ptr)
292  ;; Allocate a snd_ctl_elem_list_t using standard alloca. More...
293
294  ;;snd_ctl_elem_info_alloca(ptr)
295  ;;allocate an invalid snd_ctl_elem_info_t using standard alloca More...
296
297  ;;snd_ctl_elem_value_alloca(ptr)
298  ;;Allocate an invalid snd_ctl_elem_value_t on the stack. More...
299  )
300
301 ;***************************************************************************
302 ;;========== CARD Functions
303 (import LIB "snd_card_next" "int" "void*")
304
305 (import LIB "snd_card_get_longname" "int" "int" "void*")
306 (import LIB "snd_card_get_name" "int" "int" "void*")
307 (import LIB "snd_ctl_open" "int" "void*" "char*" "int")
308 (import LIB "snd_ctl_close" "int" "void*")
309
310 ;; snd_ctl_card_info_t functions
311 (import LIB "snd_ctl_card_info_malloc" "int" "void*")
312 (import LIB "snd_ctl_card_info_free" "int" "void*")
313 (import LIB "snd_ctl_card_info" "int" "void*" "void*")
314 (import LIB "snd_ctl_card_info_get_card" "int" "void*")
315 (import LIB "snd_ctl_card_info_get_name" "char*" "void*")
316 (import LIB "snd_ctl_card_info_get_id" "char*" "void*")
317 (import LIB "snd_ctl_card_info_get_longname" "char*" "void*")
318 (import LIB "snd_ctl_card_info_get_components" "char*" "void*")
319 (import LIB "snd_ctl_card_info_get_driver" "char*" "void*")
320 (import LIB "snd_ctl_card_info_get_mixername" "char*" "void*")
321
322 ;; snd_ctl_elem_list_t functions
323 (import LIB "snd_ctl_elem_info_free" "void" "void*")
324 (import LIB "snd_ctl_elem_info_malloc" "int" "void*")
325 (import LIB "snd_ctl_elem_list" "int" "void*" "void*")
326 (import LIB "snd_ctl_elem_list_alloc_space" "int" "void*" "int")
327 (import LIB "snd_ctl_elem_list_free" "int" "void*")
328 (import LIB "snd_ctl_elem_list_free_space" "int" "void*")
329 (import LIB "snd_ctl_elem_list_get_count" "unsigned int" "void*")
330 (import LIB "snd_ctl_elem_list_get_device" "unsigned int" "void*" "int")
331 (import LIB "snd_ctl_elem_list_get_id" "void" "void*" "int" "void*")
332 (import LIB "snd_ctl_elem_list_get_index" "unsigned int" "void*" "int")
333 (import LIB "snd_ctl_elem_list_get_interface" "int" "void*""int")
334 (import LIB "snd_ctl_elem_list_get_name" "char*" "void*""int")
335 (import LIB "snd_ctl_elem_list_get_numid" "unsigned int" "void*" "int")
336 (import LIB "snd_ctl_elem_list_get_subdevice" "unsigned int" "void*" "int")
337 (import LIB "snd_ctl_elem_list_get_used" "unsigned int" "void*")
338 (import LIB "snd_ctl_elem_list_malloc" "int" "void*")
339
340 ;; snd_ctl_elem_info_t functions
341 (import LIB "snd_ctl_elem_info" "int" "void*" "void*")
342 (import LIB "snd_ctl_elem_info_malloc" "int" "void*")
343 (import LIB "snd_ctl_elem_info_free" "void" "void*")
344 (import LIB "snd_ctl_elem_info_get_type" "int" "void*")