📄 pcm.h
字号:
/** \} *//** * \defgroup PCM_Description Description Functions * \ingroup PCM * See the \ref pcm page for more details. * \{ */const char *snd_pcm_type_name(snd_pcm_type_t type);const char *snd_pcm_stream_name(const snd_pcm_stream_t stream);const char *snd_pcm_access_name(const snd_pcm_access_t _access);const char *snd_pcm_format_name(const snd_pcm_format_t format);const char *snd_pcm_format_description(const snd_pcm_format_t format);const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);snd_pcm_format_t snd_pcm_format_value(const char* name);const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);const char *snd_pcm_state_name(const snd_pcm_state_t state);/** \} *//** * \defgroup PCM_Dump Debug Functions * \ingroup PCM * See the \ref pcm page for more details. * \{ */int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out);int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out);int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out);int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);/** \} *//** * \defgroup PCM_Direct Direct Access (MMAP) Functions * \ingroup PCM * See the \ref pcm page for more details. * \{ */int snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames);snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t frames);snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size); /** \} *//** * \defgroup PCM_Helpers Helper Functions * \ingroup PCM * See the \ref pcm page for more details. * \{ */int snd_pcm_format_signed(snd_pcm_format_t format);int snd_pcm_format_unsigned(snd_pcm_format_t format);int snd_pcm_format_linear(snd_pcm_format_t format);int snd_pcm_format_float(snd_pcm_format_t format);int snd_pcm_format_little_endian(snd_pcm_format_t format);int snd_pcm_format_big_endian(snd_pcm_format_t format);int snd_pcm_format_cpu_endian(snd_pcm_format_t format);int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames);long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes);ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples);int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset, unsigned int samples, snd_pcm_format_t format);int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset, const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset, unsigned int samples, snd_pcm_format_t format);int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset, unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);/** \} *//** * \defgroup PCM_Hook Hook Extension * \ingroup PCM * See the \ref pcm page for more details. * \{ *//** type of pcm hook */typedef enum _snd_pcm_hook_type { SND_PCM_HOOK_TYPE_HW_PARAMS = 0, SND_PCM_HOOK_TYPE_HW_FREE, SND_PCM_HOOK_TYPE_CLOSE, SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE} snd_pcm_hook_type_t;/** PCM hook container */typedef struct _snd_pcm_hook snd_pcm_hook_t;/** PCM hook callback function */typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook);snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook);void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook);void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data);int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm, snd_pcm_hook_type_t type, snd_pcm_hook_func_t func, void *private_data);int snd_pcm_hook_remove(snd_pcm_hook_t *hook);/** \} *//** * \defgroup PCM_Scope Scope Plugin Extension * \ingroup PCM * See the \ref pcm page for more details. * \{ *//** #SND_PCM_TYPE_METER scope functions */typedef struct _snd_pcm_scope_ops { /** \brief Enable and prepare it using current params * \param scope scope handle */ int (*enable)(snd_pcm_scope_t *scope); /** \brief Disable * \param scope scope handle */ void (*disable)(snd_pcm_scope_t *scope); /** \brief PCM has been started * \param scope scope handle */ void (*start)(snd_pcm_scope_t *scope); /** \brief PCM has been stopped * \param scope scope handle */ void (*stop)(snd_pcm_scope_t *scope); /** \brief New frames are present * \param scope scope handle */ void (*update)(snd_pcm_scope_t *scope); /** \brief Reset status * \param scope scope handle */ void (*reset)(snd_pcm_scope_t *scope); /** \brief PCM is closing * \param scope scope handle */ void (*close)(snd_pcm_scope_t *scope);} snd_pcm_scope_ops_t;snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm);unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm);unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm);snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm);snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm);int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope, snd_pcm_scope_ops_t *val);void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val);int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name, snd_pcm_scope_t **scopep);int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope, unsigned int channel);/** \} *//** * \defgroup PCM_Simple Simple setup functions * \ingroup PCM * See the \ref pcm page for more details. * \{ *//** Simple PCM latency type */typedef enum _snd_spcm_latency { /** standard latency - for standard playback or capture (estimated latency in one direction 350ms) */ SND_SPCM_LATENCY_STANDARD = 0, /** medium latency - software phones etc. (estimated latency in one direction maximally 25ms */ SND_SPCM_LATENCY_MEDIUM, /** realtime latency - realtime applications (effect processors etc.) (estimated latency in one direction 5ms and better) */ SND_SPCM_LATENCY_REALTIME} snd_spcm_latency_t;/** Simple PCM xrun type */typedef enum _snd_spcm_xrun_type { /** driver / library will ignore all xruns, the stream runs forever */ SND_SPCM_XRUN_IGNORE = 0, /** driver / library stops the stream when an xrun occurs */ SND_SPCM_XRUN_STOP} snd_spcm_xrun_type_t;/** Simple PCM duplex type */typedef enum _snd_spcm_duplex_type { /** liberal duplex - the buffer and period sizes might not match */ SND_SPCM_DUPLEX_LIBERAL = 0, /** pedantic duplex - the buffer and period sizes MUST match */ SND_SPCM_DUPLEX_PEDANTIC} snd_spcm_duplex_type_t;int snd_spcm_init(snd_pcm_t *pcm, unsigned int rate, unsigned int channels, snd_pcm_format_t format, snd_pcm_subformat_t subformat, snd_spcm_latency_t latency, snd_pcm_access_t _access, snd_spcm_xrun_type_t xrun_type);int snd_spcm_init_duplex(snd_pcm_t *playback_pcm, snd_pcm_t *capture_pcm, unsigned int rate, unsigned int channels, snd_pcm_format_t format, snd_pcm_subformat_t subformat, snd_spcm_latency_t latency, snd_pcm_access_t _access, snd_spcm_xrun_type_t xrun_type, snd_spcm_duplex_type_t duplex_type);int snd_spcm_init_get_params(snd_pcm_t *pcm, unsigned int *rate, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *period_size);/** \} *//** * \defgroup PCM_Deprecated Deprecated Functions * \ingroup PCM * See the \ref pcm page for more details. * \{ *//* Deprecated functions, for compatibility */const char *snd_pcm_start_mode_name(snd_pcm_start_t mode);const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode);int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val);snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params);int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val);snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params);/** \} */#ifdef __cplusplus}#endif#endif /* __ALSA_PCM_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -