1 module deimos.alsa.pcm;
2 
3 import core.stdc.config;
4 import core.sys.posix.poll;
5 
6 import deimos.alsa.conf : snd_config_t;
7 import deimos.alsa.global;
8 import deimos.alsa.output;
9 
10 extern(C):
11 
12 //#define SND_PCM_DLSYM_VERSION		_dlsym_pcm_001
13 
14 struct snd_pcm_info_t;
15 struct snd_pcm_hw_params_t;
16 struct snd_pcm_sw_params_t;
17 struct snd_pcm_status_t;
18 struct snd_pcm_access_mask_t;
19 struct snd_pcm_format_mask_t;
20 struct snd_pcm_subformat_mask_t;
21 
22 enum snd_pcm_class_t
23 {
24 	GENERIC = 0,
25 	MULTI,
26 	MODEM,
27 	DIGITIZER,
28 	LAST = DIGITIZER
29 }
30 
31 enum snd_pcm_subclass_t
32 {
33 	GENERIC_MIX = 0,
34 	MULTI_MIX,
35 	LAST = MULTI_MIX
36 }
37 
38 enum snd_pcm_stream_t {
39 	PLAYBACK = 0,
40 	CAPTURE,
41 	LAST = CAPTURE
42 }
43 
44 enum snd_pcm_access_t
45 {
46 	MMAP_INTERLEAVED = 0,
47 	MMAP_NONINTERLEAVED,
48 	MMAP_COMPLEX,
49 	RW_INTERLEAVED,
50 	RW_NONINTERLEAVED,
51 	LAST = RW_NONINTERLEAVED
52 }
53 
54 version(LittleEndian)
55 {
56 	enum snd_pcm_format_t
57 	{
58 		UNKNOWN = -1,
59 		S8 = 0,
60 		U8,
61 		S16_LE,
62 		S16_BE,
63 		U16_LE,
64 		U16_BE,
65 		S24_LE,
66 		S24_BE,
67 		U24_LE,
68 		U24_BE,
69 		S32_LE,
70 		S32_BE,
71 		U32_LE,
72 		U32_BE,
73 		FLOAT_LE,
74 		FLOAT_BE,
75 		FLOAT64_LE,
76 		FLOAT64_BE,
77 		IEC958_SUBFRAME_LE,
78 		IEC958_SUBFRAME_BE,
79 		MU_LAW,
80 		A_LAW,
81 		IMA_ADPCM,
82 		MPEG,
83 		GSM,
84 		SPECIAL = 31,
85 		S24_3LE = 32,
86 		S24_3BE,
87 		U24_3LE,
88 		U24_3BE,
89 		S20_3LE,
90 		S20_3BE,
91 		U20_3LE,
92 		U20_3BE,
93 		S18_3LE,
94 		S18_3BE,
95 		U18_3LE,
96 		U18_3BE,
97 		G723_24,
98 		G723_24_1B,
99 		G723_40,
100 		G723_40_1B,
101 		DSD_U8,
102 		DSD_U16_LE,
103 		LAST = DSD_U16_LE,
104 
105 		S16 = S16_LE,
106 		U16 = U16_LE,
107 		S24 = S24_LE,
108 		U24 = U24_LE,
109 		S32 = S32_LE,
110 		U32 = U32_LE,
111 		FLOAT = FLOAT_LE,
112 		FLOAT64 = FLOAT64_LE,
113 		IEC958_SUBFRAME = IEC958_SUBFRAME_LE
114 	}
115 }
116 else version(BigEndian)
117 {
118 	enum snd_pcm_format_t
119 	{
120 		UNKNOWN = -1,
121 		S8 = 0,
122 		U8,
123 		S16_LE,
124 		S16_BE,
125 		U16_LE,
126 		U16_BE,
127 		S24_LE,
128 		S24_BE,
129 		U24_LE,
130 		U24_BE,
131 		S32_LE,
132 		S32_BE,
133 		U32_LE,
134 		U32_BE,
135 		FLOAT_LE,
136 		FLOAT_BE,
137 		FLOAT64_LE,
138 		FLOAT64_BE,
139 		IEC958_SUBFRAME_LE,
140 		IEC958_SUBFRAME_BE,
141 		MU_LAW,
142 		A_LAW,
143 		IMA_ADPCM,
144 		MPEG,
145 		GSM,
146 		SPECIAL = 31,
147 		S24_3LE = 32,
148 		S24_3BE,
149 		U24_3LE,
150 		U24_3BE,
151 		S20_3LE,
152 		S20_3BE,
153 		U20_3LE,
154 		U20_3BE,
155 		S18_3LE,
156 		S18_3BE,
157 		U18_3LE,
158 		U18_3BE,
159 		G723_24,
160 		G723_24_1B,
161 		G723_40,
162 		G723_40_1B,
163 		DSD_U8,
164 		DSD_U16_LE,
165 		LAST = DSD_U16_LE,
166 
167 		S16 = S16_BE,
168 		U16 = U16_BE,
169 		S24 = S24_BE,
170 		U24 = U24_BE,
171 		S32 = S32_BE,
172 		U32 = U32_BE,
173 		FLOAT = FLOAT_BE,
174 		FLOAT64 = FLOAT64_BE,
175 		IEC958_SUBFRAME = IEC958_SUBFRAME_BE
176 	}
177 }
178 else
179 {
180 	static assert(0, "Unknown endian");
181 }
182 
183 
184 enum snd_pcm_subformat_t
185 {
186 	STD = 0,
187 	LAST = STD
188 }
189 
190 enum snd_pcm_state_t
191 {
192 	OPEN = 0,
193 	SETUP,
194 	PREPARED,
195 	RUNNING,
196 	XRUN,
197 	DRAINING,
198 	PAUSED,
199 	SUSPENDED,
200 	DISCONNECTED,
201 	LAST = DISCONNECTED
202 }
203 
204 enum snd_pcm_start_t
205 {
206 	DATA = 0,
207 	EXPLICIT,
208 	LAST = EXPLICIT
209 }
210 
211 enum snd_pcm_xrun_t
212 {
213 	NONE = 0,
214 	STOP,
215 	LAST = STOP
216 }
217 
218 enum snd_pcm_tstamp_t {
219 	NONE = 0,
220 	ENABLE,
221 	MMAP = ENABLE,
222 	LAST = ENABLE
223 }
224 
225 alias snd_pcm_uframes_t = c_ulong;
226 alias snd_pcm_sframes_t = c_long;
227 
228 enum SND_PCM_NONBLOCK         = 0x00000001;
229 enum SND_PCM_ASYNC            = 0x00000002;
230 enum SND_PCM_ABORT            = 0x00008000;
231 enum SND_PCM_NO_AUTO_RESAMPLE = 0x00010000;
232 enum SND_PCM_NO_AUTO_CHANNELS = 0x00020000;
233 enum SND_PCM_NO_AUTO_FORMAT   = 0x00040000;
234 enum SND_PCM_NO_SOFTVOL       = 0x00080000;
235 
236 struct snd_pcm_t;
237 
238 enum snd_pcm_type_t {
239 	HW = 0,
240 	HOOKS,
241 	MULTI,
242 	FILE,
243 	NULL,
244 	SHM,
245 	INET,
246 	COPY,
247 	LINEAR,
248 	ALAW,
249 	MULAW,
250 	ADPCM,
251 	RATE,
252 	ROUTE,
253 	PLUG,
254 	SHARE,
255 	METER,
256 	MIX,
257 	DROUTE,
258 	LBSERVER,
259 	LINEAR_FLOAT,
260 	LADSPA,
261 	DMIX,
262 	JACK,
263 	DSNOOP,
264 	DSHARE,
265 	IEC958,
266 	SOFTVOL,
267 	IOPLUG,
268 	EXTPLUG,
269 	MMAP_EMUL,
270 	LAST = MMAP_EMUL
271 };
272 
273 struct snd_pcm_channel_area_t
274 {
275 	void* addr;
276 	uint first;
277 	uint step;
278 }
279 
280 union snd_pcm_sync_id_t
281 {
282 	ubyte[16] id;
283 	ushort[8] id16;
284 	uint[4]   id32;
285 }
286 
287 struct snd_pcm_scope_t;
288 
289 
290 int snd_pcm_open(snd_pcm_t** pcm, const(char)* name, snd_pcm_stream_t stream, int mode);
291 int snd_pcm_open_lconf(snd_pcm_t** pcm, const(char)* name, snd_pcm_stream_t stream, int mode, snd_config_t* lconf);
292 int snd_pcm_open_fallback(snd_pcm_t** pcm, snd_config_t* root, const(char)* name, const(char)* orig_name, snd_pcm_stream_t stream, int mode);
293 
294 int snd_pcm_close(snd_pcm_t* pcm);
295 const(char)* snd_pcm_name(snd_pcm_t* pcm);
296 snd_pcm_type_t snd_pcm_type(snd_pcm_t* pcm);
297 snd_pcm_stream_t snd_pcm_stream(snd_pcm_t* pcm);
298 int snd_pcm_poll_descriptors_count(snd_pcm_t* pcm);
299 int snd_pcm_poll_descriptors(snd_pcm_t* pcm, pollfd* pfds, uint space);
300 int snd_pcm_poll_descriptors_revents(snd_pcm_t* pcm, pollfd* pfds, uint nfds, ushort* revents);
301 int snd_pcm_nonblock(snd_pcm_t* pcm, int nonblock);
302 int snd_pcm_abort(snd_pcm_t* pcm) { return snd_pcm_nonblock(pcm, 2); }
303 int snd_async_add_pcm_handler(snd_async_handler_t** handler, snd_pcm_t* pcm, snd_async_callback_t callback, void* private_data);
304 snd_pcm_t* snd_async_handler_get_pcm(snd_async_handler_t* handler);
305 int snd_pcm_info(snd_pcm_t* pcm, snd_pcm_info_t* info);
306 int snd_pcm_hw_params_current(snd_pcm_t* pcm, snd_pcm_hw_params_t* params);
307 int snd_pcm_hw_params(snd_pcm_t* pcm, snd_pcm_hw_params_t* params);
308 int snd_pcm_hw_free(snd_pcm_t* pcm);
309 int snd_pcm_sw_params_current(snd_pcm_t* pcm, snd_pcm_sw_params_t* params);
310 int snd_pcm_sw_params(snd_pcm_t* pcm, snd_pcm_sw_params_t* params);
311 int snd_pcm_prepare(snd_pcm_t* pcm);
312 int snd_pcm_reset(snd_pcm_t* pcm);
313 int snd_pcm_status(snd_pcm_t* pcm, snd_pcm_status_t* status);
314 int snd_pcm_start(snd_pcm_t* pcm);
315 int snd_pcm_drop(snd_pcm_t* pcm);
316 int snd_pcm_drain(snd_pcm_t* pcm);
317 int snd_pcm_pause(snd_pcm_t* pcm, int enable);
318 snd_pcm_state_t snd_pcm_state(snd_pcm_t* pcm);
319 int snd_pcm_hwsync(snd_pcm_t* pcm);
320 int snd_pcm_delay(snd_pcm_t* pcm, snd_pcm_sframes_t* delayp);
321 int snd_pcm_resume(snd_pcm_t* pcm);
322 int snd_pcm_htimestamp(snd_pcm_t* pcm, snd_pcm_uframes_t* avail, snd_htimestamp_t* tstamp);
323 snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t* pcm);
324 snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t* pcm);
325 int snd_pcm_avail_delay(snd_pcm_t* pcm, snd_pcm_sframes_t* availp, snd_pcm_sframes_t* delayp);
326 snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t* pcm);
327 snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t* pcm, snd_pcm_uframes_t frames);
328 snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t* pcm);
329 snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t* pcm, snd_pcm_uframes_t frames);
330 snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t* pcm, const(void)* buffer, snd_pcm_uframes_t size);
331 snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t* pcm, void* buffer, snd_pcm_uframes_t size);
332 snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t* pcm, void** bufs, snd_pcm_uframes_t size);
333 snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t* pcm, void** bufs, snd_pcm_uframes_t size);
334 int snd_pcm_wait(snd_pcm_t* pcm, int timeout);
335 
336 int snd_pcm_link(snd_pcm_t* pcm1, snd_pcm_t* pcm2);
337 int snd_pcm_unlink(snd_pcm_t* pcm);
338 
339 enum SND_CHMAP_API_VERSION = ((1 << 16) | (0 << 8) | 1);
340 
341 enum snd_pcm_chmap_type
342 {
343 	NONE = 0,
344 	FIXED,
345 	VAR,
346 	PAIRED,
347 	LAST = PAIRED,
348 };
349 
350 enum snd_pcm_chmap_position
351 {
352 	UNKNOWN = 0,
353 	NA,
354 	MONO,
355 	FL,
356 	FR,
357 	RL,
358 	RR,
359 	FC,
360 	LFE,
361 	SL,
362 	SR,
363 	RC,
364 	FLC,
365 	FRC,
366 	RLC,
367 	RRC,
368 	FLW,
369 	FRW,
370 	FLH,
371 	FCH,
372 	FRH,
373 	TC,
374 	TFL,
375 	TFR,
376 	TFC,
377 	TRL,
378 	TRR,
379 	TRC,
380 	TFLC,
381 	TFRC,
382 	TSL,
383 	TSR,
384 	LLFE,
385 	RLFE,
386 	BC,
387 	BLC,
388 	BRC,
389 	LAST = BRC,
390 }
391 
392 enum SND_CHMAP_POSITION_MASK = 0xffff;
393 enum SND_CHMAP_PHASE_INVERSE = (0x01 << 16);
394 enum SND_CHMAP_DRIVER_SPEC   = (0x02 << 16);
395 
396 struct snd_pcm_chmap_t
397 {
398 	uint channels;
399 	uint[0] pos;
400 }
401 
402 struct snd_pcm_chmap_query_t
403 {
404 	snd_pcm_chmap_type type;
405 	snd_pcm_chmap_t map;
406 }
407 
408 snd_pcm_chmap_query_t** snd_pcm_query_chmaps(snd_pcm_t* pcm);
409 snd_pcm_chmap_query_t** snd_pcm_query_chmaps_from_hw(int card, int dev, int subdev, snd_pcm_stream_t stream);
410 void snd_pcm_free_chmaps(snd_pcm_chmap_query_t** maps);
411 snd_pcm_chmap_t* snd_pcm_get_chmap(snd_pcm_t* pcm);
412 int snd_pcm_set_chmap(snd_pcm_t* pcm, const(snd_pcm_chmap_t)* map);
413 
414 const(char)* snd_pcm_chmap_type_name(snd_pcm_chmap_type val);
415 const(char)* snd_pcm_chmap_name(snd_pcm_chmap_position val);
416 const(char)* snd_pcm_chmap_long_name(snd_pcm_chmap_position val);
417 int snd_pcm_chmap_print(const(snd_pcm_chmap_t)* map, size_t maxlen, char* buf);
418 uint snd_pcm_chmap_from_string(const(char)* str);
419 snd_pcm_chmap_t* snd_pcm_chmap_parse_string(const(char)* str);
420 
421 int snd_pcm_recover(snd_pcm_t* pcm, int err, int silent);
422 int snd_pcm_set_params(snd_pcm_t* pcm,
423                        snd_pcm_format_t format,
424                        snd_pcm_access_t access,
425                        uint channels,
426                        uint rate,
427                        int soft_resample,
428                        uint latency);
429 int snd_pcm_get_params(snd_pcm_t* pcm,
430                        snd_pcm_uframes_t* buffer_size,
431                        snd_pcm_uframes_t* period_size);
432 
433 
434 size_t snd_pcm_info_sizeof();
435 
436 int snd_pcm_info_malloc(snd_pcm_info_t** ptr);
437 void snd_pcm_info_free(snd_pcm_info_t* obj);
438 void snd_pcm_info_copy(snd_pcm_info_t* dst, const(snd_pcm_info_t)* src);
439 uint snd_pcm_info_get_device(const snd_pcm_info_t* obj);
440 uint snd_pcm_info_get_subdevice(const snd_pcm_info_t* obj);
441 snd_pcm_stream_t snd_pcm_info_get_stream(const(snd_pcm_info_t)* obj);
442 int snd_pcm_info_get_card(const(snd_pcm_info_t)* obj);
443 const(char)* snd_pcm_info_get_id(const(snd_pcm_info_t)* obj);
444 const(char)* snd_pcm_info_get_name(const(snd_pcm_info_t)* obj);
445 const(char)* snd_pcm_info_get_subdevice_name(const(snd_pcm_info_t)* obj);
446 snd_pcm_class_t snd_pcm_info_get_class(const(snd_pcm_info_t)* obj);
447 snd_pcm_subclass_t snd_pcm_info_get_subclass(const(snd_pcm_info_t)* obj);
448 uint snd_pcm_info_get_subdevices_count(const(snd_pcm_info_t)* obj);
449 uint snd_pcm_info_get_subdevices_avail(const(snd_pcm_info_t)* obj);
450 snd_pcm_sync_id_t snd_pcm_info_get_sync(const(snd_pcm_info_t)* obj);
451 void snd_pcm_info_set_device(snd_pcm_info_t* obj, uint val);
452 void snd_pcm_info_set_subdevice(snd_pcm_info_t* obj, uint val);
453 void snd_pcm_info_set_stream(snd_pcm_info_t* obj, snd_pcm_stream_t val);
454 
455 int snd_pcm_hw_params_any(snd_pcm_t* pcm, snd_pcm_hw_params_t* params);
456 
457 int snd_pcm_hw_params_can_mmap_sample_resolution(const(snd_pcm_hw_params_t)* params);
458 int snd_pcm_hw_params_is_double(const(snd_pcm_hw_params_t)* params);
459 int snd_pcm_hw_params_is_batch(const(snd_pcm_hw_params_t)* params);
460 int snd_pcm_hw_params_is_block_transfer(const(snd_pcm_hw_params_t)* params);
461 int snd_pcm_hw_params_is_monotonic(const(snd_pcm_hw_params_t)* params);
462 int snd_pcm_hw_params_can_overrange(const(snd_pcm_hw_params_t)* params);
463 int snd_pcm_hw_params_can_pause(const(snd_pcm_hw_params_t)* params);
464 int snd_pcm_hw_params_can_resume(const(snd_pcm_hw_params_t)* params);
465 int snd_pcm_hw_params_is_half_duplex(const(snd_pcm_hw_params_t)* params);
466 int snd_pcm_hw_params_is_joint_duplex(const(snd_pcm_hw_params_t)* params);
467 int snd_pcm_hw_params_can_sync_start(const(snd_pcm_hw_params_t)* params);
468 int snd_pcm_hw_params_can_disable_period_wakeup(const(snd_pcm_hw_params_t)* params);
469 int snd_pcm_hw_params_supports_audio_wallclock_ts(const(snd_pcm_hw_params_t)* params);
470 int snd_pcm_hw_params_get_rate_numden(const(snd_pcm_hw_params_t)* params,
471 				      uint* rate_num,
472 				      uint* rate_den);
473 int snd_pcm_hw_params_get_sbits(const(snd_pcm_hw_params_t)* params);
474 int snd_pcm_hw_params_get_fifo_size(const(snd_pcm_hw_params_t)* params);
475 
476 size_t snd_pcm_hw_params_sizeof();
477 int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t** ptr);
478 void snd_pcm_hw_params_free(snd_pcm_hw_params_t* obj);
479 void snd_pcm_hw_params_copy(snd_pcm_hw_params_t* dst, const(snd_pcm_hw_params_t)* src);
480 
481 int snd_pcm_hw_params_get_access(const(snd_pcm_hw_params_t)* params, snd_pcm_access_t* _access);
482 int snd_pcm_hw_params_test_access(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_access_t _access);
483 int snd_pcm_hw_params_set_access(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_access_t _access);
484 int snd_pcm_hw_params_set_access_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_access_t* _access);
485 int snd_pcm_hw_params_set_access_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_access_t* _access);
486 int snd_pcm_hw_params_set_access_mask(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_access_mask_t* mask);
487 int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t* params, snd_pcm_access_mask_t* mask);
488 
489 int snd_pcm_hw_params_get_format(const(snd_pcm_hw_params_t)* params, snd_pcm_format_t* val);
490 int snd_pcm_hw_params_test_format(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_format_t val);
491 int snd_pcm_hw_params_set_format(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_format_t val);
492 int snd_pcm_hw_params_set_format_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_format_t* format);
493 int snd_pcm_hw_params_set_format_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_format_t* format);
494 int snd_pcm_hw_params_set_format_mask(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_format_mask_t* mask);
495 void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t* params, snd_pcm_format_mask_t* mask);
496 
497 int snd_pcm_hw_params_get_subformat(const(snd_pcm_hw_params_t)* params, snd_pcm_subformat_t* subformat);
498 int snd_pcm_hw_params_test_subformat(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_subformat_t subformat);
499 int snd_pcm_hw_params_set_subformat(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_subformat_t subformat);
500 int snd_pcm_hw_params_set_subformat_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_subformat_t* subformat);
501 int snd_pcm_hw_params_set_subformat_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_subformat_t* subformat);
502 int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_subformat_mask_t* mask);
503 void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t* params, snd_pcm_subformat_mask_t* mask);
504 
505 int snd_pcm_hw_params_get_channels(const(snd_pcm_hw_params_t)* params, uint* val);
506 int snd_pcm_hw_params_get_channels_min(const(snd_pcm_hw_params_t)* params, uint* val);
507 int snd_pcm_hw_params_get_channels_max(const(snd_pcm_hw_params_t)* params, uint* val);
508 int snd_pcm_hw_params_test_channels(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val);
509 int snd_pcm_hw_params_set_channels(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val);
510 int snd_pcm_hw_params_set_channels_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
511 int snd_pcm_hw_params_set_channels_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
512 int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* min, uint* max);
513 int snd_pcm_hw_params_set_channels_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
514 int snd_pcm_hw_params_set_channels_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
515 int snd_pcm_hw_params_set_channels_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
516 
517 int snd_pcm_hw_params_get_rate(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
518 int snd_pcm_hw_params_get_rate_min(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
519 int snd_pcm_hw_params_get_rate_max(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
520 int snd_pcm_hw_params_test_rate(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
521 int snd_pcm_hw_params_set_rate(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
522 int snd_pcm_hw_params_set_rate_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
523 int snd_pcm_hw_params_set_rate_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
524 int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* min, int* mindir, uint* max, int* maxdir);
525 int snd_pcm_hw_params_set_rate_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
526 int snd_pcm_hw_params_set_rate_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
527 int snd_pcm_hw_params_set_rate_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
528 int snd_pcm_hw_params_set_rate_resample(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val);
529 int snd_pcm_hw_params_get_rate_resample(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
530 int snd_pcm_hw_params_set_export_buffer(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val);
531 int snd_pcm_hw_params_get_export_buffer(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
532 int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val);
533 int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val);
534 
535 int snd_pcm_hw_params_get_period_time(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
536 int snd_pcm_hw_params_get_period_time_min(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
537 int snd_pcm_hw_params_get_period_time_max(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
538 int snd_pcm_hw_params_test_period_time(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
539 int snd_pcm_hw_params_set_period_time(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
540 int snd_pcm_hw_params_set_period_time_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
541 int snd_pcm_hw_params_set_period_time_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
542 int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* min, int* mindir, uint* max, int* maxdir);
543 int snd_pcm_hw_params_set_period_time_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
544 int snd_pcm_hw_params_set_period_time_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
545 int snd_pcm_hw_params_set_period_time_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
546 
547 int snd_pcm_hw_params_get_period_size(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* frames, int* dir);
548 int snd_pcm_hw_params_get_period_size_min(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* frames, int* dir);
549 int snd_pcm_hw_params_get_period_size_max(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* frames, int* dir);
550 int snd_pcm_hw_params_test_period_size(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t val, int dir);
551 int snd_pcm_hw_params_set_period_size(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t val, int dir);
552 int snd_pcm_hw_params_set_period_size_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val, int* dir);
553 int snd_pcm_hw_params_set_period_size_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val, int* dir);
554 int snd_pcm_hw_params_set_period_size_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* min, int* mindir, snd_pcm_uframes_t* max, int* maxdir);
555 int snd_pcm_hw_params_set_period_size_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val, int* dir);
556 int snd_pcm_hw_params_set_period_size_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val, int* dir);
557 int snd_pcm_hw_params_set_period_size_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val, int* dir);
558 int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t* pcm, snd_pcm_hw_params_t* params);
559 
560 int snd_pcm_hw_params_get_periods(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
561 int snd_pcm_hw_params_get_periods_min(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
562 int snd_pcm_hw_params_get_periods_max(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
563 int snd_pcm_hw_params_test_periods(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
564 int snd_pcm_hw_params_set_periods(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
565 int snd_pcm_hw_params_set_periods_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
566 int snd_pcm_hw_params_set_periods_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
567 int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* min, int* mindir, uint* max, int* maxdir);
568 int snd_pcm_hw_params_set_periods_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
569 int snd_pcm_hw_params_set_periods_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
570 int snd_pcm_hw_params_set_periods_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
571 int snd_pcm_hw_params_set_periods_integer(snd_pcm_t* pcm, snd_pcm_hw_params_t* params);
572 
573 int snd_pcm_hw_params_get_buffer_time(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
574 int snd_pcm_hw_params_get_buffer_time_min(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
575 int snd_pcm_hw_params_get_buffer_time_max(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
576 int snd_pcm_hw_params_test_buffer_time(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
577 int snd_pcm_hw_params_set_buffer_time(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
578 int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
579 int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
580 int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* min, int* mindir, uint* max, int* maxdir);
581 int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
582 int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
583 int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
584 
585 int snd_pcm_hw_params_get_buffer_size(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* val);
586 int snd_pcm_hw_params_get_buffer_size_min(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* val);
587 int snd_pcm_hw_params_get_buffer_size_max(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* val);
588 int snd_pcm_hw_params_test_buffer_size(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t val);
589 int snd_pcm_hw_params_set_buffer_size(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t val);
590 int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val);
591 int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val);
592 int snd_pcm_hw_params_set_buffer_size_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* min, snd_pcm_uframes_t* max);
593 int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val);
594 int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val);
595 int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, snd_pcm_uframes_t* val);
596 
597 int snd_pcm_hw_params_get_min_align(const(snd_pcm_hw_params_t)* params, snd_pcm_uframes_t* val);
598 
599 size_t snd_pcm_sw_params_sizeof();
600 
601 int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t** ptr);
602 void snd_pcm_sw_params_free(snd_pcm_sw_params_t* obj);
603 void snd_pcm_sw_params_copy(snd_pcm_sw_params_t* dst, const(snd_pcm_sw_params_t)* src);
604 int snd_pcm_sw_params_get_boundary(const(snd_pcm_sw_params_t)* params, snd_pcm_uframes_t* val);
605 
606 int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_tstamp_t val);
607 int snd_pcm_sw_params_get_tstamp_mode(const(snd_pcm_sw_params_t)* params, snd_pcm_tstamp_t* val);
608 int snd_pcm_sw_params_set_avail_min(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_uframes_t val);
609 int snd_pcm_sw_params_get_avail_min(const(snd_pcm_sw_params_t)* params, snd_pcm_uframes_t* val);
610 int snd_pcm_sw_params_set_period_event(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, int val);
611 int snd_pcm_sw_params_get_period_event(const(snd_pcm_sw_params_t)* params, int* val);
612 int snd_pcm_sw_params_set_start_threshold(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_uframes_t val);
613 int snd_pcm_sw_params_get_start_threshold(const(snd_pcm_sw_params_t)* paramsm, snd_pcm_uframes_t* val);
614 int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_uframes_t val);
615 int snd_pcm_sw_params_get_stop_threshold(const(snd_pcm_sw_params_t)* params, snd_pcm_uframes_t* val);
616 int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_uframes_t val);
617 int snd_pcm_sw_params_get_silence_threshold(const(snd_pcm_sw_params_t)* params, snd_pcm_uframes_t* val);
618 int snd_pcm_sw_params_set_silence_size(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_uframes_t val);
619 int snd_pcm_sw_params_get_silence_size(const(snd_pcm_sw_params_t)* params, snd_pcm_uframes_t* val);
620 
621 
622 size_t snd_pcm_access_mask_sizeof();
623 
624 int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t** ptr);
625 void snd_pcm_access_mask_free(snd_pcm_access_mask_t* obj);
626 void snd_pcm_access_mask_copy(snd_pcm_access_mask_t* dst, const(snd_pcm_access_mask_t)* src);
627 void snd_pcm_access_mask_none(snd_pcm_access_mask_t* mask);
628 void snd_pcm_access_mask_any(snd_pcm_access_mask_t* mask);
629 int snd_pcm_access_mask_test(const(snd_pcm_access_mask_t)* mask, snd_pcm_access_t val);
630 int snd_pcm_access_mask_empty(const(snd_pcm_access_mask_t)* mask);
631 void snd_pcm_access_mask_set(snd_pcm_access_mask_t* mask, snd_pcm_access_t val);
632 void snd_pcm_access_mask_reset(snd_pcm_access_mask_t* mask, snd_pcm_access_t val);
633 
634 size_t snd_pcm_format_mask_sizeof();
635 
636 int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t** ptr);
637 void snd_pcm_format_mask_free(snd_pcm_format_mask_t* obj);
638 void snd_pcm_format_mask_copy(snd_pcm_format_mask_t* dst, const(snd_pcm_format_mask_t)* src);
639 void snd_pcm_format_mask_none(snd_pcm_format_mask_t* mask);
640 void snd_pcm_format_mask_any(snd_pcm_format_mask_t* mask);
641 int snd_pcm_format_mask_test(const(snd_pcm_format_mask_t)* mask, snd_pcm_format_t val);
642 int snd_pcm_format_mask_empty(const(snd_pcm_format_mask_t)* mask);
643 void snd_pcm_format_mask_set(snd_pcm_format_mask_t* mask, snd_pcm_format_t val);
644 void snd_pcm_format_mask_reset(snd_pcm_format_mask_t* mask, snd_pcm_format_t val);
645 
646 size_t snd_pcm_subformat_mask_sizeof();
647 
648 int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t** ptr);
649 void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t* obj);
650 void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t* dst, const(snd_pcm_subformat_mask_t)* src);
651 void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t* mask);
652 void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t* mask);
653 int snd_pcm_subformat_mask_test(const(snd_pcm_subformat_mask_t)* mask, snd_pcm_subformat_t val);
654 int snd_pcm_subformat_mask_empty(const(snd_pcm_subformat_mask_t)* mask);
655 void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t* mask, snd_pcm_subformat_t val);
656 void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t* mask, snd_pcm_subformat_t val);
657 
658 size_t snd_pcm_status_sizeof();
659 
660 int snd_pcm_status_malloc(snd_pcm_status_t** ptr);
661 void snd_pcm_status_free(snd_pcm_status_t* obj);
662 void snd_pcm_status_copy(snd_pcm_status_t* dst, const(snd_pcm_status_t)* src);
663 snd_pcm_state_t snd_pcm_status_get_state(const(snd_pcm_status_t)* obj);
664 void snd_pcm_status_get_trigger_tstamp(const(snd_pcm_status_t)* obj, snd_timestamp_t* ptr);
665 void snd_pcm_status_get_trigger_htstamp(const(snd_pcm_status_t)* obj, snd_htimestamp_t* ptr);
666 void snd_pcm_status_get_tstamp(const(snd_pcm_status_t)* obj, snd_timestamp_t* ptr);
667 void snd_pcm_status_get_htstamp(const(snd_pcm_status_t)* obj, snd_htimestamp_t* ptr);
668 void snd_pcm_status_get_audio_htstamp(const(snd_pcm_status_t)* obj, snd_htimestamp_t* ptr);
669 snd_pcm_sframes_t snd_pcm_status_get_delay(const(snd_pcm_status_t)* obj);
670 snd_pcm_uframes_t snd_pcm_status_get_avail(const(snd_pcm_status_t)* obj);
671 snd_pcm_uframes_t snd_pcm_status_get_avail_max(const(snd_pcm_status_t)* obj);
672 snd_pcm_uframes_t snd_pcm_status_get_overrange(const(snd_pcm_status_t)* obj);
673 
674 const(char)* snd_pcm_type_name(snd_pcm_type_t type);
675 const(char)* snd_pcm_stream_name(const(snd_pcm_stream_t) stream);
676 const(char)* snd_pcm_access_name(const(snd_pcm_access_t) _access);
677 const(char)* snd_pcm_format_name(const(snd_pcm_format_t) format);
678 const(char)* snd_pcm_format_description(const(snd_pcm_format_t) format);
679 const(char)* snd_pcm_subformat_name(const(snd_pcm_subformat_t) subformat);
680 const(char)* snd_pcm_subformat_description(const(snd_pcm_subformat_t) subformat);
681 snd_pcm_format_t snd_pcm_format_value(const(char)* name);
682 const(char)* snd_pcm_tstamp_mode_name(const(snd_pcm_tstamp_t) mode);
683 const(char)* snd_pcm_state_name(const(snd_pcm_state_t) state);
684 
685 int snd_pcm_dump(snd_pcm_t* pcm, snd_output_t* out_);
686 int snd_pcm_dump_hw_setup(snd_pcm_t* pcm, snd_output_t* out_);
687 int snd_pcm_dump_sw_setup(snd_pcm_t* pcm, snd_output_t* out_);
688 int snd_pcm_dump_setup(snd_pcm_t* pcm, snd_output_t* out_);
689 int snd_pcm_hw_params_dump(snd_pcm_hw_params_t* params, snd_output_t* out_);
690 int snd_pcm_sw_params_dump(snd_pcm_sw_params_t* params, snd_output_t* out_);
691 int snd_pcm_status_dump(snd_pcm_status_t* status, snd_output_t* out_);
692 
693 int snd_pcm_mmap_begin(snd_pcm_t* pcm,
694 		       const(snd_pcm_channel_area_t)** areas,
695 		       snd_pcm_uframes_t* offset,
696 		       snd_pcm_uframes_t* frames);
697 snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t* pcm,
698 				      snd_pcm_uframes_t offset,
699 				      snd_pcm_uframes_t frames);
700 snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t* pcm, const(void)* buffer, snd_pcm_uframes_t size);
701 snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t* pcm, void* buffer, snd_pcm_uframes_t size);
702 snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t* pcm, void** bufs, snd_pcm_uframes_t size);
703 snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t* pcm, void** bufs, snd_pcm_uframes_t size);
704 
705 int snd_pcm_format_signed(snd_pcm_format_t format);
706 int snd_pcm_format_unsigned(snd_pcm_format_t format);
707 int snd_pcm_format_linear(snd_pcm_format_t format);
708 int snd_pcm_format_float(snd_pcm_format_t format);
709 int snd_pcm_format_little_endian(snd_pcm_format_t format);
710 int snd_pcm_format_big_endian(snd_pcm_format_t format);
711 int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
712 int snd_pcm_format_width(snd_pcm_format_t format);			/* in bits */
713 int snd_pcm_format_physical_width(snd_pcm_format_t format);		/* in bits */
714 snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
715 ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
716 ubyte snd_pcm_format_silence(snd_pcm_format_t format);
717 ushort snd_pcm_format_silence_16(snd_pcm_format_t format);
718 uint snd_pcm_format_silence_32(snd_pcm_format_t format);
719 ulong snd_pcm_format_silence_64(snd_pcm_format_t format);
720 int snd_pcm_format_set_silence(snd_pcm_format_t format, void* buf, uint samples);
721 
722 snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t* pcm, ssize_t bytes);
723 ssize_t snd_pcm_frames_to_bytes(snd_pcm_t* pcm, snd_pcm_sframes_t frames);
724 c_long snd_pcm_bytes_to_samples(snd_pcm_t* pcm, ssize_t bytes);
725 ssize_t snd_pcm_samples_to_bytes(snd_pcm_t* pcm, c_long samples);
726 
727 int snd_pcm_area_silence(const snd_pcm_channel_area_t* dst_channel, snd_pcm_uframes_t dst_offset,
728 			 uint samples, snd_pcm_format_t format);
729 int snd_pcm_areas_silence(const snd_pcm_channel_area_t* dst_channels, snd_pcm_uframes_t dst_offset,
730 			  uint channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
731 int snd_pcm_area_copy(const snd_pcm_channel_area_t* dst_channel, snd_pcm_uframes_t dst_offset,
732 		      const snd_pcm_channel_area_t* src_channel, snd_pcm_uframes_t src_offset,
733 		      uint samples, snd_pcm_format_t format);
734 int snd_pcm_areas_copy(const snd_pcm_channel_area_t* dst_channels, snd_pcm_uframes_t dst_offset,
735 		       const snd_pcm_channel_area_t* src_channels, snd_pcm_uframes_t src_offset,
736 		       uint channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
737 
738 enum snd_pcm_hook_type_t
739 {
740 	HW_PARAMS = 0,
741 	HW_FREE,
742 	CLOSE,
743 	LAST = CLOSE
744 }
745 
746 struct snd_pcm_hook_t;
747 alias snd_pcm_hook_func_t = int function(snd_pcm_hook_t* hook);
748 snd_pcm_t* snd_pcm_hook_get_pcm(snd_pcm_hook_t* hook);
749 void* snd_pcm_hook_get_private(snd_pcm_hook_t* hook);
750 void snd_pcm_hook_set_private(snd_pcm_hook_t* hook, void* private_data);
751 int snd_pcm_hook_add(snd_pcm_hook_t** hookp, snd_pcm_t* pcm,
752 		     snd_pcm_hook_type_t type,
753 		     snd_pcm_hook_func_t func, void* private_data);
754 int snd_pcm_hook_remove(snd_pcm_hook_t* hook);
755 
756 struct snd_pcm_scope_ops_t
757 {
758 	int function(snd_pcm_scope_t* scope_) enable;
759 	void function(snd_pcm_scope_t* scope_) disable;
760 	void function(snd_pcm_scope_t* scope_) start;
761 	void function(snd_pcm_scope_t* scope_) stop;
762 	void function(snd_pcm_scope_t* scope_) update;
763 	void function(snd_pcm_scope_t* scope_) reset;
764 	void function(snd_pcm_scope_t* scope_) close;
765 }
766 
767 snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t* pcm);
768 uint snd_pcm_meter_get_channels(snd_pcm_t* pcm);
769 uint snd_pcm_meter_get_rate(snd_pcm_t* pcm);
770 snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t* pcm);
771 snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t* pcm);
772 int snd_pcm_meter_add_scope(snd_pcm_t* pcm, snd_pcm_scope_t* scope_);
773 snd_pcm_scope_t* snd_pcm_meter_search_scope(snd_pcm_t* pcm, const(char)* name);
774 int snd_pcm_scope_malloc(snd_pcm_scope_t** ptr);
775 void snd_pcm_scope_set_ops(snd_pcm_scope_t* scope_,
776 			   const snd_pcm_scope_ops_t* val);
777 void snd_pcm_scope_set_name(snd_pcm_scope_t* scope_, const(char)* val);
778 const(char)* snd_pcm_scope_get_name(snd_pcm_scope_t* scope_);
779 void* snd_pcm_scope_get_callback_private(snd_pcm_scope_t* scope_);
780 void snd_pcm_scope_set_callback_private(snd_pcm_scope_t* scope_, void* val);
781 int snd_pcm_scope_s16_open(snd_pcm_t* pcm, const(char)* name, snd_pcm_scope_t** scopep);
782 short* snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t* scope_, uint channel);
783 
784 enum snd_spcm_latency_t
785 {
786 	STANDARD = 0,
787 	MEDIUM,
788 	REALTIME
789 }
790 
791 enum snd_spcm_xrun_type_t
792 {
793 	IGNORE = 0,
794 	STOP
795 }
796 
797 enum snd_spcm_duplex_type_t
798 {
799 	LIBERAL = 0,
800 	PEDANTIC
801 }
802 
803 int snd_spcm_init(snd_pcm_t* pcm,
804 		  uint rate,
805 		  uint channels,
806 		  snd_pcm_format_t format,
807 		  snd_pcm_subformat_t subformat,
808 		  snd_spcm_latency_t latency,
809 		  snd_pcm_access_t _access,
810 		  snd_spcm_xrun_type_t xrun_type);
811 
812 int snd_spcm_init_duplex(snd_pcm_t* playback_pcm,
813 			 snd_pcm_t* capture_pcm,
814 			 uint rate,
815 			 uint channels,
816 			 snd_pcm_format_t format,
817 			 snd_pcm_subformat_t subformat,
818 			 snd_spcm_latency_t latency,
819 			 snd_pcm_access_t _access,
820 			 snd_spcm_xrun_type_t xrun_type,
821 			 snd_spcm_duplex_type_t duplex_type);
822 
823 int snd_spcm_init_get_params(snd_pcm_t* pcm,
824 			     uint* rate,
825 			     snd_pcm_uframes_t* buffer_size,
826 			     snd_pcm_uframes_t* period_size);
827 
828 /* Deprecated functions, for compatibility */
829 deprecated:
830 
831 const(char)* snd_pcm_start_mode_name(snd_pcm_start_t mode);
832 const(char)* snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode);
833 int snd_pcm_sw_params_set_start_mode(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_start_t val);
834 snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const(snd_pcm_sw_params_t)* params);
835 int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_xrun_t val);
836 snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const(snd_pcm_sw_params_t)* params);
837 
838 int snd_pcm_sw_params_set_xfer_align(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, snd_pcm_uframes_t val);
839 int snd_pcm_sw_params_get_xfer_align(const(snd_pcm_sw_params_t)* params, snd_pcm_uframes_t* val);
840 int snd_pcm_sw_params_set_sleep_min(snd_pcm_t* pcm, snd_pcm_sw_params_t* params, uint val);
841 int snd_pcm_sw_params_get_sleep_min(const(snd_pcm_sw_params_t)* params, uint* val);
842 
843 int snd_pcm_hw_params_get_tick_time(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
844 int snd_pcm_hw_params_get_tick_time_min(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
845 int snd_pcm_hw_params_get_tick_time_max(const(snd_pcm_hw_params_t)* params, uint* val, int* dir);
846 int snd_pcm_hw_params_test_tick_time(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
847 int snd_pcm_hw_params_set_tick_time(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint val, int dir);
848 int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
849 int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
850 int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* min, int* mindir, uint* max, int* maxdir);
851 int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
852 int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);
853 int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t* pcm, snd_pcm_hw_params_t* params, uint* val, int* dir);