OSDN Git Service

Replaced snd_pcm_avail() with snd_pcm_hwsync()
[android-x86/external-alsa-lib.git] / include / pcm.h
1 /**
2  * \file <alsa/pcm.h>
3  * \brief Application interface library for the ALSA driver
4  * \author Jaroslav Kysela <perex@suse.cz>
5  * \author Abramo Bagnara <abramo@alsa-project.org>
6  * \author Takashi Iwai <tiwai@suse.de>
7  * \date 1998-2001
8  *
9  * Application interface library for the ALSA driver.
10  * See the \ref pcm page for more details.
11  *
12  *
13  *   This library is free software; you can redistribute it and/or modify
14  *   it under the terms of the GNU Lesser General Public License as
15  *   published by the Free Software Foundation; either version 2.1 of
16  *   the License, or (at your option) any later version.
17  *
18  *   This program is distributed in the hope that it will be useful,
19  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
20  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  *   GNU Lesser General Public License for more details.
22  *
23  *   You should have received a copy of the GNU Lesser General Public
24  *   License along with this library; if not, write to the Free Software
25  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
26  *
27  */
28
29 #ifndef __ALSA_PCM_H
30 #define __ALSA_PCM_H
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /**
37  *  \defgroup PCM PCM Interface
38  *  See the \ref pcm page for more details.
39  *  \{
40  */
41
42 /** dlsym version for interface entry callback */
43 #define SND_PCM_DLSYM_VERSION           _dlsym_pcm_001
44
45 /** PCM generic info container */
46 typedef struct _snd_pcm_info snd_pcm_info_t;
47 /** PCM hardware configuration space container */
48 typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;
49 /** PCM software configuration container */
50 typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;
51 /** PCM status container */
52  typedef struct _snd_pcm_status snd_pcm_status_t;
53 /** PCM access types mask */
54 typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t;
55 /** PCM formats mask */
56 typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t;
57 /** PCM subformats mask */
58 typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t;
59
60 /** PCM class */
61 typedef enum _snd_pcm_class {
62         /** standard device */
63
64         SND_PCM_CLASS_GENERIC = 0,
65         /** multichannel device */
66         SND_PCM_CLASS_MULTI,
67         /** software modem device */
68         SND_PCM_CLASS_MODEM,
69         /** digitizer device */
70         SND_PCM_CLASS_DIGITIZER,
71         SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER
72 } snd_pcm_class_t;
73
74 /** PCM subclass */
75 typedef enum _snd_pcm_subclass {
76         /** subdevices are mixed together */
77         SND_PCM_SUBCLASS_GENERIC_MIX = 0,
78         /** multichannel subdevices are mixed together */
79         SND_PCM_SUBCLASS_MULTI_MIX,
80         SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX
81 } snd_pcm_subclass_t;
82
83 /** PCM stream (direction) */
84 typedef enum _snd_pcm_stream {
85         /** Playback stream */
86         SND_PCM_STREAM_PLAYBACK = 0,
87         /** Capture stream */
88         SND_PCM_STREAM_CAPTURE,
89         SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE
90 } snd_pcm_stream_t;
91
92 /** PCM access type */
93 typedef enum _snd_pcm_access {
94         /** mmap access with simple interleaved channels */
95         SND_PCM_ACCESS_MMAP_INTERLEAVED = 0,
96         /** mmap access with simple non interleaved channels */
97         SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
98         /** mmap access with complex placement */
99         SND_PCM_ACCESS_MMAP_COMPLEX,
100         /** snd_pcm_readi/snd_pcm_writei access */
101         SND_PCM_ACCESS_RW_INTERLEAVED,
102         /** snd_pcm_readn/snd_pcm_writen access */
103         SND_PCM_ACCESS_RW_NONINTERLEAVED,
104         SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED
105 } snd_pcm_access_t;
106
107 /** PCM sample format */
108 typedef enum _snd_pcm_format {
109         /** Unknown */
110         SND_PCM_FORMAT_UNKNOWN = -1,
111         /** Signed 8 bit */
112         SND_PCM_FORMAT_S8 = 0,
113         /** Unsigned 8 bit */
114         SND_PCM_FORMAT_U8,
115         /** Signed 16 bit Little Endian */
116         SND_PCM_FORMAT_S16_LE,
117         /** Signed 16 bit Big Endian */
118         SND_PCM_FORMAT_S16_BE,
119         /** Unsigned 16 bit Little Endian */
120         SND_PCM_FORMAT_U16_LE,
121         /** Unsigned 16 bit Big Endian */
122         SND_PCM_FORMAT_U16_BE,
123         /** Signed 24 bit Little Endian */
124         SND_PCM_FORMAT_S24_LE,
125         /** Signed 24 bit Big Endian */
126         SND_PCM_FORMAT_S24_BE,
127         /** Unsigned 24 bit Little Endian */
128         SND_PCM_FORMAT_U24_LE,
129         /** Unsigned 24 bit Big Endian */
130         SND_PCM_FORMAT_U24_BE,
131         /** Signed 32 bit Little Endian */
132         SND_PCM_FORMAT_S32_LE,
133         /** Signed 32 bit Big Endian */
134         SND_PCM_FORMAT_S32_BE,
135         /** Unsigned 32 bit Little Endian */
136         SND_PCM_FORMAT_U32_LE,
137         /** Unsigned 32 bit Big Endian */
138         SND_PCM_FORMAT_U32_BE,
139         /** Float 32 bit Little Endian, Range -1.0 to 1.0 */
140         SND_PCM_FORMAT_FLOAT_LE,
141         /** Float 32 bit Big Endian, Range -1.0 to 1.0 */
142         SND_PCM_FORMAT_FLOAT_BE,
143         /** Float 64 bit Little Endian, Range -1.0 to 1.0 */
144         SND_PCM_FORMAT_FLOAT64_LE,
145         /** Float 64 bit Big Endian, Range -1.0 to 1.0 */
146         SND_PCM_FORMAT_FLOAT64_BE,
147         /** IEC-958 Little Endian */
148         SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
149         /** IEC-958 Big Endian */
150         SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
151         /** Mu-Law */
152         SND_PCM_FORMAT_MU_LAW,
153         /** A-Law */
154         SND_PCM_FORMAT_A_LAW,
155         /** Ima-ADPCM */
156         SND_PCM_FORMAT_IMA_ADPCM,
157         /** MPEG */
158         SND_PCM_FORMAT_MPEG,
159         /** GSM */
160         SND_PCM_FORMAT_GSM,
161         /** Special */
162         SND_PCM_FORMAT_SPECIAL = 31,
163         /** Signed 24bit Little Endian in 3bytes format */
164         SND_PCM_FORMAT_S24_3LE = 32,
165         /** Signed 24bit Big Endian in 3bytes format */
166         SND_PCM_FORMAT_S24_3BE,
167         /** Unsigned 24bit Little Endian in 3bytes format */
168         SND_PCM_FORMAT_U24_3LE,
169         /** Unsigned 24bit Big Endian in 3bytes format */
170         SND_PCM_FORMAT_U24_3BE,
171         /** Signed 20bit Little Endian in 3bytes format */
172         SND_PCM_FORMAT_S20_3LE,
173         /** Signed 20bit Big Endian in 3bytes format */
174         SND_PCM_FORMAT_S20_3BE,
175         /** Unsigned 20bit Little Endian in 3bytes format */
176         SND_PCM_FORMAT_U20_3LE,
177         /** Unsigned 20bit Big Endian in 3bytes format */
178         SND_PCM_FORMAT_U20_3BE,
179         /** Signed 18bit Little Endian in 3bytes format */
180         SND_PCM_FORMAT_S18_3LE,
181         /** Signed 18bit Big Endian in 3bytes format */
182         SND_PCM_FORMAT_S18_3BE,
183         /** Unsigned 18bit Little Endian in 3bytes format */
184         SND_PCM_FORMAT_U18_3LE,
185         /** Unsigned 18bit Big Endian in 3bytes format */
186         SND_PCM_FORMAT_U18_3BE,
187         SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE,
188
189 #if __BYTE_ORDER == __LITTLE_ENDIAN
190         /** Signed 16 bit CPU endian */
191         SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE,
192         /** Unsigned 16 bit CPU endian */
193         SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE,
194         /** Signed 24 bit CPU endian */
195         SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE,
196         /** Unsigned 24 bit CPU endian */
197         SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,
198         /** Signed 32 bit CPU endian */
199         SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE,
200         /** Unsigned 32 bit CPU endian */
201         SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE,
202         /** Float 32 bit CPU endian */
203         SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE,
204         /** Float 64 bit CPU endian */
205         SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,
206         /** IEC-958 CPU Endian */
207         SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE
208 #elif __BYTE_ORDER == __BIG_ENDIAN
209         /** Signed 16 bit CPU endian */
210         SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE,
211         /** Unsigned 16 bit CPU endian */
212         SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE,
213         /** Signed 24 bit CPU endian */
214         SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE,
215         /** Unsigned 24 bit CPU endian */
216         SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE,
217         /** Signed 32 bit CPU endian */
218         SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE,
219         /** Unsigned 32 bit CPU endian */
220         SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE,
221         /** Float 32 bit CPU endian */
222         SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE,
223         /** Float 64 bit CPU endian */
224         SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE,
225         /** IEC-958 CPU Endian */
226         SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE
227 #else
228 #error "Unknown endian"
229 #endif
230 } snd_pcm_format_t;
231
232 /** PCM sample subformat */
233 typedef enum _snd_pcm_subformat {
234         /** Standard */
235         SND_PCM_SUBFORMAT_STD = 0,
236         SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
237 } snd_pcm_subformat_t;
238
239 /** PCM state */
240 typedef enum _snd_pcm_state {
241         /** Open */
242         SND_PCM_STATE_OPEN = 0,
243         /** Setup installed */ 
244         SND_PCM_STATE_SETUP,
245         /** Ready to start */
246         SND_PCM_STATE_PREPARED,
247         /** Running */
248         SND_PCM_STATE_RUNNING,
249         /** Stopped: underrun (playback) or overrun (capture) detected */
250         SND_PCM_STATE_XRUN,
251         /** Draining: running (playback) or stopped (capture) */
252         SND_PCM_STATE_DRAINING,
253         /** Paused */
254         SND_PCM_STATE_PAUSED,
255         /** Hardware is suspended */
256         SND_PCM_STATE_SUSPENDED,
257         SND_PCM_STATE_LAST = SND_PCM_STATE_SUSPENDED
258 } snd_pcm_state_t;
259
260 /** PCM start mode */
261 typedef enum _snd_pcm_start {
262         /** Automatic start on data read/write */
263         SND_PCM_START_DATA = 0,
264         /** Explicit start */
265         SND_PCM_START_EXPLICIT,
266         SND_PCM_START_LAST = SND_PCM_START_EXPLICIT
267 } snd_pcm_start_t;
268
269 /** PCM xrun mode */
270 typedef enum _snd_pcm_xrun {
271         /** Xrun detection disabled */
272         SND_PCM_XRUN_NONE = 0,
273         /** Stop on xrun detection */
274         SND_PCM_XRUN_STOP,
275         SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP
276 } snd_pcm_xrun_t;
277
278 /** PCM timestamp mode */
279 typedef enum _snd_pcm_tstamp {
280         /** No timestamp */
281         SND_PCM_TSTAMP_NONE = 0,
282         /** Update mmap'ed timestamp */
283         SND_PCM_TSTAMP_MMAP,
284         SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_MMAP
285 } snd_pcm_tstamp_t;
286
287 /** Unsigned frames quantity */
288 typedef unsigned long snd_pcm_uframes_t;
289 /** Signed frames quantity */
290 typedef long snd_pcm_sframes_t;
291 /** Timestamp */
292 typedef struct timeval snd_timestamp_t;
293
294 /** Non blocking mode (flag for open mode) \hideinitializer */
295 #define SND_PCM_NONBLOCK                0x0001
296 /** Async notification (flag for open mode) \hideinitializer */
297 #define SND_PCM_ASYNC                   0x0002
298
299 /** PCM handle */
300 typedef struct _snd_pcm snd_pcm_t;
301
302 /** PCM type */
303 enum _snd_pcm_type {
304         /** Kernel level PCM */
305         SND_PCM_TYPE_HW = 0,
306         /** Hooked PCM */
307         SND_PCM_TYPE_HOOKS,
308         /** One ore more linked PCM with exclusive access to selected
309             channels */
310         SND_PCM_TYPE_MULTI,
311         /** File writing plugin */
312         SND_PCM_TYPE_FILE,
313         /** Null endpoint PCM */
314         SND_PCM_TYPE_NULL,
315         /** Shared memory client PCM */
316         SND_PCM_TYPE_SHM,
317         /** INET client PCM (not yet implemented) */
318         SND_PCM_TYPE_INET,
319         /** Copying plugin */
320         SND_PCM_TYPE_COPY,
321         /** Linear format conversion PCM */
322         SND_PCM_TYPE_LINEAR,
323         /** A-Law format conversion PCM */
324         SND_PCM_TYPE_ALAW,
325         /** Mu-Law format conversion PCM */
326         SND_PCM_TYPE_MULAW,
327         /** IMA-ADPCM format conversion PCM */
328         SND_PCM_TYPE_ADPCM,
329         /** Rate conversion PCM */
330         SND_PCM_TYPE_RATE,
331         /** Attenuated static route PCM */
332         SND_PCM_TYPE_ROUTE,
333         /** Format adjusted PCM */
334         SND_PCM_TYPE_PLUG,
335         /** Sharing PCM */
336         SND_PCM_TYPE_SHARE,
337         /** Meter plugin */
338         SND_PCM_TYPE_METER,
339         /** Mixing PCM */
340         SND_PCM_TYPE_MIX,
341         /** Attenuated dynamic route PCM (not yet implemented) */
342         SND_PCM_TYPE_DROUTE,
343         /** Loopback server plugin (not yet implemented) */
344         SND_PCM_TYPE_LBSERVER,
345         /** Linear Integer <-> Linear Float format conversion PCM */
346         SND_PCM_TYPE_LINEAR_FLOAT,
347         /** LADSPA integration plugin */
348         SND_PCM_TYPE_LADSPA
349 };
350
351 /** PCM type */
352 typedef enum _snd_pcm_type snd_pcm_type_t;
353
354 /** PCM area specification */
355 typedef struct _snd_pcm_channel_area {
356         /** base address of channel samples */
357         void *addr;
358         /** offset to first sample in bits */
359         unsigned int first;
360         /** samples distance in bits */
361         unsigned int step;
362 } snd_pcm_channel_area_t;
363
364 /** PCM synchronization ID */
365 typedef union _snd_pcm_sync_id {
366         /** 8-bit ID */
367         unsigned char id[16];
368         /** 16-bit ID */
369         unsigned short id16[8];
370         /** 32-bit ID */
371         unsigned int id32[4];
372 } snd_pcm_sync_id_t;
373
374 /** #SND_PCM_TYPE_METER scope handle */
375 typedef struct _snd_pcm_scope snd_pcm_scope_t;
376
377 int snd_pcm_open(snd_pcm_t **pcm, const char *name, 
378                  snd_pcm_stream_t stream, int mode);
379 int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, 
380                        snd_pcm_stream_t stream, int mode,
381                        snd_config_t *lconf);
382
383 int snd_pcm_close(snd_pcm_t *pcm);
384 const char *snd_pcm_name(snd_pcm_t *pcm);
385 snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
386 snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm);
387 int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);
388 int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
389 int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
390 int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
391 int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, 
392                               snd_async_callback_t callback, void *private_data);
393 snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);
394 int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);
395 int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
396 int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
397 int snd_pcm_hw_free(snd_pcm_t *pcm);
398 int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
399 int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);
400 int snd_pcm_prepare(snd_pcm_t *pcm);
401 int snd_pcm_reset(snd_pcm_t *pcm);
402 int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);
403 int snd_pcm_start(snd_pcm_t *pcm);
404 int snd_pcm_drop(snd_pcm_t *pcm);
405 int snd_pcm_drain(snd_pcm_t *pcm);
406 int snd_pcm_pause(snd_pcm_t *pcm, int enable);
407 snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm);
408 int snd_pcm_hwsync(snd_pcm_t *pcm);
409 int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
410 int snd_pcm_resume(snd_pcm_t *pcm);
411 snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
412 snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
413 snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
414 snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
415 snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
416 snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
417 int snd_pcm_wait(snd_pcm_t *pcm, int timeout);
418
419 int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
420 int snd_pcm_unlink(snd_pcm_t *pcm);
421
422 /** \} */
423
424 /**
425  * \defgroup PCM_Info Stream Information
426  * \ingroup PCM
427  * See the \ref pcm page for more details.
428  * \{
429  */
430
431 size_t snd_pcm_info_sizeof(void);
432 /** \hideinitializer
433  * \brief allocate an invalid #snd_pcm_info_t using standard alloca
434  * \param ptr returned pointer
435  */
436 #define snd_pcm_info_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); memset(*ptr, 0, snd_pcm_info_sizeof()); } while (0)
437 int snd_pcm_info_malloc(snd_pcm_info_t **ptr);
438 void snd_pcm_info_free(snd_pcm_info_t *obj);
439 void snd_pcm_info_clear(snd_pcm_info_t *obj);
440 void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
441 unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
442 unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
443 snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);
444 int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
445 const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);
446 const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);
447 const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);
448 snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);
449 snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);
450 unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);
451 unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);
452 snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj);
453 void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);
454 void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
455 void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);
456
457 /** \} */
458
459 /**
460  * \defgroup PCM_HW_Params Hardware Parameters
461  * \ingroup PCM
462  * See the \ref pcm page for more details.
463  * \{
464  */
465
466 int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
467
468 int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params);
469 int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params);
470 int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params);
471 int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params);
472 int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params);
473 int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params);
474 int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params);
475 int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);
476 int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);
477 int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);
478 int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,
479                                       unsigned int *rate_num,
480                                       unsigned int *rate_den);
481 int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);
482 int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);
483
484 #if 0
485 typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;
486
487 /* choices need to be sorted on ascending badness */
488 typedef struct _snd_pcm_hw_strategy_simple_choices_list {
489         unsigned int value;
490         unsigned int badness;
491 } snd_pcm_hw_strategy_simple_choices_list_t;
492
493 int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
494                                const snd_pcm_hw_strategy_t *strategy,
495                                unsigned int badness_min,
496                                unsigned int badness_max);
497
498 void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy);
499 int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,
500                                unsigned int badness_min,
501                                unsigned int badness_max);
502 int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
503                                           snd_pcm_hw_params_t *fail,
504                                           snd_pcm_hw_params_t *success,
505                                           unsigned int depth,
506                                           snd_output_t *out);
507
508 #endif
509
510 size_t snd_pcm_hw_params_sizeof(void);
511 /** \hideinitializer
512  * \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca
513  * \param ptr returned pointer
514  */
515 #define snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr, 0, snd_pcm_hw_params_sizeof()); } while (0)
516 int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);
517 void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);
518 void snd_pcm_hw_params_clear(snd_pcm_hw_params_t *obj);
519 void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);
520
521 #ifndef ALSA_LIBRARY_BUILD
522 #ifdef ALSA_PCM_NEW_HW_PARAMS_API
523
524 int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *access) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_access")));
525 int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
526 int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access);
527 int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_access_last")));
528 int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_access_last")));
529 int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
530 int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
531
532 int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_format")));
533 int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
534 int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
535 int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_format_first")));
536 int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_format_last")));
537 int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
538 void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
539
540 int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_subformat")));
541 int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
542 int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);
543 int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_subformat_first")));
544 int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_subformat_last")));
545 int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
546 void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
547
548 int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_channels")));
549 int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_channels_min")));
550 int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_channels_max")));
551 int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
552 int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
553 int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
554 int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
555 int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
556 int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_channels_near")));
557 int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_channels_first")));
558 int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_channels_last")));
559
560 int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_rate")));
561 int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_rate_min")));
562 int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_rate_max")));
563 int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
564 int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
565 int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
566 int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
567 int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
568 int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_rate_near")));
569 int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_rate_first")));
570 int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_rate_last")));
571
572 int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_period_time")));
573 int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_period_time_min")));
574 int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_period_time_max")));
575 int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
576 int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
577 int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
578 int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
579 int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
580 int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_period_time_near")));
581 int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_period_time_first")));
582 int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_period_time_last")));
583
584 int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_period_size")));
585 int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_period_size_min")));
586 int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_period_size_max"))); 
587 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);
588 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);
589 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);
590 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);
591 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);
592 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) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_period_size_near")));
593 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) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_period_size_first")));
594 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) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_period_size_last")));
595 int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
596
597 int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_periods")));
598 int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_periods_min")));
599 int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_periods_max")));
600 int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
601 int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
602 int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
603 int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
604 int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
605 int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)  __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_periods_near")));
606 int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)  __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_periods_first")));
607 int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)  __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_periods_last")));
608 int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
609
610 int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_buffer_time")));
611 int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_buffer_time_min")));
612 int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_buffer_time_max")));
613 int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
614 int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
615 int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
616 int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
617 int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
618 int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_buffer_time_near")));
619 int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_buffer_time_first")));
620 int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_buffer_time_last")));
621
622 int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_buffer_size")));
623 int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_buffer_size_min")));
624 int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_buffer_size_max")));
625 int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
626 int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
627 int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
628 int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
629 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);
630 int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_buffer_size_near")));
631 int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_buffer_size_first")));
632 int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_buffer_size_last")));
633
634 int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_tick_time")));
635 int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_tick_time_min")));
636 int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_get_tick_time_max")));
637 int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
638 int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
639 int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
640 int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
641 int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
642 int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_tick_time_near")));
643 int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_tick_time_first")));
644 int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__ ((weak, alias ("__snd_pcm_hw_params_set_tick_time_last")));
645
646 #else
647
648 int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params);
649 int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
650 int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t val);
651 snd_pcm_access_t snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
652 snd_pcm_access_t snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
653 int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
654 void snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);
655
656 int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params);
657 int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
658 int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);
659 snd_pcm_format_t snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
660 snd_pcm_format_t snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
661 int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
662 void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);
663
664 int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
665 int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params);
666 int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t val);
667 snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
668 snd_pcm_subformat_t snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
669 int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
670 void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);
671
672 int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params);
673 unsigned int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params);
674 unsigned int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params);
675 int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
676 int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
677 int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
678 int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
679 int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
680 unsigned int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
681 unsigned int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
682 unsigned int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
683
684 int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, int *dir);
685 unsigned int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, int *dir);
686 unsigned int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, int *dir);
687 int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
688 int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
689 int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
690 int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
691 int snd_pcm_hw_params_set_rate_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
692 unsigned int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
693 unsigned int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
694 unsigned int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
695
696 int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, int *dir);
697 unsigned int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, int *dir);
698 unsigned int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, int *dir);
699 int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
700 int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
701 int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
702 int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
703 int snd_pcm_hw_params_set_period_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
704 unsigned int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
705 unsigned int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
706 unsigned int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
707
708 snd_pcm_sframes_t snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, int *dir);
709 snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, int *dir);
710 snd_pcm_uframes_t snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, int *dir);
711 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);
712 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);
713 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);
714 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);
715 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);
716 snd_pcm_uframes_t 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);
717 snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
718 snd_pcm_uframes_t snd_pcm_hw_params_set_period_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
719 int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
720
721 int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, int *dir);
722 unsigned int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, int *dir);
723 unsigned int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, int *dir);
724 int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
725 int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
726 int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
727 int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
728 int snd_pcm_hw_params_set_periods_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
729 unsigned int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
730 unsigned int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
731 unsigned int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
732 int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
733
734 int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, int *dir);
735 unsigned int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, int *dir);
736 unsigned int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, int *dir);
737 int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
738 int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
739 int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
740 int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
741 int snd_pcm_hw_params_set_buffer_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
742 unsigned int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
743 unsigned int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
744 unsigned int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
745
746 snd_pcm_sframes_t snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params);
747 snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params);
748 snd_pcm_uframes_t snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params);
749 int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
750 int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
751 int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
752 int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
753 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);
754 snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
755 snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
756 snd_pcm_uframes_t snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
757
758 int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, int *dir);
759 unsigned int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, int *dir);
760 unsigned int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, int *dir);
761 int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
762 int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
763 int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
764 int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
765 int snd_pcm_hw_params_set_tick_time_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, int *mindir, unsigned int *max, int *maxdir);
766 unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int *dir);
767 unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
768 unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
769
770 #endif /* SND_COMPATIBILITY_BUILD_RC3 */
771 #endif /* ALSA_LIBRARY_BUILD */
772
773 int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
774
775 /** \} */
776
777 /**
778  * \defgroup PCM_SW_Params Software Parameters
779  * \ingroup PCM
780  * See the \ref pcm page for more details.
781  * \{
782  */
783
784 size_t snd_pcm_sw_params_sizeof(void);
785 /** \hideinitializer
786  * \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca
787  * \param ptr returned pointer
788  */
789 #define snd_pcm_sw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); } while (0)
790 int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);
791 void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);
792 void snd_pcm_sw_params_clear(snd_pcm_sw_params_t *obj);
793 void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);
794 int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);
795 snd_pcm_tstamp_t snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params);
796 #if 0
797 int snd_pcm_sw_params_set_period_step(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
798 unsigned int snd_pcm_sw_params_get_period_step(const snd_pcm_sw_params_t *params);
799 #endif
800 int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val);
801 unsigned int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params);
802 int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
803 snd_pcm_uframes_t snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params);
804 int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
805 snd_pcm_uframes_t snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params);
806 int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
807 snd_pcm_uframes_t snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *params);
808 int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
809 snd_pcm_uframes_t snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params);
810 int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
811 snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params);
812 int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
813 snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
814
815 /** \} */
816
817 /**
818  * \defgroup PCM_Access Access Mask Functions
819  * \ingroup PCM
820  * See the \ref pcm page for more details.
821  * \{
822  */
823
824 size_t snd_pcm_access_mask_sizeof(void);
825 /** \hideinitializer
826  * \brief allocate an empty #snd_pcm_access_mask_t using standard alloca
827  * \param ptr returned pointer
828  */
829 #define snd_pcm_access_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_access_mask_t *) alloca(snd_pcm_access_mask_sizeof()); memset(*ptr, 0, snd_pcm_access_mask_sizeof()); } while (0)
830 int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr);
831 void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj);
832 void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src);
833 void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask);
834 void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask);
835 int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
836 int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask);
837 void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
838 void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
839
840 /** \} */
841
842 /**
843  * \defgroup PCM_Format Format Mask Functions
844  * \ingroup PCM
845  * See the \ref pcm page for more details.
846  * \{
847  */
848
849 size_t snd_pcm_format_mask_sizeof(void);
850 /** \hideinitializer
851  * \brief allocate an empty #snd_pcm_format_mask_t using standard alloca
852  * \param ptr returned pointer
853  */
854 #define snd_pcm_format_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_format_mask_t *) alloca(snd_pcm_format_mask_sizeof()); memset(*ptr, 0, snd_pcm_format_mask_sizeof()); } while (0)
855 int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);
856 void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);
857 void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);
858 void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask);
859 void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask);
860 int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
861 int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask);
862 void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
863 void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
864
865 /** \} */
866
867 /**
868  * \defgroup PCM_SubFormat Subformat Mask Functions
869  * \ingroup PCM
870  * See the \ref pcm page for more details.
871  * \{
872  */
873
874 size_t snd_pcm_subformat_mask_sizeof(void);
875 /** \hideinitializer
876  * \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca
877  * \param ptr returned pointer
878  */
879 #define snd_pcm_subformat_mask_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_subformat_mask_t *) alloca(snd_pcm_subformat_mask_sizeof()); memset(*ptr, 0, snd_pcm_subformat_mask_sizeof()); } while (0)
880 int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr);
881 void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj);
882 void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src);
883 void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask);
884 void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask);
885 int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
886 int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask);
887 void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
888 void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
889
890 /** \} */
891
892 /**
893  * \defgroup PCM_Status Status Functions
894  * \ingroup PCM
895  * See the \ref pcm page for more details.
896  * \{
897  */
898
899 size_t snd_pcm_status_sizeof(void);
900 /** \hideinitializer
901  * \brief allocate an invalid #snd_pcm_status_t using standard alloca
902  * \param ptr returned pointer
903  */
904 #define snd_pcm_status_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_status_t *) alloca(snd_pcm_status_sizeof()); memset(*ptr, 0, snd_pcm_status_sizeof()); } while (0)
905 int snd_pcm_status_malloc(snd_pcm_status_t **ptr);
906 void snd_pcm_status_free(snd_pcm_status_t *obj);
907 void snd_pcm_status_clear(snd_pcm_status_t *obj);
908 void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);
909 snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);
910 void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
911 void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);
912 snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
913 snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
914 snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
915 snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj);
916
917 /** \} */
918
919 /**
920  * \defgroup PCM_Description Description Functions
921  * \ingroup PCM
922  * See the \ref pcm page for more details.
923  * \{
924  */
925
926 const char *snd_pcm_stream_name(const snd_pcm_stream_t stream);
927 const char *snd_pcm_access_name(const snd_pcm_access_t _access);
928 const char *snd_pcm_format_name(const snd_pcm_format_t format);
929 const char *snd_pcm_format_description(const snd_pcm_format_t format);
930 const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);
931 const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);
932 snd_pcm_format_t snd_pcm_format_value(const char* name);
933 const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);
934 const char *snd_pcm_state_name(const snd_pcm_state_t state);
935
936 /** \} */
937
938 /**
939  * \defgroup PCM_Dump Debug Functions
940  * \ingroup PCM
941  * See the \ref pcm page for more details.
942  * \{
943  */
944
945 int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);
946 int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out);
947 int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out);
948 int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out);
949 int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);
950 int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);
951 int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);
952
953 /** \} */
954
955 /**
956  * \defgroup PCM_Direct Direct Access (MMAP) Functions
957  * \ingroup PCM
958  * See the \ref pcm page for more details.
959  * \{
960  */
961
962 int snd_pcm_mmap_begin(snd_pcm_t *pcm,
963                        const snd_pcm_channel_area_t **areas,
964                        snd_pcm_uframes_t *offset,
965                        snd_pcm_uframes_t *frames);
966 snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
967                                       snd_pcm_uframes_t offset,
968                                       snd_pcm_uframes_t frames);
969 snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
970 snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
971 snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
972 snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);                                                                
973
974 /** \} */
975
976 /**
977  * \defgroup PCM_Helpers Helper Functions
978  * \ingroup PCM
979  * See the \ref pcm page for more details.
980  * \{
981  */
982
983 int snd_pcm_format_signed(snd_pcm_format_t format);
984 int snd_pcm_format_unsigned(snd_pcm_format_t format);
985 int snd_pcm_format_linear(snd_pcm_format_t format);
986 int snd_pcm_format_float(snd_pcm_format_t format);
987 int snd_pcm_format_little_endian(snd_pcm_format_t format);
988 int snd_pcm_format_big_endian(snd_pcm_format_t format);
989 int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
990 int snd_pcm_format_width(snd_pcm_format_t format);                      /* in bits */
991 int snd_pcm_format_physical_width(snd_pcm_format_t format);             /* in bits */
992 snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
993 ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
994 u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
995 u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
996 u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
997 u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
998 int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
999
1000 snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
1001 ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames);
1002 long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes);
1003 ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples);
1004
1005 int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
1006                          unsigned int samples, snd_pcm_format_t format);
1007 int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
1008                           unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
1009 int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
1010                       const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,
1011                       unsigned int samples, snd_pcm_format_t format);
1012 int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
1013                        const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,
1014                        unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
1015
1016 /** \} */
1017
1018 /**
1019  * \defgroup PCM_Hook Hook Extension
1020  * \ingroup PCM
1021  * See the \ref pcm page for more details.
1022  * \{
1023  */
1024
1025 /** type of pcm hook */
1026 typedef enum _snd_pcm_hook_type {
1027         SND_PCM_HOOK_TYPE_HW_PARAMS = 0,
1028         SND_PCM_HOOK_TYPE_HW_FREE,
1029         SND_PCM_HOOK_TYPE_CLOSE,
1030         SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE
1031 } snd_pcm_hook_type_t;
1032
1033 /** PCM hook container */
1034 typedef struct _snd_pcm_hook snd_pcm_hook_t;
1035 /** PCM hook callback function */
1036 typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook);
1037 snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook);
1038 void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook);
1039 void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data);
1040 int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm,
1041                      snd_pcm_hook_type_t type,
1042                      snd_pcm_hook_func_t func, void *private_data);
1043 int snd_pcm_hook_remove(snd_pcm_hook_t *hook);
1044
1045 /** \} */
1046
1047 /**
1048  * \defgroup PCM_Scope Scope Plugin Extension
1049  * \ingroup PCM
1050  * See the \ref pcm page for more details.
1051  * \{
1052  */
1053
1054 /** #SND_PCM_TYPE_METER scope functions */
1055 typedef struct _snd_pcm_scope_ops {
1056         /** \brief Enable and prepare it using current params
1057          * \param scope scope handle
1058          */
1059         int (*enable)(snd_pcm_scope_t *scope);
1060         /** \brief Disable
1061          * \param scope scope handle
1062          */
1063         void (*disable)(snd_pcm_scope_t *scope);
1064         /** \brief PCM has been started
1065          * \param scope scope handle
1066          */
1067         void (*start)(snd_pcm_scope_t *scope);
1068         /** \brief PCM has been stopped
1069          * \param scope scope handle
1070          */
1071         void (*stop)(snd_pcm_scope_t *scope);
1072         /** \brief New frames are present
1073          * \param scope scope handle
1074          */
1075         void (*update)(snd_pcm_scope_t *scope);
1076         /** \brief Reset status
1077          * \param scope scope handle
1078          */
1079         void (*reset)(snd_pcm_scope_t *scope);
1080         /** \brief PCM is closing
1081          * \param scope scope handle
1082          */
1083         void (*close)(snd_pcm_scope_t *scope);
1084 } snd_pcm_scope_ops_t;
1085
1086 snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm);
1087 unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm);
1088 unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm);
1089 snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm);
1090 snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm);
1091 int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);
1092 snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);
1093 int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);
1094 void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val);
1095 void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);
1096 const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);
1097 void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);
1098 void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val);
1099 int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
1100                            snd_pcm_scope_t **scopep);
1101 int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,
1102                                               unsigned int channel);
1103
1104 /** \} */
1105
1106 /**
1107  * \defgroup PCM_Deprecated Deprecated Functions
1108  * \ingroup PCM
1109  * See the \ref pcm page for more details.
1110  * \{
1111  */
1112
1113 /* Deprecated functions, for compatibility */
1114 const char *snd_pcm_start_mode_name(snd_pcm_start_t mode);
1115 const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode);
1116 int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val);
1117 snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params);
1118 int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val);
1119 snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params);
1120
1121 /** \} */
1122
1123 #ifdef __cplusplus
1124 }
1125 #endif
1126
1127 #endif /* __ALSA_PCM_H */