ALSA project - the C library reference
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pcm.h
Go to the documentation of this file.
1 
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 
43 #define SND_PCM_DLSYM_VERSION _dlsym_pcm_001
44 
46 typedef struct _snd_pcm_info snd_pcm_info_t;
47 
62 typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;
63 
65 typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;
67  typedef struct _snd_pcm_status snd_pcm_status_t;
69 typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t;
71 typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t;
73 typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t;
74 
76 typedef enum _snd_pcm_class {
86  SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER
88 
90 typedef enum _snd_pcm_subclass {
95  SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX
97 
99 typedef enum _snd_pcm_stream {
104  SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE
106 
108 typedef enum _snd_pcm_access {
119  SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED
121 
123 typedef enum _snd_pcm_format {
202  SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE,
203 
204 #if __BYTE_ORDER == __LITTLE_ENDIAN
205 
223 #elif __BYTE_ORDER == __BIG_ENDIAN
224 
242 #else
243 #error "Unknown endian"
244 #endif
246 
248 typedef enum _snd_pcm_subformat {
251  SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
253 
255 typedef enum _snd_pcm_state {
274  SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED
276 
278 typedef enum _snd_pcm_start {
283  SND_PCM_START_LAST = SND_PCM_START_EXPLICIT
285 
287 typedef enum _snd_pcm_xrun {
292  SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP
294 
296 typedef enum _snd_pcm_tstamp {
305  SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
307 
309 typedef unsigned long snd_pcm_uframes_t;
311 typedef long snd_pcm_sframes_t;
312 
314 #define SND_PCM_NONBLOCK 0x00000001
315 
316 #define SND_PCM_ASYNC 0x00000002
317 
318 #define SND_PCM_NO_AUTO_RESAMPLE 0x00010000
319 
320 #define SND_PCM_NO_AUTO_CHANNELS 0x00020000
321 
322 #define SND_PCM_NO_AUTO_FORMAT 0x00040000
323 
324 #define SND_PCM_NO_SOFTVOL 0x00080000
325 
327 typedef struct _snd_pcm snd_pcm_t;
328 
394  SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL
395 };
396 
399 
401 typedef struct _snd_pcm_channel_area {
403  void *addr;
405  unsigned int first;
407  unsigned int step;
409 
411 typedef union _snd_pcm_sync_id {
413  unsigned char id[16];
415  unsigned short id16[8];
417  unsigned int id32[4];
419 
421 typedef struct _snd_pcm_scope snd_pcm_scope_t;
422 
423 int snd_pcm_open(snd_pcm_t **pcm, const char *name,
424  snd_pcm_stream_t stream, int mode);
425 int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name,
426  snd_pcm_stream_t stream, int mode,
427  snd_config_t *lconf);
429  const char *name, const char *orig_name,
430  snd_pcm_stream_t stream, int mode);
431 
432 int snd_pcm_close(snd_pcm_t *pcm);
433 const char *snd_pcm_name(snd_pcm_t *pcm);
434 snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
437 int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
438 int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
439 int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);
441  snd_async_callback_t callback, void *private_data);
443 int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);
446 int snd_pcm_hw_free(snd_pcm_t *pcm);
449 int snd_pcm_prepare(snd_pcm_t *pcm);
450 int snd_pcm_reset(snd_pcm_t *pcm);
451 int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);
452 int snd_pcm_start(snd_pcm_t *pcm);
453 int snd_pcm_drop(snd_pcm_t *pcm);
454 int snd_pcm_drain(snd_pcm_t *pcm);
455 int snd_pcm_pause(snd_pcm_t *pcm, int enable);
457 int snd_pcm_hwsync(snd_pcm_t *pcm);
458 int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);
459 int snd_pcm_resume(snd_pcm_t *pcm);
460 int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);
461 snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm);
462 snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
463 int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp);
464 snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm);
465 snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
466 snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm);
467 snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);
468 snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
469 snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
470 snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
471 snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
472 int snd_pcm_wait(snd_pcm_t *pcm, int timeout);
473 
474 int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);
475 int snd_pcm_unlink(snd_pcm_t *pcm);
476 
478 #define SND_CHMAP_API_VERSION ((1 << 16) | (0 << 8) | 1)
479 
482  SND_CHMAP_TYPE_NONE = 0,
487 };
488 
491  SND_CHMAP_UNKNOWN = 0,
519  SND_CHMAP_TFLC, /* top front left center */
520  SND_CHMAP_TFRC, /* top front right center */
521  SND_CHMAP_TSL, /* top side left */
522  SND_CHMAP_TSR, /* top side right */
523  SND_CHMAP_LLFE, /* left LFE */
524  SND_CHMAP_RLFE, /* right LFE */
525  SND_CHMAP_BC, /* bottom center */
526  SND_CHMAP_BLC, /* bottom left center */
527  SND_CHMAP_BRC, /* bottom right center */
528  SND_CHMAP_LAST = SND_CHMAP_BRC,
529 };
530 
532 #define SND_CHMAP_POSITION_MASK 0xffff
533 
535 #define SND_CHMAP_PHASE_INVERSE (0x01 << 16)
536 
537 #define SND_CHMAP_DRIVER_SPEC (0x02 << 16)
538 
540 typedef struct snd_pcm_chmap {
541  unsigned int channels;
542  unsigned int pos[0];
544 
546 typedef struct snd_pcm_chmap_query {
547  enum snd_pcm_chmap_type type;
550 
551 
554  int subdev,
555  snd_pcm_stream_t stream);
558 int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map);
559 
560 const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val);
561 const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val);
562 const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val);
563 int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);
564 unsigned int snd_pcm_chmap_from_string(const char *str);
566 
567 //int snd_pcm_mixer_element(snd_pcm_t *pcm, snd_mixer_t *mixer, snd_mixer_elem_t **elem);
568 
569 /*
570  * application helpers - these functions are implemented on top
571  * of the basic API
572  */
573 
574 int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);
576  snd_pcm_format_t format,
577  snd_pcm_access_t access,
578  unsigned int channels,
579  unsigned int rate,
580  int soft_resample,
581  unsigned int latency);
583  snd_pcm_uframes_t *buffer_size,
584  snd_pcm_uframes_t *period_size);
585 
595 size_t snd_pcm_info_sizeof(void);
600 #define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info)
603 void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);
604 unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);
605 unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);
607 int snd_pcm_info_get_card(const snd_pcm_info_t *obj);
608 const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);
609 const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);
610 const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);
613 unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);
614 unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);
616 void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);
617 void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);
619 
630 
645  unsigned int *rate_num,
646  unsigned int *rate_den);
649 
650 #if 0
651 typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;
652 
653 /* choices need to be sorted on ascending badness */
654 typedef struct _snd_pcm_hw_strategy_simple_choices_list {
655  unsigned int value;
656  unsigned int badness;
657 } snd_pcm_hw_strategy_simple_choices_list_t;
658 
659 int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
660  const snd_pcm_hw_strategy_t *strategy,
661  unsigned int badness_min,
662  unsigned int badness_max);
663 
664 void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy);
665 int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,
666  unsigned int badness_min,
667  unsigned int badness_max);
668 int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,
669  snd_pcm_hw_params_t *fail,
670  snd_pcm_hw_params_t *success,
671  unsigned int depth,
672  snd_output_t *out);
673 
674 #endif
675 
676 size_t snd_pcm_hw_params_sizeof(void);
681 #define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)
685 
686 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)
687 
695 
703 
711 
712 int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val);
713 int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val);
714 int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val);
715 int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
716 int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
717 int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
718 int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
719 int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);
720 int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
721 int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
722 int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
723 
724 int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
725 int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
726 int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
727 int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
728 int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
729 int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
730 int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
731 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);
732 int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
733 int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
734 int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
735 int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
736 int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
737 int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
738 int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
739 int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);
740 int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);
741 
742 int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
743 int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
744 int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
745 int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
746 int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
747 int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
748 int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
749 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);
750 int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
751 int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
752 int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
753 
754 int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
755 int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
756 int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);
757 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);
758 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);
759 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);
760 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);
761 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);
762 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);
763 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);
764 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);
766 
767 int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
768 int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
769 int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
770 int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
771 int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
772 int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
773 int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
774 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);
775 int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
776 int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
777 int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
779 
780 int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
781 int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
782 int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
783 int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
784 int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);
785 int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
786 int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
787 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);
788 int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
789 int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
790 int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);
791 
792 int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
793 int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
794 int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
795 int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
796 int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);
797 int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
798 int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
799 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);
800 int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
801 int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
802 int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
803 
804 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
805 
806 int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);
807 
817 size_t snd_pcm_sw_params_sizeof(void);
822 #define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params)
826 int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
827 
828 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)
829 
832 int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
833 int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
835 int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val);
836 int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
837 int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);
838 int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
839 int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
840 int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
841 int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
842 int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
843 int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);
844 
845 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */
846 
849 /* include old API */
850 #ifndef ALSA_LIBRARY_BUILD
851 #if defined(ALSA_PCM_OLD_HW_PARAMS_API) || defined(ALSA_PCM_OLD_SW_PARAMS_API)
852 #include "pcm_old.h"
853 #endif
854 #endif
855 
863 size_t snd_pcm_access_mask_sizeof(void);
868 #define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask)
878 
888 size_t snd_pcm_format_mask_sizeof(void);
893 #define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask)
903 
913 size_t snd_pcm_subformat_mask_sizeof(void);
918 #define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask)
928 
938 size_t snd_pcm_status_sizeof(void);
943 #define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status)
953 snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);
954 snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
955 snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
956 snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj);
957 
967 const char *snd_pcm_type_name(snd_pcm_type_t type);
968 const char *snd_pcm_stream_name(const snd_pcm_stream_t stream);
969 const char *snd_pcm_access_name(const snd_pcm_access_t _access);
970 const char *snd_pcm_format_name(const snd_pcm_format_t format);
971 const char *snd_pcm_format_description(const snd_pcm_format_t format);
972 const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);
973 const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);
974 snd_pcm_format_t snd_pcm_format_value(const char* name);
975 const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);
976 const char *snd_pcm_state_name(const snd_pcm_state_t state);
977 
987 int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);
994 
1004 int snd_pcm_mmap_begin(snd_pcm_t *pcm,
1005  const snd_pcm_channel_area_t **areas,
1006  snd_pcm_uframes_t *offset,
1007  snd_pcm_uframes_t *frames);
1008 snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,
1009  snd_pcm_uframes_t offset,
1010  snd_pcm_uframes_t frames);
1011 snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);
1012 snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);
1013 snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
1014 snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
1015 
1032 int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */
1033 int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
1034 snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
1035 ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
1036 u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
1040 int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
1041 
1042 snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
1043 ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames);
1044 long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes);
1045 ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples);
1046 
1047 int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
1048  unsigned int samples, snd_pcm_format_t format);
1049 int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
1050  unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
1051 int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,
1052  const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,
1053  unsigned int samples, snd_pcm_format_t format);
1054 int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,
1055  const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,
1056  unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);
1057 
1068 typedef enum _snd_pcm_hook_type {
1069  SND_PCM_HOOK_TYPE_HW_PARAMS = 0,
1070  SND_PCM_HOOK_TYPE_HW_FREE,
1071  SND_PCM_HOOK_TYPE_CLOSE,
1072  SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE
1074 
1076 typedef struct _snd_pcm_hook snd_pcm_hook_t;
1078 typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook);
1081 void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data);
1082 int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm,
1083  snd_pcm_hook_type_t type,
1084  snd_pcm_hook_func_t func, void *private_data);
1086 
1097 typedef struct _snd_pcm_scope_ops {
1101  int (*enable)(snd_pcm_scope_t *scope);
1105  void (*disable)(snd_pcm_scope_t *scope);
1109  void (*start)(snd_pcm_scope_t *scope);
1113  void (*stop)(snd_pcm_scope_t *scope);
1117  void (*update)(snd_pcm_scope_t *scope);
1121  void (*reset)(snd_pcm_scope_t *scope);
1125  void (*close)(snd_pcm_scope_t *scope);
1127 
1128 snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm);
1129 unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm);
1130 unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm);
1131 snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm);
1132 snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm);
1134 snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);
1137  const snd_pcm_scope_ops_t *val);
1138 void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);
1139 const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);
1141 void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val);
1142 int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,
1143  snd_pcm_scope_t **scopep);
1145  unsigned int channel);
1146 
1157 typedef enum _snd_spcm_latency {
1168 
1170 typedef enum _snd_spcm_xrun_type {
1176 
1178 typedef enum _snd_spcm_duplex_type {
1184 
1185 int snd_spcm_init(snd_pcm_t *pcm,
1186  unsigned int rate,
1187  unsigned int channels,
1188  snd_pcm_format_t format,
1189  snd_pcm_subformat_t subformat,
1190  snd_spcm_latency_t latency,
1191  snd_pcm_access_t _access,
1192  snd_spcm_xrun_type_t xrun_type);
1193 
1194 int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,
1195  snd_pcm_t *capture_pcm,
1196  unsigned int rate,
1197  unsigned int channels,
1198  snd_pcm_format_t format,
1199  snd_pcm_subformat_t subformat,
1200  snd_spcm_latency_t latency,
1201  snd_pcm_access_t _access,
1202  snd_spcm_xrun_type_t xrun_type,
1203  snd_spcm_duplex_type_t duplex_type);
1204 
1206  unsigned int *rate,
1207  snd_pcm_uframes_t *buffer_size,
1208  snd_pcm_uframes_t *period_size);
1209 
1219 /* Deprecated functions, for compatibility */
1220 const char *snd_pcm_start_mode_name(snd_pcm_start_t mode) __attribute__((deprecated));
1221 const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode) __attribute__((deprecated));
1226 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)
1227 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));
1228 int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated));
1229 int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated));
1230 int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated));
1231 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */
1232 #if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)
1233 int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
1234 int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
1235 int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));
1236 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));
1237 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));
1238 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));
1239 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));
1240 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));
1241 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));
1242 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));
1243 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));
1244 #endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */
1245 
1248 #ifdef __cplusplus
1249 }
1250 #endif
1251 
1252 #endif /* __ALSA_PCM_H */