1 | /** |
2 | * \file include/pcm.h |
3 | * \brief Application interface library for the ALSA driver |
4 | * \author Jaroslav Kysela <perex@perex.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 | |
48 | /** PCM hardware configuration space container |
49 | * |
50 | * snd_pcm_hw_params_t is an opaque structure which contains a set of possible |
51 | * PCM hardware configurations. For example, a given instance might include a |
52 | * range of buffer sizes, a range of period sizes, and a set of several sample |
53 | * formats. Some subset of all possible combinations these sets may be valid, |
54 | * but not necessarily any combination will be valid. |
55 | * |
56 | * When a parameter is set or restricted using a snd_pcm_hw_params_set* |
57 | * function, all of the other ranges will be updated to exclude as many |
58 | * impossible configurations as possible. Attempting to set a parameter |
59 | * outside of its acceptable range will result in the function failing |
60 | * and an error code being returned. |
61 | */ |
62 | typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t; |
63 | |
64 | /** PCM software configuration container */ |
65 | typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t; |
66 | /** PCM status container */ |
67 | typedef struct _snd_pcm_status snd_pcm_status_t; |
68 | /** PCM access types mask */ |
69 | typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t; |
70 | /** PCM formats mask */ |
71 | typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t; |
72 | /** PCM subformats mask */ |
73 | typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t; |
74 | |
75 | /** PCM class */ |
76 | typedef enum _snd_pcm_class { |
77 | /** standard device */ |
78 | |
79 | SND_PCM_CLASS_GENERIC = 0, |
80 | /** multichannel device */ |
81 | SND_PCM_CLASS_MULTI, |
82 | /** software modem device */ |
83 | SND_PCM_CLASS_MODEM, |
84 | /** digitizer device */ |
85 | SND_PCM_CLASS_DIGITIZER, |
86 | SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER |
87 | } snd_pcm_class_t; |
88 | |
89 | /** PCM subclass */ |
90 | typedef enum _snd_pcm_subclass { |
91 | /** subdevices are mixed together */ |
92 | SND_PCM_SUBCLASS_GENERIC_MIX = 0, |
93 | /** multichannel subdevices are mixed together */ |
94 | SND_PCM_SUBCLASS_MULTI_MIX, |
95 | SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX |
96 | } snd_pcm_subclass_t; |
97 | |
98 | /** PCM stream (direction) */ |
99 | typedef enum _snd_pcm_stream { |
100 | /** Playback stream */ |
101 | SND_PCM_STREAM_PLAYBACK = 0, |
102 | /** Capture stream */ |
103 | SND_PCM_STREAM_CAPTURE, |
104 | SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE |
105 | } snd_pcm_stream_t; |
106 | |
107 | /** PCM access type */ |
108 | typedef enum _snd_pcm_access { |
109 | /** mmap access with simple interleaved channels */ |
110 | SND_PCM_ACCESS_MMAP_INTERLEAVED = 0, |
111 | /** mmap access with simple non interleaved channels */ |
112 | SND_PCM_ACCESS_MMAP_NONINTERLEAVED, |
113 | /** mmap access with complex placement */ |
114 | SND_PCM_ACCESS_MMAP_COMPLEX, |
115 | /** snd_pcm_readi/snd_pcm_writei access */ |
116 | SND_PCM_ACCESS_RW_INTERLEAVED, |
117 | /** snd_pcm_readn/snd_pcm_writen access */ |
118 | SND_PCM_ACCESS_RW_NONINTERLEAVED, |
119 | SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED |
120 | } snd_pcm_access_t; |
121 | |
122 | /** PCM sample format */ |
123 | typedef enum _snd_pcm_format { |
124 | /** Unknown */ |
125 | SND_PCM_FORMAT_UNKNOWN = -1, |
126 | /** Signed 8 bit */ |
127 | SND_PCM_FORMAT_S8 = 0, |
128 | /** Unsigned 8 bit */ |
129 | SND_PCM_FORMAT_U8, |
130 | /** Signed 16 bit Little Endian */ |
131 | SND_PCM_FORMAT_S16_LE, |
132 | /** Signed 16 bit Big Endian */ |
133 | SND_PCM_FORMAT_S16_BE, |
134 | /** Unsigned 16 bit Little Endian */ |
135 | SND_PCM_FORMAT_U16_LE, |
136 | /** Unsigned 16 bit Big Endian */ |
137 | SND_PCM_FORMAT_U16_BE, |
138 | /** Signed 24 bit Little Endian using low three bytes in 32-bit word */ |
139 | SND_PCM_FORMAT_S24_LE, |
140 | /** Signed 24 bit Big Endian using low three bytes in 32-bit word */ |
141 | SND_PCM_FORMAT_S24_BE, |
142 | /** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */ |
143 | SND_PCM_FORMAT_U24_LE, |
144 | /** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */ |
145 | SND_PCM_FORMAT_U24_BE, |
146 | /** Signed 32 bit Little Endian */ |
147 | SND_PCM_FORMAT_S32_LE, |
148 | /** Signed 32 bit Big Endian */ |
149 | SND_PCM_FORMAT_S32_BE, |
150 | /** Unsigned 32 bit Little Endian */ |
151 | SND_PCM_FORMAT_U32_LE, |
152 | /** Unsigned 32 bit Big Endian */ |
153 | SND_PCM_FORMAT_U32_BE, |
154 | /** Float 32 bit Little Endian, Range -1.0 to 1.0 */ |
155 | SND_PCM_FORMAT_FLOAT_LE, |
156 | /** Float 32 bit Big Endian, Range -1.0 to 1.0 */ |
157 | SND_PCM_FORMAT_FLOAT_BE, |
158 | /** Float 64 bit Little Endian, Range -1.0 to 1.0 */ |
159 | SND_PCM_FORMAT_FLOAT64_LE, |
160 | /** Float 64 bit Big Endian, Range -1.0 to 1.0 */ |
161 | SND_PCM_FORMAT_FLOAT64_BE, |
162 | /** IEC-958 Little Endian */ |
163 | SND_PCM_FORMAT_IEC958_SUBFRAME_LE, |
164 | /** IEC-958 Big Endian */ |
165 | SND_PCM_FORMAT_IEC958_SUBFRAME_BE, |
166 | /** Mu-Law */ |
167 | SND_PCM_FORMAT_MU_LAW, |
168 | /** A-Law */ |
169 | SND_PCM_FORMAT_A_LAW, |
170 | /** Ima-ADPCM */ |
171 | SND_PCM_FORMAT_IMA_ADPCM, |
172 | /** MPEG */ |
173 | SND_PCM_FORMAT_MPEG, |
174 | /** GSM */ |
175 | SND_PCM_FORMAT_GSM, |
176 | /** Special */ |
177 | SND_PCM_FORMAT_SPECIAL = 31, |
178 | /** Signed 24bit Little Endian in 3bytes format */ |
179 | SND_PCM_FORMAT_S24_3LE = 32, |
180 | /** Signed 24bit Big Endian in 3bytes format */ |
181 | SND_PCM_FORMAT_S24_3BE, |
182 | /** Unsigned 24bit Little Endian in 3bytes format */ |
183 | SND_PCM_FORMAT_U24_3LE, |
184 | /** Unsigned 24bit Big Endian in 3bytes format */ |
185 | SND_PCM_FORMAT_U24_3BE, |
186 | /** Signed 20bit Little Endian in 3bytes format */ |
187 | SND_PCM_FORMAT_S20_3LE, |
188 | /** Signed 20bit Big Endian in 3bytes format */ |
189 | SND_PCM_FORMAT_S20_3BE, |
190 | /** Unsigned 20bit Little Endian in 3bytes format */ |
191 | SND_PCM_FORMAT_U20_3LE, |
192 | /** Unsigned 20bit Big Endian in 3bytes format */ |
193 | SND_PCM_FORMAT_U20_3BE, |
194 | /** Signed 18bit Little Endian in 3bytes format */ |
195 | SND_PCM_FORMAT_S18_3LE, |
196 | /** Signed 18bit Big Endian in 3bytes format */ |
197 | SND_PCM_FORMAT_S18_3BE, |
198 | /** Unsigned 18bit Little Endian in 3bytes format */ |
199 | SND_PCM_FORMAT_U18_3LE, |
200 | /** Unsigned 18bit Big Endian in 3bytes format */ |
201 | SND_PCM_FORMAT_U18_3BE, |
202 | /* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */ |
203 | SND_PCM_FORMAT_G723_24, |
204 | /* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */ |
205 | SND_PCM_FORMAT_G723_24_1B, |
206 | /* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */ |
207 | SND_PCM_FORMAT_G723_40, |
208 | /* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */ |
209 | SND_PCM_FORMAT_G723_40_1B, |
210 | /* Direct Stream Digital (DSD) in 1-byte samples (x8) */ |
211 | SND_PCM_FORMAT_DSD_U8, |
212 | /* Direct Stream Digital (DSD) in 2-byte samples (x16) */ |
213 | SND_PCM_FORMAT_DSD_U16_LE, |
214 | SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U16_LE, |
215 | |
216 | #if __BYTE_ORDER == __LITTLE_ENDIAN |
217 | /** Signed 16 bit CPU endian */ |
218 | SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE, |
219 | /** Unsigned 16 bit CPU endian */ |
220 | SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE, |
221 | /** Signed 24 bit CPU endian */ |
222 | SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE, |
223 | /** Unsigned 24 bit CPU endian */ |
224 | SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE, |
225 | /** Signed 32 bit CPU endian */ |
226 | SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE, |
227 | /** Unsigned 32 bit CPU endian */ |
228 | SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE, |
229 | /** Float 32 bit CPU endian */ |
230 | SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE, |
231 | /** Float 64 bit CPU endian */ |
232 | SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE, |
233 | /** IEC-958 CPU Endian */ |
234 | SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE |
235 | #elif __BYTE_ORDER == __BIG_ENDIAN |
236 | /** Signed 16 bit CPU endian */ |
237 | SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE, |
238 | /** Unsigned 16 bit CPU endian */ |
239 | SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE, |
240 | /** Signed 24 bit CPU endian */ |
241 | SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE, |
242 | /** Unsigned 24 bit CPU endian */ |
243 | SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE, |
244 | /** Signed 32 bit CPU endian */ |
245 | SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE, |
246 | /** Unsigned 32 bit CPU endian */ |
247 | SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE, |
248 | /** Float 32 bit CPU endian */ |
249 | SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE, |
250 | /** Float 64 bit CPU endian */ |
251 | SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE, |
252 | /** IEC-958 CPU Endian */ |
253 | SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE |
254 | #else |
255 | #error "Unknown endian" |
256 | #endif |
257 | } snd_pcm_format_t; |
258 | |
259 | /** PCM sample subformat */ |
260 | typedef enum _snd_pcm_subformat { |
261 | /** Standard */ |
262 | SND_PCM_SUBFORMAT_STD = 0, |
263 | SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD |
264 | } snd_pcm_subformat_t; |
265 | |
266 | /** PCM state */ |
267 | typedef enum _snd_pcm_state { |
268 | /** Open */ |
269 | SND_PCM_STATE_OPEN = 0, |
270 | /** Setup installed */ |
271 | SND_PCM_STATE_SETUP, |
272 | /** Ready to start */ |
273 | SND_PCM_STATE_PREPARED, |
274 | /** Running */ |
275 | SND_PCM_STATE_RUNNING, |
276 | /** Stopped: underrun (playback) or overrun (capture) detected */ |
277 | SND_PCM_STATE_XRUN, |
278 | /** Draining: running (playback) or stopped (capture) */ |
279 | SND_PCM_STATE_DRAINING, |
280 | /** Paused */ |
281 | SND_PCM_STATE_PAUSED, |
282 | /** Hardware is suspended */ |
283 | SND_PCM_STATE_SUSPENDED, |
284 | /** Hardware is disconnected */ |
285 | SND_PCM_STATE_DISCONNECTED, |
286 | SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED |
287 | } snd_pcm_state_t; |
288 | |
289 | /** PCM start mode */ |
290 | typedef enum _snd_pcm_start { |
291 | /** Automatic start on data read/write */ |
292 | SND_PCM_START_DATA = 0, |
293 | /** Explicit start */ |
294 | SND_PCM_START_EXPLICIT, |
295 | SND_PCM_START_LAST = SND_PCM_START_EXPLICIT |
296 | } snd_pcm_start_t; |
297 | |
298 | /** PCM xrun mode */ |
299 | typedef enum _snd_pcm_xrun { |
300 | /** Xrun detection disabled */ |
301 | SND_PCM_XRUN_NONE = 0, |
302 | /** Stop on xrun detection */ |
303 | SND_PCM_XRUN_STOP, |
304 | SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP |
305 | } snd_pcm_xrun_t; |
306 | |
307 | /** PCM timestamp mode */ |
308 | typedef enum _snd_pcm_tstamp { |
309 | /** No timestamp */ |
310 | SND_PCM_TSTAMP_NONE = 0, |
311 | /** Update timestamp at every hardware position update */ |
312 | SND_PCM_TSTAMP_ENABLE, |
313 | /** Equivalent with #SND_PCM_TSTAMP_ENABLE, |
314 | * just for compatibility with older versions |
315 | */ |
316 | SND_PCM_TSTAMP_MMAP = SND_PCM_TSTAMP_ENABLE, |
317 | SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE |
318 | } snd_pcm_tstamp_t; |
319 | |
320 | /** Unsigned frames quantity */ |
321 | typedef unsigned long snd_pcm_uframes_t; |
322 | /** Signed frames quantity */ |
323 | typedef long snd_pcm_sframes_t; |
324 | |
325 | /** Non blocking mode (flag for open mode) \hideinitializer */ |
326 | #define SND_PCM_NONBLOCK 0x00000001 |
327 | /** Async notification (flag for open mode) \hideinitializer */ |
328 | #define SND_PCM_ASYNC 0x00000002 |
329 | /** In an abort state (internal, not allowed for open) */ |
330 | #define SND_PCM_ABORT 0x00008000 |
331 | /** Disable automatic (but not forced!) rate resamplinig */ |
332 | #define SND_PCM_NO_AUTO_RESAMPLE 0x00010000 |
333 | /** Disable automatic (but not forced!) channel conversion */ |
334 | #define SND_PCM_NO_AUTO_CHANNELS 0x00020000 |
335 | /** Disable automatic (but not forced!) format conversion */ |
336 | #define SND_PCM_NO_AUTO_FORMAT 0x00040000 |
337 | /** Disable soft volume control */ |
338 | #define SND_PCM_NO_SOFTVOL 0x00080000 |
339 | |
340 | /** PCM handle */ |
341 | typedef struct _snd_pcm snd_pcm_t; |
342 | |
343 | /** PCM type */ |
344 | enum _snd_pcm_type { |
345 | /** Kernel level PCM */ |
346 | SND_PCM_TYPE_HW = 0, |
347 | /** Hooked PCM */ |
348 | SND_PCM_TYPE_HOOKS, |
349 | /** One or more linked PCM with exclusive access to selected |
350 | channels */ |
351 | SND_PCM_TYPE_MULTI, |
352 | /** File writing plugin */ |
353 | SND_PCM_TYPE_FILE, |
354 | /** Null endpoint PCM */ |
355 | SND_PCM_TYPE_NULL, |
356 | /** Shared memory client PCM */ |
357 | SND_PCM_TYPE_SHM, |
358 | /** INET client PCM (not yet implemented) */ |
359 | SND_PCM_TYPE_INET, |
360 | /** Copying plugin */ |
361 | SND_PCM_TYPE_COPY, |
362 | /** Linear format conversion PCM */ |
363 | SND_PCM_TYPE_LINEAR, |
364 | /** A-Law format conversion PCM */ |
365 | SND_PCM_TYPE_ALAW, |
366 | /** Mu-Law format conversion PCM */ |
367 | SND_PCM_TYPE_MULAW, |
368 | /** IMA-ADPCM format conversion PCM */ |
369 | SND_PCM_TYPE_ADPCM, |
370 | /** Rate conversion PCM */ |
371 | SND_PCM_TYPE_RATE, |
372 | /** Attenuated static route PCM */ |
373 | SND_PCM_TYPE_ROUTE, |
374 | /** Format adjusted PCM */ |
375 | SND_PCM_TYPE_PLUG, |
376 | /** Sharing PCM */ |
377 | SND_PCM_TYPE_SHARE, |
378 | /** Meter plugin */ |
379 | SND_PCM_TYPE_METER, |
380 | /** Mixing PCM */ |
381 | SND_PCM_TYPE_MIX, |
382 | /** Attenuated dynamic route PCM (not yet implemented) */ |
383 | SND_PCM_TYPE_DROUTE, |
384 | /** Loopback server plugin (not yet implemented) */ |
385 | SND_PCM_TYPE_LBSERVER, |
386 | /** Linear Integer <-> Linear Float format conversion PCM */ |
387 | SND_PCM_TYPE_LINEAR_FLOAT, |
388 | /** LADSPA integration plugin */ |
389 | SND_PCM_TYPE_LADSPA, |
390 | /** Direct Mixing plugin */ |
391 | SND_PCM_TYPE_DMIX, |
392 | /** Jack Audio Connection Kit plugin */ |
393 | SND_PCM_TYPE_JACK, |
394 | /** Direct Snooping plugin */ |
395 | SND_PCM_TYPE_DSNOOP, |
396 | /** Direct Sharing plugin */ |
397 | SND_PCM_TYPE_DSHARE, |
398 | /** IEC958 subframe plugin */ |
399 | SND_PCM_TYPE_IEC958, |
400 | /** Soft volume plugin */ |
401 | SND_PCM_TYPE_SOFTVOL, |
402 | /** External I/O plugin */ |
403 | SND_PCM_TYPE_IOPLUG, |
404 | /** External filter plugin */ |
405 | SND_PCM_TYPE_EXTPLUG, |
406 | /** Mmap-emulation plugin */ |
407 | SND_PCM_TYPE_MMAP_EMUL, |
408 | SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL |
409 | }; |
410 | |
411 | /** PCM type */ |
412 | typedef enum _snd_pcm_type snd_pcm_type_t; |
413 | |
414 | /** PCM area specification */ |
415 | typedef struct _snd_pcm_channel_area { |
416 | /** base address of channel samples */ |
417 | void *addr; |
418 | /** offset to first sample in bits */ |
419 | unsigned int first; |
420 | /** samples distance in bits */ |
421 | unsigned int step; |
422 | } snd_pcm_channel_area_t; |
423 | |
424 | /** PCM synchronization ID */ |
425 | typedef union _snd_pcm_sync_id { |
426 | /** 8-bit ID */ |
427 | unsigned char id[16]; |
428 | /** 16-bit ID */ |
429 | unsigned short id16[8]; |
430 | /** 32-bit ID */ |
431 | unsigned int id32[4]; |
432 | } snd_pcm_sync_id_t; |
433 | |
434 | /** #SND_PCM_TYPE_METER scope handle */ |
435 | typedef struct _snd_pcm_scope snd_pcm_scope_t; |
436 | |
437 | int snd_pcm_open(snd_pcm_t **pcm, const char *name, |
438 | snd_pcm_stream_t stream, int mode); |
439 | int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, |
440 | snd_pcm_stream_t stream, int mode, |
441 | snd_config_t *lconf); |
442 | int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root, |
443 | const char *name, const char *orig_name, |
444 | snd_pcm_stream_t stream, int mode); |
445 | |
446 | int snd_pcm_close(snd_pcm_t *pcm); |
447 | const char *snd_pcm_name(snd_pcm_t *pcm); |
448 | snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm); |
449 | snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm); |
450 | int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm); |
451 | int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space); |
452 | int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); |
453 | int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock); |
454 | static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); } |
455 | int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, |
456 | snd_async_callback_t callback, void *private_data); |
457 | snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler); |
458 | int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info); |
459 | int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); |
460 | int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); |
461 | int snd_pcm_hw_free(snd_pcm_t *pcm); |
462 | int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params); |
463 | int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params); |
464 | int snd_pcm_prepare(snd_pcm_t *pcm); |
465 | int snd_pcm_reset(snd_pcm_t *pcm); |
466 | int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status); |
467 | int snd_pcm_start(snd_pcm_t *pcm); |
468 | int snd_pcm_drop(snd_pcm_t *pcm); |
469 | int snd_pcm_drain(snd_pcm_t *pcm); |
470 | int snd_pcm_pause(snd_pcm_t *pcm, int enable); |
471 | snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm); |
472 | int snd_pcm_hwsync(snd_pcm_t *pcm); |
473 | int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp); |
474 | int snd_pcm_resume(snd_pcm_t *pcm); |
475 | int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp); |
476 | snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm); |
477 | snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm); |
478 | int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp); |
479 | snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm); |
480 | snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames); |
481 | snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm); |
482 | snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames); |
483 | snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); |
484 | snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size); |
485 | snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); |
486 | snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); |
487 | int snd_pcm_wait(snd_pcm_t *pcm, int timeout); |
488 | |
489 | int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2); |
490 | int snd_pcm_unlink(snd_pcm_t *pcm); |
491 | |
492 | /** channel mapping API version number */ |
493 | #define SND_CHMAP_API_VERSION ((1 << 16) | (0 << 8) | 1) |
494 | |
495 | /** channel map list type */ |
496 | enum snd_pcm_chmap_type { |
497 | SND_CHMAP_TYPE_NONE = 0,/** unspecified channel position */ |
498 | SND_CHMAP_TYPE_FIXED, /** fixed channel position */ |
499 | SND_CHMAP_TYPE_VAR, /** freely swappable channel position */ |
500 | SND_CHMAP_TYPE_PAIRED, /** pair-wise swappable channel position */ |
501 | SND_CHMAP_TYPE_LAST = SND_CHMAP_TYPE_PAIRED, /** last entry */ |
502 | }; |
503 | |
504 | /** channel positions */ |
505 | enum snd_pcm_chmap_position { |
506 | SND_CHMAP_UNKNOWN = 0, /**< unspecified */ |
507 | SND_CHMAP_NA, /**< N/A, silent */ |
508 | SND_CHMAP_MONO, /**< mono stream */ |
509 | SND_CHMAP_FL, /**< front left */ |
510 | SND_CHMAP_FR, /**< front right */ |
511 | SND_CHMAP_RL, /**< rear left */ |
512 | SND_CHMAP_RR, /**< rear right */ |
513 | SND_CHMAP_FC, /**< front center */ |
514 | SND_CHMAP_LFE, /**< LFE */ |
515 | SND_CHMAP_SL, /**< side left */ |
516 | SND_CHMAP_SR, /**< side right */ |
517 | SND_CHMAP_RC, /**< rear center */ |
518 | SND_CHMAP_FLC, /**< front left center */ |
519 | SND_CHMAP_FRC, /**< front right center */ |
520 | SND_CHMAP_RLC, /**< rear left center */ |
521 | SND_CHMAP_RRC, /**< rear right center */ |
522 | SND_CHMAP_FLW, /**< front left wide */ |
523 | SND_CHMAP_FRW, /**< front right wide */ |
524 | SND_CHMAP_FLH, /**< front left high */ |
525 | SND_CHMAP_FCH, /**< front center high */ |
526 | SND_CHMAP_FRH, /**< front right high */ |
527 | SND_CHMAP_TC, /**< top center */ |
528 | SND_CHMAP_TFL, /**< top front left */ |
529 | SND_CHMAP_TFR, /**< top front right */ |
530 | SND_CHMAP_TFC, /**< top front center */ |
531 | SND_CHMAP_TRL, /**< top rear left */ |
532 | SND_CHMAP_TRR, /**< top rear right */ |
533 | SND_CHMAP_TRC, /**< top rear center */ |
534 | SND_CHMAP_TFLC, /**< top front left center */ |
535 | SND_CHMAP_TFRC, /**< top front right center */ |
536 | SND_CHMAP_TSL, /**< top side left */ |
537 | SND_CHMAP_TSR, /**< top side right */ |
538 | SND_CHMAP_LLFE, /**< left LFE */ |
539 | SND_CHMAP_RLFE, /**< right LFE */ |
540 | SND_CHMAP_BC, /**< bottom center */ |
541 | SND_CHMAP_BLC, /**< bottom left center */ |
542 | SND_CHMAP_BRC, /**< bottom right center */ |
543 | SND_CHMAP_LAST = SND_CHMAP_BRC, |
544 | }; |
545 | |
546 | /** bitmask for channel position */ |
547 | #define SND_CHMAP_POSITION_MASK 0xffff |
548 | |
549 | /** bit flag indicating the channel is phase inverted */ |
550 | #define SND_CHMAP_PHASE_INVERSE (0x01 << 16) |
551 | /** bit flag indicating the non-standard channel value */ |
552 | #define SND_CHMAP_DRIVER_SPEC (0x02 << 16) |
553 | |
554 | /** the channel map header */ |
555 | typedef struct snd_pcm_chmap { |
556 | unsigned int channels; /**< number of channels */ |
557 | unsigned int pos[0]; /**< channel position array */ |
558 | } snd_pcm_chmap_t; |
559 | |
560 | /** the header of array items returned from snd_pcm_query_chmaps() */ |
561 | typedef struct snd_pcm_chmap_query { |
562 | enum snd_pcm_chmap_type type; /**< channel map type */ |
563 | snd_pcm_chmap_t map; /**< available channel map */ |
564 | } snd_pcm_chmap_query_t; |
565 | |
566 | |
567 | snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm); |
568 | snd_pcm_chmap_query_t **snd_pcm_query_chmaps_from_hw(int card, int dev, |
569 | int subdev, |
570 | snd_pcm_stream_t stream); |
571 | void snd_pcm_free_chmaps(snd_pcm_chmap_query_t **maps); |
572 | snd_pcm_chmap_t *snd_pcm_get_chmap(snd_pcm_t *pcm); |
573 | int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map); |
574 | |
575 | const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val); |
576 | const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val); |
577 | const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val); |
578 | int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf); |
579 | unsigned int snd_pcm_chmap_from_string(const char *str); |
580 | snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str); |
581 | |
582 | //int snd_pcm_mixer_element(snd_pcm_t *pcm, snd_mixer_t *mixer, snd_mixer_elem_t **elem); |
583 | |
584 | /* |
585 | * application helpers - these functions are implemented on top |
586 | * of the basic API |
587 | */ |
588 | |
589 | int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent); |
590 | int snd_pcm_set_params(snd_pcm_t *pcm, |
591 | snd_pcm_format_t format, |
592 | snd_pcm_access_t access, |
593 | unsigned int channels, |
594 | unsigned int rate, |
595 | int soft_resample, |
596 | unsigned int latency); |
597 | int snd_pcm_get_params(snd_pcm_t *pcm, |
598 | snd_pcm_uframes_t *buffer_size, |
599 | snd_pcm_uframes_t *period_size); |
600 | |
601 | /** \} */ |
602 | |
603 | /** |
604 | * \defgroup PCM_Info Stream Information |
605 | * \ingroup PCM |
606 | * See the \ref pcm page for more details. |
607 | * \{ |
608 | */ |
609 | |
610 | size_t snd_pcm_info_sizeof(void); |
611 | /** \hideinitializer |
612 | * \brief allocate an invalid #snd_pcm_info_t using standard alloca |
613 | * \param ptr returned pointer |
614 | */ |
615 | #define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info) |
616 | int snd_pcm_info_malloc(snd_pcm_info_t **ptr); |
617 | void snd_pcm_info_free(snd_pcm_info_t *obj); |
618 | void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src); |
619 | unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj); |
620 | unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj); |
621 | snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj); |
622 | int snd_pcm_info_get_card(const snd_pcm_info_t *obj); |
623 | const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj); |
624 | const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj); |
625 | const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj); |
626 | snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj); |
627 | snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj); |
628 | unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj); |
629 | unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj); |
630 | snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj); |
631 | void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val); |
632 | void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val); |
633 | void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val); |
634 | |
635 | /** \} */ |
636 | |
637 | /** |
638 | * \defgroup PCM_HW_Params Hardware Parameters |
639 | * \ingroup PCM |
640 | * See the \ref pcm page for more details. |
641 | * \{ |
642 | */ |
643 | |
644 | int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); |
645 | |
646 | int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params); |
647 | int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params); |
648 | int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params); |
649 | int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params); |
650 | int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params); |
651 | int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params); |
652 | int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params); |
653 | int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params); |
654 | int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params); |
655 | int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params); |
656 | int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params); |
657 | int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params); |
658 | int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); |
659 | int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params, |
660 | unsigned int *rate_num, |
661 | unsigned int *rate_den); |
662 | int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params); |
663 | int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params); |
664 | |
665 | #if 0 |
666 | typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t; |
667 | |
668 | /* choices need to be sorted on ascending badness */ |
669 | typedef struct _snd_pcm_hw_strategy_simple_choices_list { |
670 | unsigned int value; |
671 | unsigned int badness; |
672 | } snd_pcm_hw_strategy_simple_choices_list_t; |
673 | |
674 | int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, |
675 | const snd_pcm_hw_strategy_t *strategy, |
676 | unsigned int badness_min, |
677 | unsigned int badness_max); |
678 | |
679 | void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy); |
680 | int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp, |
681 | unsigned int badness_min, |
682 | unsigned int badness_max); |
683 | int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm, |
684 | snd_pcm_hw_params_t *fail, |
685 | snd_pcm_hw_params_t *success, |
686 | unsigned int depth, |
687 | snd_output_t *out); |
688 | |
689 | #endif |
690 | |
691 | size_t snd_pcm_hw_params_sizeof(void); |
692 | /** \hideinitializer |
693 | * \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca |
694 | * \param ptr returned pointer |
695 | */ |
696 | #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params) |
697 | int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr); |
698 | void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj); |
699 | void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src); |
700 | |
701 | #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API) |
702 | |
703 | int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *_access); |
704 | int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access); |
705 | int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access); |
706 | int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access); |
707 | int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access); |
708 | int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); |
709 | int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); |
710 | |
711 | int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val); |
712 | int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); |
713 | int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); |
714 | int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); |
715 | int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); |
716 | int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); |
717 | void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); |
718 | |
719 | int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); |
720 | int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); |
721 | int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); |
722 | int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); |
723 | int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); |
724 | int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); |
725 | void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); |
726 | |
727 | int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val); |
728 | int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val); |
729 | int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val); |
730 | int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); |
731 | int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); |
732 | int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
733 | int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
734 | int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max); |
735 | int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
736 | int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
737 | int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
738 | |
739 | int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
740 | int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
741 | int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
742 | int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
743 | int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
744 | int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
745 | int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
746 | 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); |
747 | int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
748 | int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
749 | int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
750 | int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); |
751 | int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
752 | int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); |
753 | int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
754 | int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); |
755 | int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); |
756 | |
757 | int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
758 | int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
759 | int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
760 | int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
761 | int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
762 | int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
763 | int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
764 | 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); |
765 | int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
766 | int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
767 | int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
768 | |
769 | int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); |
770 | int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); |
771 | int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); |
772 | 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); |
773 | 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); |
774 | 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); |
775 | 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); |
776 | 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); |
777 | 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); |
778 | 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); |
779 | 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); |
780 | int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); |
781 | |
782 | int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
783 | int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
784 | int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
785 | int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
786 | int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
787 | int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
788 | int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
789 | 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); |
790 | int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
791 | int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
792 | int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
793 | int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); |
794 | |
795 | int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
796 | int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
797 | int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
798 | int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
799 | int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); |
800 | int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
801 | int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
802 | 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); |
803 | int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
804 | int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
805 | int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); |
806 | |
807 | int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
808 | int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
809 | int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
810 | int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); |
811 | int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); |
812 | int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
813 | int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
814 | 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); |
815 | int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
816 | int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
817 | int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
818 | |
819 | #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */ |
820 | |
821 | int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); |
822 | |
823 | /** \} */ |
824 | |
825 | /** |
826 | * \defgroup PCM_SW_Params Software Parameters |
827 | * \ingroup PCM |
828 | * See the \ref pcm page for more details. |
829 | * \{ |
830 | */ |
831 | |
832 | size_t snd_pcm_sw_params_sizeof(void); |
833 | /** \hideinitializer |
834 | * \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca |
835 | * \param ptr returned pointer |
836 | */ |
837 | #define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params) |
838 | int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr); |
839 | void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj); |
840 | void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src); |
841 | int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); |
842 | |
843 | #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API) |
844 | |
845 | int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val); |
846 | int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val); |
847 | int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); |
848 | int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); |
849 | int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val); |
850 | int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val); |
851 | int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); |
852 | int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val); |
853 | int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); |
854 | int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); |
855 | int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); |
856 | int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); |
857 | int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); |
858 | int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); |
859 | |
860 | #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */ |
861 | |
862 | /** \} */ |
863 | |
864 | /* include old API */ |
865 | #ifndef ALSA_LIBRARY_BUILD |
866 | #if defined(ALSA_PCM_OLD_HW_PARAMS_API) || defined(ALSA_PCM_OLD_SW_PARAMS_API) |
867 | #include "pcm_old.h" |
868 | #endif |
869 | #endif |
870 | |
871 | /** |
872 | * \defgroup PCM_Access Access Mask Functions |
873 | * \ingroup PCM |
874 | * See the \ref pcm page for more details. |
875 | * \{ |
876 | */ |
877 | |
878 | size_t snd_pcm_access_mask_sizeof(void); |
879 | /** \hideinitializer |
880 | * \brief allocate an empty #snd_pcm_access_mask_t using standard alloca |
881 | * \param ptr returned pointer |
882 | */ |
883 | #define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask) |
884 | int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr); |
885 | void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj); |
886 | void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src); |
887 | void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask); |
888 | void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask); |
889 | int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val); |
890 | int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask); |
891 | void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val); |
892 | void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val); |
893 | |
894 | /** \} */ |
895 | |
896 | /** |
897 | * \defgroup PCM_Format Format Mask Functions |
898 | * \ingroup PCM |
899 | * See the \ref pcm page for more details. |
900 | * \{ |
901 | */ |
902 | |
903 | size_t snd_pcm_format_mask_sizeof(void); |
904 | /** \hideinitializer |
905 | * \brief allocate an empty #snd_pcm_format_mask_t using standard alloca |
906 | * \param ptr returned pointer |
907 | */ |
908 | #define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask) |
909 | int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr); |
910 | void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj); |
911 | void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src); |
912 | void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask); |
913 | void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask); |
914 | int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val); |
915 | int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask); |
916 | void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val); |
917 | void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val); |
918 | |
919 | /** \} */ |
920 | |
921 | /** |
922 | * \defgroup PCM_SubFormat Subformat Mask Functions |
923 | * \ingroup PCM |
924 | * See the \ref pcm page for more details. |
925 | * \{ |
926 | */ |
927 | |
928 | size_t snd_pcm_subformat_mask_sizeof(void); |
929 | /** \hideinitializer |
930 | * \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca |
931 | * \param ptr returned pointer |
932 | */ |
933 | #define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask) |
934 | int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr); |
935 | void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj); |
936 | void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src); |
937 | void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask); |
938 | void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask); |
939 | int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); |
940 | int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask); |
941 | void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); |
942 | void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); |
943 | |
944 | /** \} */ |
945 | |
946 | /** |
947 | * \defgroup PCM_Status Status Functions |
948 | * \ingroup PCM |
949 | * See the \ref pcm page for more details. |
950 | * \{ |
951 | */ |
952 | |
953 | size_t snd_pcm_status_sizeof(void); |
954 | /** \hideinitializer |
955 | * \brief allocate an invalid #snd_pcm_status_t using standard alloca |
956 | * \param ptr returned pointer |
957 | */ |
958 | #define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status) |
959 | int snd_pcm_status_malloc(snd_pcm_status_t **ptr); |
960 | void snd_pcm_status_free(snd_pcm_status_t *obj); |
961 | void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src); |
962 | snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj); |
963 | void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr); |
964 | void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); |
965 | void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr); |
966 | void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); |
967 | void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); |
968 | snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj); |
969 | snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj); |
970 | snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj); |
971 | snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj); |
972 | |
973 | /** \} */ |
974 | |
975 | /** |
976 | * \defgroup PCM_Description Description Functions |
977 | * \ingroup PCM |
978 | * See the \ref pcm page for more details. |
979 | * \{ |
980 | */ |
981 | |
982 | const char *snd_pcm_type_name(snd_pcm_type_t type); |
983 | const char *snd_pcm_stream_name(const snd_pcm_stream_t stream); |
984 | const char *snd_pcm_access_name(const snd_pcm_access_t _access); |
985 | const char *snd_pcm_format_name(const snd_pcm_format_t format); |
986 | const char *snd_pcm_format_description(const snd_pcm_format_t format); |
987 | const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat); |
988 | const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat); |
989 | snd_pcm_format_t snd_pcm_format_value(const char* name); |
990 | const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode); |
991 | const char *snd_pcm_state_name(const snd_pcm_state_t state); |
992 | |
993 | /** \} */ |
994 | |
995 | /** |
996 | * \defgroup PCM_Dump Debug Functions |
997 | * \ingroup PCM |
998 | * See the \ref pcm page for more details. |
999 | * \{ |
1000 | */ |
1001 | |
1002 | int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out); |
1003 | int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out); |
1004 | int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out); |
1005 | int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out); |
1006 | int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out); |
1007 | int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out); |
1008 | int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out); |
1009 | |
1010 | /** \} */ |
1011 | |
1012 | /** |
1013 | * \defgroup PCM_Direct Direct Access (MMAP) Functions |
1014 | * \ingroup PCM |
1015 | * See the \ref pcm page for more details. |
1016 | * \{ |
1017 | */ |
1018 | |
1019 | int snd_pcm_mmap_begin(snd_pcm_t *pcm, |
1020 | const snd_pcm_channel_area_t **areas, |
1021 | snd_pcm_uframes_t *offset, |
1022 | snd_pcm_uframes_t *frames); |
1023 | snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm, |
1024 | snd_pcm_uframes_t offset, |
1025 | snd_pcm_uframes_t frames); |
1026 | snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); |
1027 | snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size); |
1028 | snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); |
1029 | snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); |
1030 | |
1031 | /** \} */ |
1032 | |
1033 | /** |
1034 | * \defgroup PCM_Helpers Helper Functions |
1035 | * \ingroup PCM |
1036 | * See the \ref pcm page for more details. |
1037 | * \{ |
1038 | */ |
1039 | |
1040 | int snd_pcm_format_signed(snd_pcm_format_t format); |
1041 | int snd_pcm_format_unsigned(snd_pcm_format_t format); |
1042 | int snd_pcm_format_linear(snd_pcm_format_t format); |
1043 | int snd_pcm_format_float(snd_pcm_format_t format); |
1044 | int snd_pcm_format_little_endian(snd_pcm_format_t format); |
1045 | int snd_pcm_format_big_endian(snd_pcm_format_t format); |
1046 | int snd_pcm_format_cpu_endian(snd_pcm_format_t format); |
1047 | int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ |
1048 | int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ |
1049 | snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian); |
1050 | ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); |
1051 | u_int8_t snd_pcm_format_silence(snd_pcm_format_t format); |
1052 | u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format); |
1053 | u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format); |
1054 | u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format); |
1055 | int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples); |
1056 | |
1057 | snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes); |
1058 | ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames); |
1059 | long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes); |
1060 | ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples); |
1061 | |
1062 | int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset, |
1063 | unsigned int samples, snd_pcm_format_t format); |
1064 | int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, |
1065 | unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format); |
1066 | int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset, |
1067 | const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset, |
1068 | unsigned int samples, snd_pcm_format_t format); |
1069 | int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, |
1070 | const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset, |
1071 | unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format); |
1072 | |
1073 | /** \} */ |
1074 | |
1075 | /** |
1076 | * \defgroup PCM_Hook Hook Extension |
1077 | * \ingroup PCM |
1078 | * See the \ref pcm page for more details. |
1079 | * \{ |
1080 | */ |
1081 | |
1082 | /** type of pcm hook */ |
1083 | typedef enum _snd_pcm_hook_type { |
1084 | SND_PCM_HOOK_TYPE_HW_PARAMS = 0, |
1085 | SND_PCM_HOOK_TYPE_HW_FREE, |
1086 | SND_PCM_HOOK_TYPE_CLOSE, |
1087 | SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE |
1088 | } snd_pcm_hook_type_t; |
1089 | |
1090 | /** PCM hook container */ |
1091 | typedef struct _snd_pcm_hook snd_pcm_hook_t; |
1092 | /** PCM hook callback function */ |
1093 | typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook); |
1094 | snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook); |
1095 | void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook); |
1096 | void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data); |
1097 | int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm, |
1098 | snd_pcm_hook_type_t type, |
1099 | snd_pcm_hook_func_t func, void *private_data); |
1100 | int snd_pcm_hook_remove(snd_pcm_hook_t *hook); |
1101 | |
1102 | /** \} */ |
1103 | |
1104 | /** |
1105 | * \defgroup PCM_Scope Scope Plugin Extension |
1106 | * \ingroup PCM |
1107 | * See the \ref pcm page for more details. |
1108 | * \{ |
1109 | */ |
1110 | |
1111 | /** #SND_PCM_TYPE_METER scope functions */ |
1112 | typedef struct _snd_pcm_scope_ops { |
1113 | /** \brief Enable and prepare it using current params |
1114 | * \param scope scope handle |
1115 | */ |
1116 | int (*enable)(snd_pcm_scope_t *scope); |
1117 | /** \brief Disable |
1118 | * \param scope scope handle |
1119 | */ |
1120 | void (*disable)(snd_pcm_scope_t *scope); |
1121 | /** \brief PCM has been started |
1122 | * \param scope scope handle |
1123 | */ |
1124 | void (*start)(snd_pcm_scope_t *scope); |
1125 | /** \brief PCM has been stopped |
1126 | * \param scope scope handle |
1127 | */ |
1128 | void (*stop)(snd_pcm_scope_t *scope); |
1129 | /** \brief New frames are present |
1130 | * \param scope scope handle |
1131 | */ |
1132 | void (*update)(snd_pcm_scope_t *scope); |
1133 | /** \brief Reset status |
1134 | * \param scope scope handle |
1135 | */ |
1136 | void (*reset)(snd_pcm_scope_t *scope); |
1137 | /** \brief PCM is closing |
1138 | * \param scope scope handle |
1139 | */ |
1140 | void (*close)(snd_pcm_scope_t *scope); |
1141 | } snd_pcm_scope_ops_t; |
1142 | |
1143 | snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm); |
1144 | unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm); |
1145 | unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm); |
1146 | snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm); |
1147 | snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm); |
1148 | int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope); |
1149 | snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name); |
1150 | int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr); |
1151 | void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, |
1152 | const snd_pcm_scope_ops_t *val); |
1153 | void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val); |
1154 | const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope); |
1155 | void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope); |
1156 | void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val); |
1157 | int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name, |
1158 | snd_pcm_scope_t **scopep); |
1159 | int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope, |
1160 | unsigned int channel); |
1161 | |
1162 | /** \} */ |
1163 | |
1164 | /** |
1165 | * \defgroup PCM_Simple Simple setup functions |
1166 | * \ingroup PCM |
1167 | * See the \ref pcm page for more details. |
1168 | * \{ |
1169 | */ |
1170 | |
1171 | /** Simple PCM latency type */ |
1172 | typedef enum _snd_spcm_latency { |
1173 | /** standard latency - for standard playback or capture |
1174 | (estimated latency in one direction 350ms) */ |
1175 | SND_SPCM_LATENCY_STANDARD = 0, |
1176 | /** medium latency - software phones etc. |
1177 | (estimated latency in one direction maximally 25ms */ |
1178 | SND_SPCM_LATENCY_MEDIUM, |
1179 | /** realtime latency - realtime applications (effect processors etc.) |
1180 | (estimated latency in one direction 5ms and better) */ |
1181 | SND_SPCM_LATENCY_REALTIME |
1182 | } snd_spcm_latency_t; |
1183 | |
1184 | /** Simple PCM xrun type */ |
1185 | typedef enum _snd_spcm_xrun_type { |
1186 | /** driver / library will ignore all xruns, the stream runs forever */ |
1187 | SND_SPCM_XRUN_IGNORE = 0, |
1188 | /** driver / library stops the stream when an xrun occurs */ |
1189 | SND_SPCM_XRUN_STOP |
1190 | } snd_spcm_xrun_type_t; |
1191 | |
1192 | /** Simple PCM duplex type */ |
1193 | typedef enum _snd_spcm_duplex_type { |
1194 | /** liberal duplex - the buffer and period sizes might not match */ |
1195 | SND_SPCM_DUPLEX_LIBERAL = 0, |
1196 | /** pedantic duplex - the buffer and period sizes MUST match */ |
1197 | SND_SPCM_DUPLEX_PEDANTIC |
1198 | } snd_spcm_duplex_type_t; |
1199 | |
1200 | int snd_spcm_init(snd_pcm_t *pcm, |
1201 | unsigned int rate, |
1202 | unsigned int channels, |
1203 | snd_pcm_format_t format, |
1204 | snd_pcm_subformat_t subformat, |
1205 | snd_spcm_latency_t latency, |
1206 | snd_pcm_access_t _access, |
1207 | snd_spcm_xrun_type_t xrun_type); |
1208 | |
1209 | int snd_spcm_init_duplex(snd_pcm_t *playback_pcm, |
1210 | snd_pcm_t *capture_pcm, |
1211 | unsigned int rate, |
1212 | unsigned int channels, |
1213 | snd_pcm_format_t format, |
1214 | snd_pcm_subformat_t subformat, |
1215 | snd_spcm_latency_t latency, |
1216 | snd_pcm_access_t _access, |
1217 | snd_spcm_xrun_type_t xrun_type, |
1218 | snd_spcm_duplex_type_t duplex_type); |
1219 | |
1220 | int snd_spcm_init_get_params(snd_pcm_t *pcm, |
1221 | unsigned int *rate, |
1222 | snd_pcm_uframes_t *buffer_size, |
1223 | snd_pcm_uframes_t *period_size); |
1224 | |
1225 | /** \} */ |
1226 | |
1227 | /** |
1228 | * \defgroup PCM_Deprecated Deprecated Functions |
1229 | * \ingroup PCM |
1230 | * See the \ref pcm page for more details. |
1231 | * \{ |
1232 | */ |
1233 | |
1234 | /* Deprecated functions, for compatibility */ |
1235 | const char *snd_pcm_start_mode_name(snd_pcm_start_t mode) __attribute__((deprecated)); |
1236 | const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode) __attribute__((deprecated)); |
1237 | int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val) __attribute__((deprecated)); |
1238 | snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated)); |
1239 | int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val) __attribute__((deprecated)); |
1240 | snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated)); |
1241 | #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API) |
1242 | int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) __attribute__((deprecated)); |
1243 | int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated)); |
1244 | int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated)); |
1245 | int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated)); |
1246 | #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */ |
1247 | #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API) |
1248 | int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); |
1249 | int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); |
1250 | int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); |
1251 | int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated)); |
1252 | int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated)); |
1253 | int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); |
1254 | int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); |
1255 | 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) __attribute__((deprecated)); |
1256 | 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__((deprecated)); |
1257 | 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__((deprecated)); |
1258 | 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__((deprecated)); |
1259 | #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */ |
1260 | |
1261 | /** \} */ |
1262 | |
1263 | #ifdef __cplusplus |
1264 | } |
1265 | #endif |
1266 | |
1267 | #endif /* __ALSA_PCM_H */ |
1268 | |