ALSA project - the C library reference
|
00001 00012 /* 00013 * This library is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU Lesser General Public License as 00015 * published by the Free Software Foundation; either version 2.1 of 00016 * the License, or (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU Lesser General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public 00024 * License along with this library; if not, write to the Free Software 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 * 00027 */ 00028 00029 #ifndef __ALSA_PCM_H 00030 #define __ALSA_PCM_H 00031 00032 #ifdef __cplusplus 00033 extern "C" { 00034 #endif 00035 00043 #define SND_PCM_DLSYM_VERSION _dlsym_pcm_001 00044 00046 typedef struct _snd_pcm_info snd_pcm_info_t; 00047 00062 typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t; 00063 00065 typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t; 00067 typedef struct _snd_pcm_status snd_pcm_status_t; 00069 typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t; 00071 typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t; 00073 typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t; 00074 00076 typedef enum _snd_pcm_class { 00079 SND_PCM_CLASS_GENERIC = 0, 00081 SND_PCM_CLASS_MULTI, 00083 SND_PCM_CLASS_MODEM, 00085 SND_PCM_CLASS_DIGITIZER, 00086 SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER 00087 } snd_pcm_class_t; 00088 00090 typedef enum _snd_pcm_subclass { 00092 SND_PCM_SUBCLASS_GENERIC_MIX = 0, 00094 SND_PCM_SUBCLASS_MULTI_MIX, 00095 SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX 00096 } snd_pcm_subclass_t; 00097 00099 typedef enum _snd_pcm_stream { 00101 SND_PCM_STREAM_PLAYBACK = 0, 00103 SND_PCM_STREAM_CAPTURE, 00104 SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE 00105 } snd_pcm_stream_t; 00106 00108 typedef enum _snd_pcm_access { 00110 SND_PCM_ACCESS_MMAP_INTERLEAVED = 0, 00112 SND_PCM_ACCESS_MMAP_NONINTERLEAVED, 00114 SND_PCM_ACCESS_MMAP_COMPLEX, 00116 SND_PCM_ACCESS_RW_INTERLEAVED, 00118 SND_PCM_ACCESS_RW_NONINTERLEAVED, 00119 SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED 00120 } snd_pcm_access_t; 00121 00123 typedef enum _snd_pcm_format { 00125 SND_PCM_FORMAT_UNKNOWN = -1, 00127 SND_PCM_FORMAT_S8 = 0, 00129 SND_PCM_FORMAT_U8, 00131 SND_PCM_FORMAT_S16_LE, 00133 SND_PCM_FORMAT_S16_BE, 00135 SND_PCM_FORMAT_U16_LE, 00137 SND_PCM_FORMAT_U16_BE, 00139 SND_PCM_FORMAT_S24_LE, 00141 SND_PCM_FORMAT_S24_BE, 00143 SND_PCM_FORMAT_U24_LE, 00145 SND_PCM_FORMAT_U24_BE, 00147 SND_PCM_FORMAT_S32_LE, 00149 SND_PCM_FORMAT_S32_BE, 00151 SND_PCM_FORMAT_U32_LE, 00153 SND_PCM_FORMAT_U32_BE, 00155 SND_PCM_FORMAT_FLOAT_LE, 00157 SND_PCM_FORMAT_FLOAT_BE, 00159 SND_PCM_FORMAT_FLOAT64_LE, 00161 SND_PCM_FORMAT_FLOAT64_BE, 00163 SND_PCM_FORMAT_IEC958_SUBFRAME_LE, 00165 SND_PCM_FORMAT_IEC958_SUBFRAME_BE, 00167 SND_PCM_FORMAT_MU_LAW, 00169 SND_PCM_FORMAT_A_LAW, 00171 SND_PCM_FORMAT_IMA_ADPCM, 00173 SND_PCM_FORMAT_MPEG, 00175 SND_PCM_FORMAT_GSM, 00177 SND_PCM_FORMAT_SPECIAL = 31, 00179 SND_PCM_FORMAT_S24_3LE = 32, 00181 SND_PCM_FORMAT_S24_3BE, 00183 SND_PCM_FORMAT_U24_3LE, 00185 SND_PCM_FORMAT_U24_3BE, 00187 SND_PCM_FORMAT_S20_3LE, 00189 SND_PCM_FORMAT_S20_3BE, 00191 SND_PCM_FORMAT_U20_3LE, 00193 SND_PCM_FORMAT_U20_3BE, 00195 SND_PCM_FORMAT_S18_3LE, 00197 SND_PCM_FORMAT_S18_3BE, 00199 SND_PCM_FORMAT_U18_3LE, 00201 SND_PCM_FORMAT_U18_3BE, 00202 /* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */ 00203 SND_PCM_FORMAT_G723_24, 00204 /* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */ 00205 SND_PCM_FORMAT_G723_24_1B, 00206 /* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */ 00207 SND_PCM_FORMAT_G723_40, 00208 /* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */ 00209 SND_PCM_FORMAT_G723_40_1B, 00210 /* Direct Stream Digital (DSD) in 1-byte samples (x8) */ 00211 SND_PCM_FORMAT_DSD_U8, 00212 /* Direct Stream Digital (DSD) in 2-byte samples (x16) */ 00213 SND_PCM_FORMAT_DSD_U16_LE, 00214 /* Direct Stream Digital (DSD) in 4-byte samples (x32) */ 00215 SND_PCM_FORMAT_DSD_U32_LE, 00216 /* Direct Stream Digital (DSD) in 2-byte samples (x16) */ 00217 SND_PCM_FORMAT_DSD_U16_BE, 00218 /* Direct Stream Digital (DSD) in 4-byte samples (x32) */ 00219 SND_PCM_FORMAT_DSD_U32_BE, 00220 SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE, 00221 00222 #if __BYTE_ORDER == __LITTLE_ENDIAN 00223 00224 SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE, 00226 SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE, 00228 SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE, 00230 SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE, 00232 SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE, 00234 SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE, 00236 SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE, 00238 SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE, 00240 SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE 00241 #elif __BYTE_ORDER == __BIG_ENDIAN 00242 00243 SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE, 00245 SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE, 00247 SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE, 00249 SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE, 00251 SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE, 00253 SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE, 00255 SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE, 00257 SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE, 00259 SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE 00260 #else 00261 #error "Unknown endian" 00262 #endif 00263 } snd_pcm_format_t; 00264 00266 typedef enum _snd_pcm_subformat { 00268 SND_PCM_SUBFORMAT_STD = 0, 00269 SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD 00270 } snd_pcm_subformat_t; 00271 00273 typedef enum _snd_pcm_state { 00275 SND_PCM_STATE_OPEN = 0, 00277 SND_PCM_STATE_SETUP, 00279 SND_PCM_STATE_PREPARED, 00281 SND_PCM_STATE_RUNNING, 00283 SND_PCM_STATE_XRUN, 00285 SND_PCM_STATE_DRAINING, 00287 SND_PCM_STATE_PAUSED, 00289 SND_PCM_STATE_SUSPENDED, 00291 SND_PCM_STATE_DISCONNECTED, 00292 SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED 00293 } snd_pcm_state_t; 00294 00296 typedef enum _snd_pcm_start { 00298 SND_PCM_START_DATA = 0, 00300 SND_PCM_START_EXPLICIT, 00301 SND_PCM_START_LAST = SND_PCM_START_EXPLICIT 00302 } snd_pcm_start_t; 00303 00305 typedef enum _snd_pcm_xrun { 00307 SND_PCM_XRUN_NONE = 0, 00309 SND_PCM_XRUN_STOP, 00310 SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP 00311 } snd_pcm_xrun_t; 00312 00314 typedef enum _snd_pcm_tstamp { 00316 SND_PCM_TSTAMP_NONE = 0, 00318 SND_PCM_TSTAMP_ENABLE, 00322 SND_PCM_TSTAMP_MMAP = SND_PCM_TSTAMP_ENABLE, 00323 SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE 00324 } snd_pcm_tstamp_t; 00325 00326 typedef enum _snd_pcm_tstamp_type { 00327 SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, 00328 SND_PCM_TSTAMP_TYPE_MONOTONIC, 00329 SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, 00330 SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, 00331 } snd_pcm_tstamp_type_t; 00332 00333 typedef struct _snd_pcm_audio_tstamp_config { 00334 /* 5 of max 16 bits used */ 00335 unsigned int type_requested:4; 00336 unsigned int report_delay:1; /* add total delay to A/D or D/A */ 00337 } snd_pcm_audio_tstamp_config_t; 00338 00339 typedef struct _snd_pcm_audio_tstamp_report { 00340 /* 6 of max 16 bits used for bit-fields */ 00341 00342 /* for backwards compatibility */ 00343 unsigned int valid:1; 00344 00345 /* actual type if hardware could not support requested timestamp */ 00346 unsigned int actual_type:4; 00347 00348 /* accuracy represented in ns units */ 00349 unsigned int accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */ 00350 unsigned int accuracy; /* up to 4.29s, will be packed in separate field */ 00351 } snd_pcm_audio_tstamp_report_t; 00352 00354 typedef unsigned long snd_pcm_uframes_t; 00356 typedef long snd_pcm_sframes_t; 00357 00359 #define SND_PCM_NONBLOCK 0x00000001 00360 00361 #define SND_PCM_ASYNC 0x00000002 00362 00363 #define SND_PCM_ABORT 0x00008000 00364 00365 #define SND_PCM_NO_AUTO_RESAMPLE 0x00010000 00366 00367 #define SND_PCM_NO_AUTO_CHANNELS 0x00020000 00368 00369 #define SND_PCM_NO_AUTO_FORMAT 0x00040000 00370 00371 #define SND_PCM_NO_SOFTVOL 0x00080000 00372 00374 typedef struct _snd_pcm snd_pcm_t; 00375 00377 enum _snd_pcm_type { 00379 SND_PCM_TYPE_HW = 0, 00381 SND_PCM_TYPE_HOOKS, 00384 SND_PCM_TYPE_MULTI, 00386 SND_PCM_TYPE_FILE, 00388 SND_PCM_TYPE_NULL, 00390 SND_PCM_TYPE_SHM, 00392 SND_PCM_TYPE_INET, 00394 SND_PCM_TYPE_COPY, 00396 SND_PCM_TYPE_LINEAR, 00398 SND_PCM_TYPE_ALAW, 00400 SND_PCM_TYPE_MULAW, 00402 SND_PCM_TYPE_ADPCM, 00404 SND_PCM_TYPE_RATE, 00406 SND_PCM_TYPE_ROUTE, 00408 SND_PCM_TYPE_PLUG, 00410 SND_PCM_TYPE_SHARE, 00412 SND_PCM_TYPE_METER, 00414 SND_PCM_TYPE_MIX, 00416 SND_PCM_TYPE_DROUTE, 00418 SND_PCM_TYPE_LBSERVER, 00420 SND_PCM_TYPE_LINEAR_FLOAT, 00422 SND_PCM_TYPE_LADSPA, 00424 SND_PCM_TYPE_DMIX, 00426 SND_PCM_TYPE_JACK, 00428 SND_PCM_TYPE_DSNOOP, 00430 SND_PCM_TYPE_DSHARE, 00432 SND_PCM_TYPE_IEC958, 00434 SND_PCM_TYPE_SOFTVOL, 00436 SND_PCM_TYPE_IOPLUG, 00438 SND_PCM_TYPE_EXTPLUG, 00440 SND_PCM_TYPE_MMAP_EMUL, 00441 SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL 00442 }; 00443 00445 typedef enum _snd_pcm_type snd_pcm_type_t; 00446 00448 typedef struct _snd_pcm_channel_area { 00450 void *addr; 00452 unsigned int first; 00454 unsigned int step; 00455 } snd_pcm_channel_area_t; 00456 00458 typedef union _snd_pcm_sync_id { 00460 unsigned char id[16]; 00462 unsigned short id16[8]; 00464 unsigned int id32[4]; 00465 } snd_pcm_sync_id_t; 00466 00468 typedef struct _snd_pcm_scope snd_pcm_scope_t; 00469 00470 int snd_pcm_open(snd_pcm_t **pcm, const char *name, 00471 snd_pcm_stream_t stream, int mode); 00472 int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, 00473 snd_pcm_stream_t stream, int mode, 00474 snd_config_t *lconf); 00475 int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root, 00476 const char *name, const char *orig_name, 00477 snd_pcm_stream_t stream, int mode); 00478 00479 int snd_pcm_close(snd_pcm_t *pcm); 00480 const char *snd_pcm_name(snd_pcm_t *pcm); 00481 snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm); 00482 snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm); 00483 int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm); 00484 int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space); 00485 int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); 00486 int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock); 00487 static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); } 00488 int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, 00489 snd_async_callback_t callback, void *private_data); 00490 snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler); 00491 int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info); 00492 int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); 00493 int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); 00494 int snd_pcm_hw_free(snd_pcm_t *pcm); 00495 int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params); 00496 int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params); 00497 int snd_pcm_prepare(snd_pcm_t *pcm); 00498 int snd_pcm_reset(snd_pcm_t *pcm); 00499 int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status); 00500 int snd_pcm_start(snd_pcm_t *pcm); 00501 int snd_pcm_drop(snd_pcm_t *pcm); 00502 int snd_pcm_drain(snd_pcm_t *pcm); 00503 int snd_pcm_pause(snd_pcm_t *pcm, int enable); 00504 snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm); 00505 int snd_pcm_hwsync(snd_pcm_t *pcm); 00506 int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp); 00507 int snd_pcm_resume(snd_pcm_t *pcm); 00508 int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp); 00509 snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm); 00510 snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm); 00511 int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp); 00512 snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm); 00513 snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames); 00514 snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm); 00515 snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames); 00516 snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); 00517 snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size); 00518 snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); 00519 snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); 00520 int snd_pcm_wait(snd_pcm_t *pcm, int timeout); 00521 00522 int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2); 00523 int snd_pcm_unlink(snd_pcm_t *pcm); 00524 00526 #define SND_CHMAP_API_VERSION ((1 << 16) | (0 << 8) | 1) 00527 00529 enum snd_pcm_chmap_type { 00530 SND_CHMAP_TYPE_NONE = 0, 00531 SND_CHMAP_TYPE_FIXED, 00532 SND_CHMAP_TYPE_VAR, 00533 SND_CHMAP_TYPE_PAIRED, 00534 SND_CHMAP_TYPE_LAST = SND_CHMAP_TYPE_PAIRED, 00535 }; 00536 00538 enum snd_pcm_chmap_position { 00539 SND_CHMAP_UNKNOWN = 0, 00540 SND_CHMAP_NA, 00541 SND_CHMAP_MONO, 00542 SND_CHMAP_FL, 00543 SND_CHMAP_FR, 00544 SND_CHMAP_RL, 00545 SND_CHMAP_RR, 00546 SND_CHMAP_FC, 00547 SND_CHMAP_LFE, 00548 SND_CHMAP_SL, 00549 SND_CHMAP_SR, 00550 SND_CHMAP_RC, 00551 SND_CHMAP_FLC, 00552 SND_CHMAP_FRC, 00553 SND_CHMAP_RLC, 00554 SND_CHMAP_RRC, 00555 SND_CHMAP_FLW, 00556 SND_CHMAP_FRW, 00557 SND_CHMAP_FLH, 00558 SND_CHMAP_FCH, 00559 SND_CHMAP_FRH, 00560 SND_CHMAP_TC, 00561 SND_CHMAP_TFL, 00562 SND_CHMAP_TFR, 00563 SND_CHMAP_TFC, 00564 SND_CHMAP_TRL, 00565 SND_CHMAP_TRR, 00566 SND_CHMAP_TRC, 00567 SND_CHMAP_TFLC, 00568 SND_CHMAP_TFRC, 00569 SND_CHMAP_TSL, 00570 SND_CHMAP_TSR, 00571 SND_CHMAP_LLFE, 00572 SND_CHMAP_RLFE, 00573 SND_CHMAP_BC, 00574 SND_CHMAP_BLC, 00575 SND_CHMAP_BRC, 00576 SND_CHMAP_LAST = SND_CHMAP_BRC, 00577 }; 00578 00580 #define SND_CHMAP_POSITION_MASK 0xffff 00581 00583 #define SND_CHMAP_PHASE_INVERSE (0x01 << 16) 00584 00585 #define SND_CHMAP_DRIVER_SPEC (0x02 << 16) 00586 00588 typedef struct snd_pcm_chmap { 00589 unsigned int channels; 00590 unsigned int pos[0]; 00591 } snd_pcm_chmap_t; 00592 00594 typedef struct snd_pcm_chmap_query { 00595 enum snd_pcm_chmap_type type; 00596 snd_pcm_chmap_t map; 00597 } snd_pcm_chmap_query_t; 00598 00599 00600 snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm); 00601 snd_pcm_chmap_query_t **snd_pcm_query_chmaps_from_hw(int card, int dev, 00602 int subdev, 00603 snd_pcm_stream_t stream); 00604 void snd_pcm_free_chmaps(snd_pcm_chmap_query_t **maps); 00605 snd_pcm_chmap_t *snd_pcm_get_chmap(snd_pcm_t *pcm); 00606 int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map); 00607 00608 const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val); 00609 const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val); 00610 const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val); 00611 int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf); 00612 unsigned int snd_pcm_chmap_from_string(const char *str); 00613 snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str); 00614 00615 //int snd_pcm_mixer_element(snd_pcm_t *pcm, snd_mixer_t *mixer, snd_mixer_elem_t **elem); 00616 00617 /* 00618 * application helpers - these functions are implemented on top 00619 * of the basic API 00620 */ 00621 00622 int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent); 00623 int snd_pcm_set_params(snd_pcm_t *pcm, 00624 snd_pcm_format_t format, 00625 snd_pcm_access_t access, 00626 unsigned int channels, 00627 unsigned int rate, 00628 int soft_resample, 00629 unsigned int latency); 00630 int snd_pcm_get_params(snd_pcm_t *pcm, 00631 snd_pcm_uframes_t *buffer_size, 00632 snd_pcm_uframes_t *period_size); 00633 00643 size_t snd_pcm_info_sizeof(void); 00648 #define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info) 00649 int snd_pcm_info_malloc(snd_pcm_info_t **ptr); 00650 void snd_pcm_info_free(snd_pcm_info_t *obj); 00651 void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src); 00652 unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj); 00653 unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj); 00654 snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj); 00655 int snd_pcm_info_get_card(const snd_pcm_info_t *obj); 00656 const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj); 00657 const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj); 00658 const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj); 00659 snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj); 00660 snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj); 00661 unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj); 00662 unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj); 00663 snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj); 00664 void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val); 00665 void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val); 00666 void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val); 00667 00677 int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); 00678 00679 int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params); 00680 int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params); 00681 int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params); 00682 int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params); 00683 int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params); 00684 int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params); 00685 int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params); 00686 int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params); 00687 int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params); 00688 int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params); 00689 int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params); 00690 int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params); 00691 int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); /* deprecated, use audio_ts_type */ 00692 int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type); 00693 int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params, 00694 unsigned int *rate_num, 00695 unsigned int *rate_den); 00696 int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params); 00697 int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params); 00698 00699 #if 0 00700 typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t; 00701 00702 /* choices need to be sorted on ascending badness */ 00703 typedef struct _snd_pcm_hw_strategy_simple_choices_list { 00704 unsigned int value; 00705 unsigned int badness; 00706 } snd_pcm_hw_strategy_simple_choices_list_t; 00707 00708 int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, 00709 const snd_pcm_hw_strategy_t *strategy, 00710 unsigned int badness_min, 00711 unsigned int badness_max); 00712 00713 void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy); 00714 int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp, 00715 unsigned int badness_min, 00716 unsigned int badness_max); 00717 int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm, 00718 snd_pcm_hw_params_t *fail, 00719 snd_pcm_hw_params_t *success, 00720 unsigned int depth, 00721 snd_output_t *out); 00722 00723 #endif 00724 00725 size_t snd_pcm_hw_params_sizeof(void); 00730 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params) 00731 int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr); 00732 void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj); 00733 void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src); 00734 00735 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API) 00736 00737 int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *_access); 00738 int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access); 00739 int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access); 00740 int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access); 00741 int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access); 00742 int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); 00743 int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask); 00744 00745 int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val); 00746 int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); 00747 int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val); 00748 int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); 00749 int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format); 00750 int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); 00751 void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask); 00752 00753 int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); 00754 int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); 00755 int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat); 00756 int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); 00757 int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat); 00758 int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); 00759 void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask); 00760 00761 int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val); 00762 int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val); 00763 int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val); 00764 int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); 00765 int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); 00766 int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00767 int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00768 int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max); 00769 int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00770 int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00771 int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00772 00773 int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00774 int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00775 int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00776 int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00777 int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00778 int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00779 int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00780 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); 00781 int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00782 int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00783 int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00784 int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); 00785 int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00786 int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); 00787 int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00788 int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val); 00789 int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val); 00790 00791 int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00792 int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00793 int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00794 int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00795 int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00796 int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00797 int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00798 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); 00799 int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00800 int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00801 int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00802 00803 int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); 00804 int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); 00805 int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir); 00806 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); 00807 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); 00808 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); 00809 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); 00810 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); 00811 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); 00812 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); 00813 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); 00814 int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); 00815 00816 int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00817 int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00818 int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00819 int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00820 int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00821 int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00822 int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00823 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); 00824 int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00825 int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00826 int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00827 int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params); 00828 00829 int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00830 int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00831 int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00832 int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00833 int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir); 00834 int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00835 int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00836 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); 00837 int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00838 int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00839 int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir); 00840 00841 int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00842 int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00843 int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00844 int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); 00845 int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val); 00846 int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00847 int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00848 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); 00849 int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00850 int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00851 int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00852 00853 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */ 00854 00855 int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val); 00856 00866 size_t snd_pcm_sw_params_sizeof(void); 00871 #define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params) 00872 int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr); 00873 void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj); 00874 void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src); 00875 int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); 00876 00877 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API) 00878 00879 int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val); 00880 int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val); 00881 int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val); 00882 int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val); 00883 int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); 00884 int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); 00885 int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val); 00886 int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val); 00887 int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); 00888 int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val); 00889 int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); 00890 int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); 00891 int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); 00892 int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); 00893 int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val); 00894 int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val); 00895 00896 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */ 00897 00900 /* include old API */ 00901 #ifndef ALSA_LIBRARY_BUILD 00902 #if defined(ALSA_PCM_OLD_HW_PARAMS_API) || defined(ALSA_PCM_OLD_SW_PARAMS_API) 00903 #include "pcm_old.h" 00904 #endif 00905 #endif 00906 00914 size_t snd_pcm_access_mask_sizeof(void); 00919 #define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask) 00920 int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr); 00921 void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj); 00922 void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src); 00923 void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask); 00924 void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask); 00925 int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val); 00926 int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask); 00927 void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val); 00928 void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val); 00929 00939 size_t snd_pcm_format_mask_sizeof(void); 00944 #define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask) 00945 int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr); 00946 void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj); 00947 void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src); 00948 void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask); 00949 void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask); 00950 int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val); 00951 int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask); 00952 void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val); 00953 void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val); 00954 00964 size_t snd_pcm_subformat_mask_sizeof(void); 00969 #define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask) 00970 int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr); 00971 void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj); 00972 void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src); 00973 void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask); 00974 void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask); 00975 int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); 00976 int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask); 00977 void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); 00978 void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val); 00979 00989 size_t snd_pcm_status_sizeof(void); 00994 #define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status) 00995 int snd_pcm_status_malloc(snd_pcm_status_t **ptr); 00996 void snd_pcm_status_free(snd_pcm_status_t *obj); 00997 void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src); 00998 snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj); 00999 void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr); 01000 void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); 01001 void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr); 01002 void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); 01003 void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); 01004 void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr); 01005 void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj, 01006 snd_pcm_audio_tstamp_report_t *audio_tstamp_report); 01007 void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj, 01008 snd_pcm_audio_tstamp_config_t *audio_tstamp_config); 01009 01010 static __inline__ void snd_pcm_pack_audio_tstamp_config(unsigned int *data, 01011 snd_pcm_audio_tstamp_config_t *config) 01012 { 01013 *data = config->report_delay; 01014 *data <<= 4; 01015 *data |= config->type_requested; 01016 } 01017 01018 static __inline__ void snd_pcm_unpack_audio_tstamp_report(unsigned int data, unsigned int accuracy, 01019 snd_pcm_audio_tstamp_report_t *report) 01020 { 01021 data >>= 16; 01022 report->valid = data & 1; 01023 report->actual_type = (data >> 1) & 0xF; 01024 report->accuracy_report = (data >> 5) & 1; 01025 report->accuracy = accuracy; 01026 } 01027 01028 snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj); 01029 snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj); 01030 snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj); 01031 snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj); 01032 01042 const char *snd_pcm_type_name(snd_pcm_type_t type); 01043 const char *snd_pcm_stream_name(const snd_pcm_stream_t stream); 01044 const char *snd_pcm_access_name(const snd_pcm_access_t _access); 01045 const char *snd_pcm_format_name(const snd_pcm_format_t format); 01046 const char *snd_pcm_format_description(const snd_pcm_format_t format); 01047 const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat); 01048 const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat); 01049 snd_pcm_format_t snd_pcm_format_value(const char* name); 01050 const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode); 01051 const char *snd_pcm_state_name(const snd_pcm_state_t state); 01052 01062 int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out); 01063 int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out); 01064 int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out); 01065 int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out); 01066 int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out); 01067 int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out); 01068 int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out); 01069 01079 int snd_pcm_mmap_begin(snd_pcm_t *pcm, 01080 const snd_pcm_channel_area_t **areas, 01081 snd_pcm_uframes_t *offset, 01082 snd_pcm_uframes_t *frames); 01083 snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm, 01084 snd_pcm_uframes_t offset, 01085 snd_pcm_uframes_t frames); 01086 snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size); 01087 snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size); 01088 snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); 01089 snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); 01090 01100 int snd_pcm_format_signed(snd_pcm_format_t format); 01101 int snd_pcm_format_unsigned(snd_pcm_format_t format); 01102 int snd_pcm_format_linear(snd_pcm_format_t format); 01103 int snd_pcm_format_float(snd_pcm_format_t format); 01104 int snd_pcm_format_little_endian(snd_pcm_format_t format); 01105 int snd_pcm_format_big_endian(snd_pcm_format_t format); 01106 int snd_pcm_format_cpu_endian(snd_pcm_format_t format); 01107 int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */ 01108 int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */ 01109 snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian); 01110 ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples); 01111 u_int8_t snd_pcm_format_silence(snd_pcm_format_t format); 01112 u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format); 01113 u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format); 01114 u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format); 01115 int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples); 01116 01117 snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes); 01118 ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames); 01119 long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes); 01120 ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples); 01121 01122 int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset, 01123 unsigned int samples, snd_pcm_format_t format); 01124 int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, 01125 unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format); 01126 int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset, 01127 const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset, 01128 unsigned int samples, snd_pcm_format_t format); 01129 int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, 01130 const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset, 01131 unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format); 01132 01143 typedef enum _snd_pcm_hook_type { 01144 SND_PCM_HOOK_TYPE_HW_PARAMS = 0, 01145 SND_PCM_HOOK_TYPE_HW_FREE, 01146 SND_PCM_HOOK_TYPE_CLOSE, 01147 SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE 01148 } snd_pcm_hook_type_t; 01149 01151 typedef struct _snd_pcm_hook snd_pcm_hook_t; 01153 typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook); 01154 snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook); 01155 void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook); 01156 void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data); 01157 int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm, 01158 snd_pcm_hook_type_t type, 01159 snd_pcm_hook_func_t func, void *private_data); 01160 int snd_pcm_hook_remove(snd_pcm_hook_t *hook); 01161 01172 typedef struct _snd_pcm_scope_ops { 01176 int (*enable)(snd_pcm_scope_t *scope); 01180 void (*disable)(snd_pcm_scope_t *scope); 01184 void (*start)(snd_pcm_scope_t *scope); 01188 void (*stop)(snd_pcm_scope_t *scope); 01192 void (*update)(snd_pcm_scope_t *scope); 01196 void (*reset)(snd_pcm_scope_t *scope); 01200 void (*close)(snd_pcm_scope_t *scope); 01201 } snd_pcm_scope_ops_t; 01202 01203 snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm); 01204 unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm); 01205 unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm); 01206 snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm); 01207 snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm); 01208 int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope); 01209 snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name); 01210 int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr); 01211 void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, 01212 const snd_pcm_scope_ops_t *val); 01213 void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val); 01214 const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope); 01215 void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope); 01216 void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val); 01217 int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name, 01218 snd_pcm_scope_t **scopep); 01219 int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope, 01220 unsigned int channel); 01221 01232 typedef enum _snd_spcm_latency { 01235 SND_SPCM_LATENCY_STANDARD = 0, 01238 SND_SPCM_LATENCY_MEDIUM, 01241 SND_SPCM_LATENCY_REALTIME 01242 } snd_spcm_latency_t; 01243 01245 typedef enum _snd_spcm_xrun_type { 01247 SND_SPCM_XRUN_IGNORE = 0, 01249 SND_SPCM_XRUN_STOP 01250 } snd_spcm_xrun_type_t; 01251 01253 typedef enum _snd_spcm_duplex_type { 01255 SND_SPCM_DUPLEX_LIBERAL = 0, 01257 SND_SPCM_DUPLEX_PEDANTIC 01258 } snd_spcm_duplex_type_t; 01259 01260 int snd_spcm_init(snd_pcm_t *pcm, 01261 unsigned int rate, 01262 unsigned int channels, 01263 snd_pcm_format_t format, 01264 snd_pcm_subformat_t subformat, 01265 snd_spcm_latency_t latency, 01266 snd_pcm_access_t _access, 01267 snd_spcm_xrun_type_t xrun_type); 01268 01269 int snd_spcm_init_duplex(snd_pcm_t *playback_pcm, 01270 snd_pcm_t *capture_pcm, 01271 unsigned int rate, 01272 unsigned int channels, 01273 snd_pcm_format_t format, 01274 snd_pcm_subformat_t subformat, 01275 snd_spcm_latency_t latency, 01276 snd_pcm_access_t _access, 01277 snd_spcm_xrun_type_t xrun_type, 01278 snd_spcm_duplex_type_t duplex_type); 01279 01280 int snd_spcm_init_get_params(snd_pcm_t *pcm, 01281 unsigned int *rate, 01282 snd_pcm_uframes_t *buffer_size, 01283 snd_pcm_uframes_t *period_size); 01284 01294 /* Deprecated functions, for compatibility */ 01295 const char *snd_pcm_start_mode_name(snd_pcm_start_t mode) __attribute__((deprecated)); 01296 const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode) __attribute__((deprecated)); 01297 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)); 01298 snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated)); 01299 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)); 01300 snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated)); 01301 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API) 01302 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)); 01303 int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated)); 01304 int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated)); 01305 int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated)); 01306 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */ 01307 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API) 01308 int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); 01309 int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); 01310 int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated)); 01311 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)); 01312 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)); 01313 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)); 01314 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)); 01315 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)); 01316 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)); 01317 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)); 01318 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)); 01319 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */ 01320 01323 #ifdef __cplusplus 01324 } 01325 #endif 01326 01327 #endif /* __ALSA_PCM_H */