📄 pcm.h
字号:
/** PCM timestamp mode */typedef enum _snd_pcm_tstamp { /** No timestamp */ SND_PCM_TSTAMP_NONE = 0, /** Update mmap'ed timestamp */ SND_PCM_TSTAMP_MMAP, SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_MMAP} snd_pcm_tstamp_t;/** Unsigned frames quantity */typedef unsigned long snd_pcm_uframes_t;/** Signed frames quantity */typedef long snd_pcm_sframes_t;/** Non blocking mode (flag for open mode) \hideinitializer */#define SND_PCM_NONBLOCK 0x0001/** Async notification (flag for open mode) \hideinitializer */#define SND_PCM_ASYNC 0x0002/** PCM handle */typedef struct _snd_pcm snd_pcm_t;/** PCM type */enum _snd_pcm_type { /** Kernel level PCM */ SND_PCM_TYPE_HW = 0, /** Hooked PCM */ SND_PCM_TYPE_HOOKS, /** One or more linked PCM with exclusive access to selected channels */ SND_PCM_TYPE_MULTI, /** File writing plugin */ SND_PCM_TYPE_FILE, /** Null endpoint PCM */ SND_PCM_TYPE_NULL, /** Shared memory client PCM */ SND_PCM_TYPE_SHM, /** INET client PCM (not yet implemented) */ SND_PCM_TYPE_INET, /** Copying plugin */ SND_PCM_TYPE_COPY, /** Linear format conversion PCM */ SND_PCM_TYPE_LINEAR, /** A-Law format conversion PCM */ SND_PCM_TYPE_ALAW, /** Mu-Law format conversion PCM */ SND_PCM_TYPE_MULAW, /** IMA-ADPCM format conversion PCM */ SND_PCM_TYPE_ADPCM, /** Rate conversion PCM */ SND_PCM_TYPE_RATE, /** Attenuated static route PCM */ SND_PCM_TYPE_ROUTE, /** Format adjusted PCM */ SND_PCM_TYPE_PLUG, /** Sharing PCM */ SND_PCM_TYPE_SHARE, /** Meter plugin */ SND_PCM_TYPE_METER, /** Mixing PCM */ SND_PCM_TYPE_MIX, /** Attenuated dynamic route PCM (not yet implemented) */ SND_PCM_TYPE_DROUTE, /** Loopback server plugin (not yet implemented) */ SND_PCM_TYPE_LBSERVER, /** Linear Integer <-> Linear Float format conversion PCM */ SND_PCM_TYPE_LINEAR_FLOAT, /** LADSPA integration plugin */ SND_PCM_TYPE_LADSPA, /** Direct Mixing plugin */ SND_PCM_TYPE_DMIX, /** Jack Audio Connection Kit plugin */ SND_PCM_TYPE_JACK, /** Direct Snooping plugin */ SND_PCM_TYPE_DSNOOP, /** Direct Sharing plugin */ SND_PCM_TYPE_DSHARE, /** IEC958 subframe plugin */ SND_PCM_TYPE_IEC958, /** Soft volume plugin */ SND_PCM_TYPE_SOFTVOL, /** External I/O plugin */ SND_PCM_TYPE_IOPLUG, /** External filter plugin */ SND_PCM_TYPE_EXTPLUG, /** Mmap-emulation plugin */ SND_PCM_TYPE_MMAP_EMUL, SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL};/** PCM type */typedef enum _snd_pcm_type snd_pcm_type_t;/** PCM area specification */typedef struct _snd_pcm_channel_area { /** base address of channel samples */ void *addr; /** offset to first sample in bits */ unsigned int first; /** samples distance in bits */ unsigned int step;} snd_pcm_channel_area_t;/** PCM synchronization ID */typedef union _snd_pcm_sync_id { /** 8-bit ID */ unsigned char id[16]; /** 16-bit ID */ unsigned short id16[8]; /** 32-bit ID */ unsigned int id32[4];} snd_pcm_sync_id_t;/** #SND_PCM_TYPE_METER scope handle */typedef struct _snd_pcm_scope snd_pcm_scope_t;int snd_pcm_open(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode);int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode, snd_config_t *lconf);int snd_pcm_close(snd_pcm_t *pcm);const char *snd_pcm_name(snd_pcm_t *pcm);snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm);int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm, snd_async_callback_t callback, void *private_data);snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);int snd_pcm_hw_free(snd_pcm_t *pcm);int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);int snd_pcm_prepare(snd_pcm_t *pcm);int snd_pcm_reset(snd_pcm_t *pcm);int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);int snd_pcm_start(snd_pcm_t *pcm);int snd_pcm_drop(snd_pcm_t *pcm);int snd_pcm_drain(snd_pcm_t *pcm);int snd_pcm_pause(snd_pcm_t *pcm, int enable);snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm);int snd_pcm_hwsync(snd_pcm_t *pcm);int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);int snd_pcm_resume(snd_pcm_t *pcm);snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);int snd_pcm_wait(snd_pcm_t *pcm, int timeout);int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);int snd_pcm_unlink(snd_pcm_t *pcm);/* * application helpers - these functions are implemented on top * of the basic API */int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);int snd_pcm_set_params(snd_pcm_t *pcm, snd_pcm_format_t format, snd_pcm_access_t access, unsigned int channels, unsigned int rate, int soft_resample, unsigned int latency);int snd_pcm_get_params(snd_pcm_t *pcm, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *period_size);/** \} *//** * \defgroup PCM_Info Stream Information * \ingroup PCM * See the \ref pcm page for more details. * \{ */size_t snd_pcm_info_sizeof(void);/** \hideinitializer * \brief allocate an invalid #snd_pcm_info_t using standard alloca * \param ptr returned pointer */#define snd_pcm_info_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_info_t *) alloca(snd_pcm_info_sizeof()); memset(*ptr, 0, snd_pcm_info_sizeof()); } while (0)int snd_pcm_info_malloc(snd_pcm_info_t **ptr);void snd_pcm_info_free(snd_pcm_info_t *obj);void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);int snd_pcm_info_get_card(const snd_pcm_info_t *obj);const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj);void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);/** \} *//** * \defgroup PCM_HW_Params Hardware Parameters * \ingroup PCM * See the \ref pcm page for more details. * \{ */int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params, unsigned int *rate_num, unsigned int *rate_den);int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);#if 0typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;/* choices need to be sorted on ascending badness */typedef struct _snd_pcm_hw_strategy_simple_choices_list { unsigned int value; unsigned int badness;} snd_pcm_hw_strategy_simple_choices_list_t;int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, const snd_pcm_hw_strategy_t *strategy, unsigned int badness_min, unsigned int badness_max);void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy);int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp, unsigned int badness_min, unsigned int badness_max);int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm, snd_pcm_hw_params_t *fail, snd_pcm_hw_params_t *success, unsigned int depth, snd_output_t *out);#endifsize_t snd_pcm_hw_params_sizeof(void);/** \hideinitializer * \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca * \param ptr returned pointer */#define snd_pcm_hw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_hw_params_t *) alloca(snd_pcm_hw_params_sizeof()); memset(*ptr, 0, snd_pcm_hw_params_sizeof()); } while (0)int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -