ALSA project - the C library reference
Loading...
Searching...
No Matches
pcm.c File Reference

PCM Interface. More...

Functions

const char * snd_pcm_name (snd_pcm_t *pcm)
 get identifier of PCM handle
 
snd_pcm_type_t snd_pcm_type (snd_pcm_t *pcm)
 get type of PCM handle
 
snd_pcm_stream_t snd_pcm_stream (snd_pcm_t *pcm)
 get stream for a PCM handle
 
int snd_pcm_close (snd_pcm_t *pcm)
 close PCM handle
 
int snd_pcm_nonblock (snd_pcm_t *pcm, int nonblock)
 set nonblock mode
 
int snd_pcm_info (snd_pcm_t *pcm, snd_pcm_info_t *info)
 Obtain general (static) information for PCM handle.
 
int snd_pcm_hw_params_current (snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 Retreive current PCM hardware configuration chosen with snd_pcm_hw_params.
 
int snd_pcm_hw_params (snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 Install one PCM hardware configuration chosen from a configuration space and snd_pcm_prepare it.
 
int snd_pcm_hw_free (snd_pcm_t *pcm)
 Remove PCM hardware configuration and free associated resources.
 
int snd_pcm_sw_params (snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 Install PCM software configuration defined by params.
 
int snd_pcm_status (snd_pcm_t *pcm, snd_pcm_status_t *status)
 Obtain status (runtime) information for PCM handle.
 
snd_pcm_state_t snd_pcm_state (snd_pcm_t *pcm)
 Return PCM state.
 
int snd_pcm_hwsync (snd_pcm_t *pcm)
 (DEPRECATED) Synchronize stream position with hardware
 
int snd_pcm_delay (snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
 Obtain delay for a running PCM handle.
 
int snd_pcm_resume (snd_pcm_t *pcm)
 Resume from suspend, no samples are lost.
 
int snd_pcm_htimestamp (snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp)
 Obtain last position update hi-res timestamp.
 
int snd_pcm_prepare (snd_pcm_t *pcm)
 Prepare PCM for use.
 
int snd_pcm_reset (snd_pcm_t *pcm)
 Reset PCM position.
 
int snd_pcm_start (snd_pcm_t *pcm)
 Start a PCM.
 
int snd_pcm_drop (snd_pcm_t *pcm)
 Stop a PCM dropping pending frames.
 
int snd_pcm_drain (snd_pcm_t *pcm)
 Stop a PCM preserving pending frames.
 
int snd_pcm_pause (snd_pcm_t *pcm, int enable)
 Pause/resume PCM.
 
snd_pcm_sframes_t snd_pcm_rewindable (snd_pcm_t *pcm)
 Get safe count of frames which can be rewinded.
 
snd_pcm_sframes_t snd_pcm_rewind (snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 Move application frame position backward.
 
snd_pcm_sframes_t snd_pcm_forwardable (snd_pcm_t *pcm)
 Get safe count of frames which can be forwarded.
 
snd_pcm_sframes_t snd_pcm_forward (snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 Move application frame position forward.
 
snd_pcm_sframes_t snd_pcm_writei (snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size)
 Write interleaved frames to a PCM.
 
snd_pcm_sframes_t snd_pcm_writen (snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
 Write non interleaved frames to a PCM.
 
snd_pcm_sframes_t snd_pcm_readi (snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
 Read interleaved frames from a PCM.
 
snd_pcm_sframes_t snd_pcm_readn (snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
 Read non interleaved frames to a PCM.
 
int snd_pcm_link (snd_pcm_t *pcm1, snd_pcm_t *pcm2)
 Link two PCMs.
 
int snd_pcm_unlink (snd_pcm_t *pcm)
 Remove a PCM from a linked group.
 
int snd_pcm_poll_descriptors_count (snd_pcm_t *pcm)
 get count of poll descriptors for PCM handle
 
int snd_pcm_poll_descriptors (snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
 get poll descriptors
 
int snd_pcm_poll_descriptors_revents (snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents)
 get returned events from poll descriptors
 
const char * snd_pcm_stream_name (const snd_pcm_stream_t stream)
 get name of PCM stream type
 
const char * snd_pcm_access_name (const snd_pcm_access_t acc)
 get name of PCM access type
 
const char * snd_pcm_format_name (const snd_pcm_format_t format)
 get name of PCM sample format
 
const char * snd_pcm_format_description (const snd_pcm_format_t format)
 get description of PCM sample format
 
snd_pcm_format_t snd_pcm_format_value (const char *name)
 get PCM sample format from name
 
const char * snd_pcm_subformat_name (const snd_pcm_subformat_t subformat)
 get name of PCM sample subformat
 
const char * snd_pcm_subformat_description (const snd_pcm_subformat_t subformat)
 get description of PCM sample subformat
 
snd_pcm_subformat_t snd_pcm_subformat_value (const char *name)
 get PCM sample subformat from name
 
const char * snd_pcm_start_mode_name (snd_pcm_start_t mode)
 (DEPRECATED) get name of PCM start mode setting
 
const char * snd_pcm_xrun_mode_name (snd_pcm_xrun_t mode)
 (DEPRECATED) get name of PCM xrun mode setting
 
const char * snd_pcm_tstamp_mode_name (const snd_pcm_tstamp_t mode)
 get name of PCM tstamp mode setting
 
const char * snd_pcm_tstamp_type_name (snd_pcm_tstamp_type_t type)
 get name of PCM tstamp type setting
 
const char * snd_pcm_state_name (const snd_pcm_state_t state)
 get name of PCM state
 
const char * snd_pcm_type_name (snd_pcm_type_t type)
 get name of PCM type
 
int snd_pcm_dump_hw_setup (snd_pcm_t *pcm, snd_output_t *out)
 Dump current hardware setup for PCM.
 
int snd_pcm_dump_sw_setup (snd_pcm_t *pcm, snd_output_t *out)
 Dump current software setup for PCM.
 
int snd_pcm_dump_setup (snd_pcm_t *pcm, snd_output_t *out)
 Dump current setup (hardware and software) for PCM.
 
int snd_pcm_status_dump (snd_pcm_status_t *status, snd_output_t *out)
 Dump status.
 
int snd_pcm_dump (snd_pcm_t *pcm, snd_output_t *out)
 Dump PCM info.
 
snd_pcm_sframes_t snd_pcm_bytes_to_frames (snd_pcm_t *pcm, ssize_t bytes)
 Convert bytes in frames for a PCM.
 
ssize_t snd_pcm_frames_to_bytes (snd_pcm_t *pcm, snd_pcm_sframes_t frames)
 Convert frames in bytes for a PCM.
 
long snd_pcm_bytes_to_samples (snd_pcm_t *pcm, ssize_t bytes)
 Convert bytes in samples for a PCM.
 
ssize_t snd_pcm_samples_to_bytes (snd_pcm_t *pcm, long samples)
 Convert samples in bytes for a PCM.
 
int snd_async_add_pcm_handler (snd_async_handler_t **handler, snd_pcm_t *pcm, snd_async_callback_t callback, void *private_data)
 Add an async handler for a PCM.
 
snd_pcm_t * snd_async_handler_get_pcm (snd_async_handler_t *handler)
 Return PCM handle related to an async handler.
 
int snd_pcm_open (snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode)
 Opens a PCM.
 
int snd_pcm_open_lconf (snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode, snd_config_t *lconf)
 Opens a PCM using local configuration.
 
int snd_pcm_open_fallback (snd_pcm_t **pcmp, snd_config_t *root, const char *name, const char *orig_name, snd_pcm_stream_t stream, int mode)
 Opens a fallback PCM.
 
int snd_pcm_wait (snd_pcm_t *pcm, int timeout)
 Wait for a PCM to become ready.
 
snd_pcm_sframes_t snd_pcm_avail_update (snd_pcm_t *pcm)
 Return number of frames ready to be read (capture) / written (playback)
 
snd_pcm_sframes_t snd_pcm_avail (snd_pcm_t *pcm)
 Return number of frames ready to be read (capture) / written (playback)
 
int snd_pcm_avail_delay (snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp)
 Combine snd_pcm_avail and snd_pcm_delay functions.
 
int snd_pcm_area_silence (const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t dst_offset, unsigned int samples, snd_pcm_format_t format)
 Silence an area.
 
int snd_pcm_areas_silence (const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset, unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format)
 Silence one or more areas.
 
int snd_pcm_area_copy (const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t dst_offset, const snd_pcm_channel_area_t *src_area, snd_pcm_uframes_t src_offset, unsigned int samples, snd_pcm_format_t format)
 Copy an area.
 
int snd_pcm_areas_copy (const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset, const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset, unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format)
 Copy one or more areas.
 
int snd_pcm_areas_copy_wrap (const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset, const snd_pcm_uframes_t dst_size, const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset, const snd_pcm_uframes_t src_size, const unsigned int channels, snd_pcm_uframes_t frames, const snd_pcm_format_t format)
 Copy one or more areas.
 
int snd_pcm_hw_params_dump (snd_pcm_hw_params_t *params, snd_output_t *out)
 Dump a PCM hardware configuration space.
 
int snd_pcm_hw_params_can_mmap_sample_resolution (const snd_pcm_hw_params_t *params)
 Check if hardware supports sample-resolution mmap for given configuration.
 
int snd_pcm_hw_params_is_double (const snd_pcm_hw_params_t *params)
 Check if hardware does double buffering for start/stop for given configuration.
 
int snd_pcm_hw_params_is_batch (const snd_pcm_hw_params_t *params)
 Check if hardware does double buffering for data transfers for given configuration.
 
int snd_pcm_hw_params_is_block_transfer (const snd_pcm_hw_params_t *params)
 Check if hardware does block transfers for samples for given configuration.
 
int snd_pcm_hw_params_is_monotonic (const snd_pcm_hw_params_t *params)
 Check if timestamps are monotonic for given configuration.
 
int snd_pcm_hw_params_can_overrange (const snd_pcm_hw_params_t *params)
 Check if hardware supports overrange detection.
 
int snd_pcm_hw_params_can_pause (const snd_pcm_hw_params_t *params)
 Check if hardware supports pause.
 
int snd_pcm_hw_params_can_resume (const snd_pcm_hw_params_t *params)
 Check if hardware supports resume.
 
int snd_pcm_hw_params_is_half_duplex (const snd_pcm_hw_params_t *params)
 Check if hardware does half-duplex only.
 
int snd_pcm_hw_params_is_joint_duplex (const snd_pcm_hw_params_t *params)
 Check if hardware does joint-duplex (playback and capture are somewhat correlated)
 
int snd_pcm_hw_params_can_sync_start (const snd_pcm_hw_params_t *params)
 Check if hardware supports synchronized start with sample resolution.
 
int snd_pcm_hw_params_can_disable_period_wakeup (const snd_pcm_hw_params_t *params)
 Check if hardware can disable period wakeups.
 
int snd_pcm_hw_params_is_perfect_drain (const snd_pcm_hw_params_t *params)
 Check if hardware is capable of perfect drain.
 
int snd_pcm_hw_params_supports_audio_wallclock_ts (const snd_pcm_hw_params_t *params)
 Check if hardware supports audio wallclock timestamps.
 
int snd_pcm_hw_params_supports_audio_ts_type (const snd_pcm_hw_params_t *params, int type)
 Check if hardware supports type of audio timestamps.
 
int snd_pcm_hw_params_get_rate_numden (const snd_pcm_hw_params_t *params, unsigned int *rate_num, unsigned int *rate_den)
 Get rate exact info from a configuration space.
 
int snd_pcm_hw_params_get_sbits (const snd_pcm_hw_params_t *params)
 Get sample resolution info from a configuration space.
 
int snd_pcm_hw_params_get_fifo_size (const snd_pcm_hw_params_t *params)
 Get hardware FIFO size info from a configuration space.
 
const unsigned char * snd_pcm_hw_params_get_sync (const snd_pcm_hw_params_t *params)
 Get hardware synchronization ID from a PCM info container.
 
int snd_pcm_hw_params_any (snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 Fill params with a full configuration space for a PCM.
 
size_t snd_pcm_access_mask_sizeof ()
 get size of #snd_pcm_access_mask_t
 
int snd_pcm_access_mask_malloc (snd_pcm_access_mask_t **ptr)
 allocate an empty #snd_pcm_access_mask_t using standard malloc
 
void snd_pcm_access_mask_free (snd_pcm_access_mask_t *obj)
 frees a previously allocated #snd_pcm_access_mask_t
 
void snd_pcm_access_mask_copy (snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src)
 copy one #snd_pcm_access_mask_t to another
 
void snd_pcm_access_mask_none (snd_pcm_access_mask_t *mask)
 reset all bits in a #snd_pcm_access_mask_t
 
void snd_pcm_access_mask_any (snd_pcm_access_mask_t *mask)
 set all bits in a #snd_pcm_access_mask_t
 
int snd_pcm_access_mask_test (const snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
 test the presence of an access type in a #snd_pcm_access_mask_t
 
int snd_pcm_access_mask_empty (const snd_pcm_access_mask_t *mask)
 test, if given a #snd_pcm_access_mask_t is empty
 
void snd_pcm_access_mask_set (snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
 make an access type present in a #snd_pcm_access_mask_t
 
void snd_pcm_access_mask_reset (snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
 make an access type missing from a #snd_pcm_access_mask_t
 
size_t snd_pcm_format_mask_sizeof ()
 get size of #snd_pcm_format_mask_t
 
int snd_pcm_format_mask_malloc (snd_pcm_format_mask_t **ptr)
 allocate an empty #snd_pcm_format_mask_t using standard malloc
 
void snd_pcm_format_mask_free (snd_pcm_format_mask_t *obj)
 frees a previously allocated #snd_pcm_format_mask_t
 
void snd_pcm_format_mask_copy (snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src)
 copy one #snd_pcm_format_mask_t to another
 
void snd_pcm_format_mask_none (snd_pcm_format_mask_t *mask)
 reset all bits in a #snd_pcm_format_mask_t
 
void snd_pcm_format_mask_any (snd_pcm_format_mask_t *mask)
 set all bits in a #snd_pcm_format_mask_t
 
int snd_pcm_format_mask_test (const snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
 test the presence of a format in a #snd_pcm_format_mask_t
 
int snd_pcm_format_mask_empty (const snd_pcm_format_mask_t *mask)
 test, if given a #snd_pcm_format_mask_t is empty
 
void snd_pcm_format_mask_set (snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
 make a format present in a #snd_pcm_format_mask_t
 
void snd_pcm_format_mask_reset (snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
 make a format missing from a #snd_pcm_format_mask_t
 
size_t snd_pcm_subformat_mask_sizeof ()
 get size of #snd_pcm_subformat_mask_t
 
int snd_pcm_subformat_mask_malloc (snd_pcm_subformat_mask_t **ptr)
 allocate an empty #snd_pcm_subformat_mask_t using standard malloc
 
void snd_pcm_subformat_mask_free (snd_pcm_subformat_mask_t *obj)
 frees a previously allocated #snd_pcm_subformat_mask_t
 
void snd_pcm_subformat_mask_copy (snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src)
 copy one #snd_pcm_subformat_mask_t to another
 
void snd_pcm_subformat_mask_none (snd_pcm_subformat_mask_t *mask)
 reset all bits in a #snd_pcm_subformat_mask_t
 
void snd_pcm_subformat_mask_any (snd_pcm_subformat_mask_t *mask)
 set all bits in a #snd_pcm_subformat_mask_t
 
int snd_pcm_subformat_mask_test (const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
 test the presence of a subformat in a #snd_pcm_subformat_mask_t
 
int snd_pcm_subformat_mask_empty (const snd_pcm_subformat_mask_t *mask)
 test, if given a #snd_pcm_subformat_mask_t is empty
 
void snd_pcm_subformat_mask_set (snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
 make a subformat present in a #snd_pcm_subformat_mask_t
 
void snd_pcm_subformat_mask_reset (snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
 make a subformat missing from a #snd_pcm_subformat_mask_t
 
size_t snd_pcm_hw_params_sizeof ()
 get size of #snd_pcm_hw_params_t
 
int snd_pcm_hw_params_malloc (snd_pcm_hw_params_t **ptr)
 allocate an invalid #snd_pcm_hw_params_t using standard malloc
 
void snd_pcm_hw_params_free (snd_pcm_hw_params_t *obj)
 frees a previously allocated #snd_pcm_hw_params_t
 
void snd_pcm_hw_params_copy (snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src)
 copy one #snd_pcm_hw_params_t to another
 
int snd_pcm_hw_params_get_access (const snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
 Extract access type from a configuration space.
 
int snd_pcm_hw_params_test_access (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access)
 Verify if an access type is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_access (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t access)
 Restrict a configuration space to contain only one access type.
 
int snd_pcm_hw_params_set_access_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
 Restrict a configuration space to contain only its first access type.
 
int snd_pcm_hw_params_set_access_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *access)
 Restrict a configuration space to contain only its last access type.
 
int snd_pcm_hw_params_set_access_mask (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
 Restrict a configuration space to contain only a set of access types.
 
int snd_pcm_hw_params_get_access_mask (snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask)
 Get access mask from a configuration space.
 
int snd_pcm_hw_params_get_format (const snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
 Extract format from a configuration space.
 
int snd_pcm_hw_params_test_format (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t format)
 Verify if a format is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_format (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t format)
 Restrict a configuration space to contain only one format.
 
int snd_pcm_hw_params_set_format_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
 Restrict a configuration space to contain only its first format.
 
int snd_pcm_hw_params_set_format_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format)
 Restrict a configuration space to contain only its last format.
 
int snd_pcm_hw_params_set_format_mask (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask)
 Restrict a configuration space to contain only a set of formats.
 
void snd_pcm_hw_params_get_format_mask (snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask)
 Get format mask from a configuration space.
 
int snd_pcm_hw_params_get_subformat (const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
 Extract subformat from a configuration space.
 
int snd_pcm_hw_params_test_subformat (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat)
 Verify if a subformat is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_subformat (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat)
 Restrict a configuration space to contain only one subformat.
 
int snd_pcm_hw_params_set_subformat_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
 Restrict a configuration space to contain only its first subformat.
 
int snd_pcm_hw_params_set_subformat_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat)
 Restrict a configuration space to contain only its last subformat.
 
int snd_pcm_hw_params_set_subformat_mask (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
 Restrict a configuration space to contain only a set of subformats.
 
void snd_pcm_hw_params_get_subformat_mask (snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask)
 Get subformat mask from a configuration space.
 
int snd_pcm_hw_params_get_channels (const snd_pcm_hw_params_t *params, unsigned int *val)
 Extract channels from a configuration space.
 
int snd_pcm_hw_params_get_channels_min (const snd_pcm_hw_params_t *params, unsigned int *val)
 Extract minimum channels count from a configuration space.
 
int snd_pcm_hw_params_get_channels_max (const snd_pcm_hw_params_t *params, unsigned int *val)
 Extract maximum channels count from a configuration space.
 
int snd_pcm_hw_params_test_channels (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
 Verify if a channels count is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_channels (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
 Restrict a configuration space to contain only one channels count.
 
int snd_pcm_hw_params_set_channels_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Restrict a configuration space with a minimum channels count.
 
int snd_pcm_hw_params_set_channels_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Restrict a configuration space with a maximum channels count.
 
int snd_pcm_hw_params_set_channels_minmax (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max)
 Restrict a configuration space to have channels counts in a given range.
 
int snd_pcm_hw_params_set_channels_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Restrict a configuration space to have channels count nearest to a target.
 
int snd_pcm_hw_params_set_channels_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Restrict a configuration space to contain only its minimum channels count.
 
int snd_pcm_hw_params_set_channels_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Restrict a configuration space to contain only its maximum channels count.
 
int snd_pcm_hw_params_get_rate (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract rate from a configuration space.
 
int snd_pcm_hw_params_get_rate_min (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract minimum rate from a configuration space.
 
int snd_pcm_hw_params_get_rate_max (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract maximum rate from a configuration space.
 
int snd_pcm_hw_params_test_rate (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Verify if a rate is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_rate (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Restrict a configuration space to contain only one rate.
 
int snd_pcm_hw_params_set_rate_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a minimum rate.
 
int snd_pcm_hw_params_set_rate_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a maximum rate.
 
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)
 Restrict a configuration space to have rates in a given range.
 
int snd_pcm_hw_params_set_rate_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to have rate nearest to a target.
 
int snd_pcm_hw_params_set_rate_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its minimum rate.
 
int snd_pcm_hw_params_set_rate_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its maximum rate.
 
int snd_pcm_hw_params_set_rate_resample (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
 Restrict a configuration space to contain only real hardware rates.
 
int snd_pcm_hw_params_get_rate_resample (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Extract resample state from a configuration space.
 
int snd_pcm_hw_params_set_export_buffer (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
 Restrict a configuration space to allow the buffer to be accessible from outside.
 
int snd_pcm_hw_params_get_export_buffer (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Extract buffer accessibility from a configuration space.
 
int snd_pcm_hw_params_set_period_wakeup (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
 Restrict a configuration space to settings without period wakeups.
 
int snd_pcm_hw_params_get_period_wakeup (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Extract period wakeup flag from a configuration space.
 
int snd_pcm_hw_params_set_drain_silence (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val)
 Restrict a configuration space to fill the end of playback stream with silence when drain() is invoked.
 
int snd_pcm_hw_params_get_drain_silence (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val)
 Extract drain with the filling of silence samples from a configuration space.
 
int snd_pcm_hw_params_get_period_time (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract period time from a configuration space.
 
int snd_pcm_hw_params_get_period_time_min (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract minimum period time from a configuration space.
 
int snd_pcm_hw_params_get_period_time_max (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract maximum period time from a configuration space.
 
int snd_pcm_hw_params_test_period_time (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Verify if a period time is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_period_time (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Restrict a configuration space to contain only one period time.
 
int snd_pcm_hw_params_set_period_time_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a minimum period time.
 
int snd_pcm_hw_params_set_period_time_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a maximum period time.
 
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)
 Restrict a configuration space to have period times in a given range.
 
int snd_pcm_hw_params_set_period_time_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to have period time nearest to a target.
 
int snd_pcm_hw_params_set_period_time_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its minimum period time.
 
int snd_pcm_hw_params_set_period_time_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its maximum period time.
 
int snd_pcm_hw_params_get_period_size (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
 Extract period size from a configuration space.
 
int snd_pcm_hw_params_get_period_size_min (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
 Extract minimum period size from a configuration space.
 
int snd_pcm_hw_params_get_period_size_max (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
 Extract maximum period size from a configuration space.
 
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)
 Verify if a period size is available inside a configuration space for a PCM.
 
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)
 Restrict a configuration space to contain only one period size.
 
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)
 Restrict a configuration space with a minimum period size.
 
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)
 Restrict a configuration space with a maximum period size.
 
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)
 Restrict a configuration space to have period sizes in a given range.
 
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)
 Restrict a configuration space to have period size nearest to a target.
 
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)
 Restrict a configuration space to contain only its minimum period size.
 
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)
 Restrict a configuration space to contain only its maximum period size.
 
int snd_pcm_hw_params_set_period_size_integer (snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 Restrict a configuration space to contain only integer period sizes.
 
int snd_pcm_hw_params_get_periods (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract periods from a configuration space.
 
int snd_pcm_hw_params_get_periods_min (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract minimum periods count from a configuration space.
 
int snd_pcm_hw_params_get_periods_max (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract maximum periods count from a configuration space.
 
int snd_pcm_hw_params_test_periods (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Verify if a periods count is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_periods (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Restrict a configuration space to contain only one periods count.
 
int snd_pcm_hw_params_set_periods_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a minimum periods count.
 
int snd_pcm_hw_params_set_periods_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a maximum periods count.
 
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)
 Restrict a configuration space to have periods counts in a given range.
 
int snd_pcm_hw_params_set_periods_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to have periods count nearest to a target.
 
int snd_pcm_hw_params_set_periods_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its minimum periods count.
 
int snd_pcm_hw_params_set_periods_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its maximum periods count.
 
int snd_pcm_hw_params_set_periods_integer (snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
 Restrict a configuration space to contain only integer periods counts.
 
int snd_pcm_hw_params_get_buffer_time (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract buffer time from a configuration space.
 
int snd_pcm_hw_params_get_buffer_time_min (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract minimum buffer time from a configuration space.
 
int snd_pcm_hw_params_get_buffer_time_max (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Extract maximum buffer time from a configuration space.
 
int snd_pcm_hw_params_test_buffer_time (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Verify if a buffer time is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_buffer_time (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 Restrict a configuration space to contain only one buffer time.
 
int snd_pcm_hw_params_set_buffer_time_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a minimum buffer time.
 
int snd_pcm_hw_params_set_buffer_time_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space with a maximum buffer time.
 
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)
 Restrict a configuration space to have buffer times in a given range.
 
int snd_pcm_hw_params_set_buffer_time_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to have buffer time nearest to a target.
 
int snd_pcm_hw_params_set_buffer_time_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its minimum buffer time.
 
int snd_pcm_hw_params_set_buffer_time_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 Restrict a configuration space to contain only its maximum buffered time.
 
int snd_pcm_hw_params_get_buffer_size (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Extract buffer size from a configuration space.
 
int snd_pcm_hw_params_get_buffer_size_min (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Extract minimum buffer size from a configuration space.
 
int snd_pcm_hw_params_get_buffer_size_max (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Extract maximum buffer size from a configuration space.
 
int snd_pcm_hw_params_test_buffer_size (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
 Verify if a buffer size is available inside a configuration space for a PCM.
 
int snd_pcm_hw_params_set_buffer_size (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val)
 Restrict a configuration space to contain only one buffer size.
 
int snd_pcm_hw_params_set_buffer_size_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Restrict a configuration space with a minimum buffer size.
 
int snd_pcm_hw_params_set_buffer_size_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Restrict a configuration space with a maximum buffer size.
 
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)
 Restrict a configuration space to have buffer sizes in a given range.
 
int snd_pcm_hw_params_set_buffer_size_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Restrict a configuration space to have buffer size nearest to a target.
 
int snd_pcm_hw_params_set_buffer_size_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Restrict a configuration space to contain only its minimum buffer size.
 
int snd_pcm_hw_params_set_buffer_size_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Restrict a configuration space to contain only its maximum buffer size.
 
int snd_pcm_hw_params_get_tick_time (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Extract tick time from a configuration space
 
int snd_pcm_hw_params_get_tick_time_min (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Extract minimum tick time from a configuration space
 
int snd_pcm_hw_params_get_tick_time_max (const snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Extract maximum tick time from a configuration space
 
int snd_pcm_hw_params_test_tick_time (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 (DEPRECATED) Verify if a tick time is available inside a configuration space for a PCM
 
int snd_pcm_hw_params_set_tick_time (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir)
 (DEPRECATED) Restrict a configuration space to contain only one tick time
 
int snd_pcm_hw_params_set_tick_time_min (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Restrict a configuration space with a minimum tick time
 
int snd_pcm_hw_params_set_tick_time_max (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Restrict a configuration space with a maximum tick time
 
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)
 (DEPRECATED) Restrict a configuration space to have tick times in a given range
 
int snd_pcm_hw_params_set_tick_time_near (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Restrict a configuration space to have tick time nearest to a target
 
int snd_pcm_hw_params_set_tick_time_first (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Restrict a configuration space to contain only its minimum tick time
 
int snd_pcm_hw_params_set_tick_time_last (snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir)
 (DEPRECATED) Restrict a configuration space to contain only its maximum tick time
 
int snd_pcm_hw_params_get_min_align (const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val)
 Get the minimum transfer align value in samples.
 
int snd_pcm_sw_params_current (snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 Return current software configuration for a PCM.
 
int snd_pcm_sw_params_dump (snd_pcm_sw_params_t *params, snd_output_t *out)
 Dump a software configuration.
 
size_t snd_pcm_sw_params_sizeof ()
 get size of #snd_pcm_sw_params_t
 
int snd_pcm_sw_params_malloc (snd_pcm_sw_params_t **ptr)
 allocate an invalid #snd_pcm_sw_params_t using standard malloc
 
void snd_pcm_sw_params_free (snd_pcm_sw_params_t *obj)
 frees a previously allocated #snd_pcm_sw_params_t
 
void snd_pcm_sw_params_copy (snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src)
 copy one #snd_pcm_sw_params_t to another
 
int snd_pcm_sw_params_get_boundary (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 Get boundary for ring pointers from a software configuration container.
 
int snd_pcm_sw_params_set_start_mode (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val)
 (DEPRECATED) Set start mode inside a software configuration container
 
snd_pcm_start_t snd_pcm_sw_params_get_start_mode (const snd_pcm_sw_params_t *params)
 (DEPRECATED) Get start mode from a software configuration container
 
int snd_pcm_sw_params_set_xrun_mode (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val)
 (DEPRECATED) Set xrun mode inside a software configuration container
 
snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode (const snd_pcm_sw_params_t *params)
 (DEPRECATED) Get xrun mode from a software configuration container
 
int snd_pcm_sw_params_set_tstamp_mode (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val)
 Set timestamp mode inside a software configuration container.
 
int snd_pcm_sw_params_get_tstamp_mode (const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val)
 Get timestamp mode from a software configuration container.
 
int snd_pcm_sw_params_set_tstamp_type (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val)
 Set timestamp type inside a software configuration container.
 
int snd_pcm_sw_params_get_tstamp_type (const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val)
 Get timestamp type from a software configuration container.
 
int snd_pcm_sw_params_set_sleep_min (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val)
 (DEPRECATED) Set minimum number of ticks to sleep inside a software configuration container
 
int snd_pcm_sw_params_get_sleep_min (const snd_pcm_sw_params_t *params, unsigned int *val)
 (DEPRECATED) Get minimum numbers of ticks to sleep from a software configuration container
 
int snd_pcm_sw_params_set_avail_min (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
 Set avail min inside a software configuration container.
 
int snd_pcm_sw_params_get_avail_min (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 Get avail min from a software configuration container.
 
int snd_pcm_sw_params_set_period_event (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val)
 Set period event inside a software configuration container.
 
int snd_pcm_sw_params_get_period_event (const snd_pcm_sw_params_t *params, int *val)
 Get period event from a software configuration container.
 
int snd_pcm_sw_params_set_xfer_align (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
 (DEPRECATED) Set xfer align inside a software configuration container
 
int snd_pcm_sw_params_get_xfer_align (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 (DEPRECATED) Get xfer align from a software configuration container
 
int snd_pcm_sw_params_set_start_threshold (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
 Set start threshold inside a software configuration container.
 
int snd_pcm_sw_params_get_start_threshold (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 Get start threshold from a software configuration container.
 
int snd_pcm_sw_params_set_stop_threshold (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
 Set stop threshold inside a software configuration container.
 
int snd_pcm_sw_params_get_stop_threshold (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 Get stop threshold from a software configuration container.
 
int snd_pcm_sw_params_set_silence_threshold (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
 Set silence threshold inside a software configuration container.
 
int snd_pcm_sw_params_get_silence_threshold (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 Get silence threshold from a software configuration container.
 
int snd_pcm_sw_params_set_silence_size (snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val)
 Set silence size inside a software configuration container.
 
int snd_pcm_sw_params_get_silence_size (const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val)
 Get silence size from a software configuration container.
 
size_t snd_pcm_status_sizeof ()
 get size of #snd_pcm_status_t
 
int snd_pcm_status_malloc (snd_pcm_status_t **ptr)
 allocate an invalid #snd_pcm_status_t using standard malloc
 
void snd_pcm_status_free (snd_pcm_status_t *obj)
 frees a previously allocated #snd_pcm_status_t
 
void snd_pcm_status_copy (snd_pcm_status_t *dst, const snd_pcm_status_t *src)
 copy one #snd_pcm_status_t to another
 
snd_pcm_state_t snd_pcm_status_get_state (const snd_pcm_status_t *obj)
 Get state from a PCM status container (see snd_pcm_state)
 
void snd_pcm_status_get_trigger_tstamp (const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
 Get trigger timestamp from a PCM status container.
 
void snd_pcm_status_get_trigger_htstamp (const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
 Get trigger hi-res timestamp from a PCM status container.
 
void snd_pcm_status_get_tstamp (const snd_pcm_status_t *obj, snd_timestamp_t *ptr)
 Get "now" timestamp from a PCM status container.
 
void snd_pcm_status_get_htstamp (const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
 Get "now" hi-res timestamp from a PCM status container.
 
void snd_pcm_status_get_audio_htstamp (const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
 Get "now" hi-res audio timestamp from a PCM status container.
 
void snd_pcm_status_get_driver_htstamp (const snd_pcm_status_t *obj, snd_htimestamp_t *ptr)
 Get "now" hi-res driver timestamp from a PCM status container. Defines when the status was generated by driver, may differ from normal timestamp.
 
void snd_pcm_status_get_audio_htstamp_report (const snd_pcm_status_t *obj, snd_pcm_audio_tstamp_report_t *audio_tstamp_report)
 Get audio_tstamp_report from a PCM status container.
 
void snd_pcm_status_set_audio_htstamp_config (snd_pcm_status_t *obj, snd_pcm_audio_tstamp_config_t *audio_tstamp_config)
 set audio_tstamp_config from a PCM status container
 
snd_pcm_sframes_t snd_pcm_status_get_delay (const snd_pcm_status_t *obj)
 Get delay from a PCM status container (see snd_pcm_delay)
 
snd_pcm_uframes_t snd_pcm_status_get_avail (const snd_pcm_status_t *obj)
 Get number of frames available from a PCM status container (see snd_pcm_avail_update)
 
snd_pcm_uframes_t snd_pcm_status_get_avail_max (const snd_pcm_status_t *obj)
 Get maximum number of frames available from a PCM status container after last snd_pcm_status call.
 
snd_pcm_uframes_t snd_pcm_status_get_overrange (const snd_pcm_status_t *obj)
 Get count of ADC overrange detections since last call.
 
size_t snd_pcm_info_sizeof ()
 get size of #snd_pcm_info_t
 
int snd_pcm_info_malloc (snd_pcm_info_t **ptr)
 allocate an invalid #snd_pcm_info_t using standard malloc
 
void snd_pcm_info_free (snd_pcm_info_t *obj)
 frees a previously allocated #snd_pcm_info_t
 
void snd_pcm_info_copy (snd_pcm_info_t *dst, const snd_pcm_info_t *src)
 copy one #snd_pcm_info_t to another
 
unsigned int snd_pcm_info_get_device (const snd_pcm_info_t *obj)
 Get device from a PCM info container.
 
unsigned int snd_pcm_info_get_subdevice (const snd_pcm_info_t *obj)
 Get subdevice from a PCM info container.
 
snd_pcm_stream_t snd_pcm_info_get_stream (const snd_pcm_info_t *obj)
 Get stream (direction) from a PCM info container.
 
int snd_pcm_info_get_card (const snd_pcm_info_t *obj)
 Get card from a PCM info container.
 
const char * snd_pcm_info_get_id (const snd_pcm_info_t *obj)
 Get id from a PCM info container.
 
const char * snd_pcm_info_get_name (const snd_pcm_info_t *obj)
 Get name from a PCM info container.
 
const char * snd_pcm_info_get_subdevice_name (const snd_pcm_info_t *obj)
 Get subdevice name from a PCM info container.
 
snd_pcm_class_t snd_pcm_info_get_class (const snd_pcm_info_t *obj)
 Get class from a PCM info container.
 
snd_pcm_subclass_t snd_pcm_info_get_subclass (const snd_pcm_info_t *obj)
 Get subclass from a PCM info container.
 
unsigned int snd_pcm_info_get_subdevices_count (const snd_pcm_info_t *obj)
 Get subdevices count from a PCM info container.
 
unsigned int snd_pcm_info_get_subdevices_avail (const snd_pcm_info_t *obj)
 Get available subdevices count from a PCM info container.
 
snd_pcm_sync_id_t snd_pcm_info_get_sync (const snd_pcm_info_t *obj)
 (DEPRECATED) Get hardware synchronization ID from a PCM info container
 
void snd_pcm_info_set_device (snd_pcm_info_t *obj, unsigned int val)
 Set wanted device inside a PCM info container (see snd_ctl_pcm_info)
 
void snd_pcm_info_set_subdevice (snd_pcm_info_t *obj, unsigned int val)
 Set wanted subdevice inside a PCM info container (see snd_ctl_pcm_info)
 
void snd_pcm_info_set_stream (snd_pcm_info_t *obj, snd_pcm_stream_t val)
 Set wanted stream inside a PCM info container (see snd_ctl_pcm_info)
 
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)
 Application request to access a portion of direct (mmap) area.
 
snd_pcm_sframes_t snd_pcm_mmap_commit (snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t frames)
 Application has completed the access to area requested with snd_pcm_mmap_begin.
 
snd_pcm_chmap_query_t ** snd_pcm_query_chmaps (snd_pcm_t *pcm)
 
void snd_pcm_free_chmaps (snd_pcm_chmap_query_t **maps)
 
snd_pcm_chmap_t * snd_pcm_get_chmap (snd_pcm_t *pcm)
 
int snd_pcm_set_chmap (snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
 
const char * snd_pcm_chmap_type_name (enum snd_pcm_chmap_type val)
 
const char * snd_pcm_chmap_name (enum snd_pcm_chmap_position val)
 
const char * snd_pcm_chmap_long_name (enum snd_pcm_chmap_position val)
 
int snd_pcm_chmap_print (const snd_pcm_chmap_t *map, size_t maxlen, char *buf)
 
unsigned int snd_pcm_chmap_from_string (const char *str)
 
snd_pcm_chmap_t * snd_pcm_chmap_parse_string (const char *str)
 
int snd_pcm_recover (snd_pcm_t *pcm, int err, int silent)
 Recover the stream state from an error or suspend.
 
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)
 Set the hardware and software parameters in a simple way.
 
int snd_pcm_get_params (snd_pcm_t *pcm, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t *period_size)
 Get the transfer size parameters in a simple way.
 

Detailed Description

PCM Interface.

Author
Jaroslav Kysela perex.nosp@m.@per.nosp@m.ex.cz
Abramo Bagnara abram.nosp@m.o@al.nosp@m.sa-pr.nosp@m.ojec.nosp@m.t.org
Date
2000-2001

PCM Interface is designed to write or read digital audio frames. A frame is the data unit converted into/from sound in one time unit (1/rate seconds), by example if you set your playback PCM rate to 44100 you'll hear 44100 frames per second. The size in bytes of a frame may be obtained from bits needed to store a sample and channels count.

See the PCM (digital audio) interface page for more details.

Function Documentation

◆ snd_async_add_pcm_handler()

int snd_async_add_pcm_handler ( snd_async_handler_t ** handler,
snd_pcm_t * pcm,
snd_async_callback_t callback,
void * private_data )

Add an async handler for a PCM.

Parameters
handlerReturned handler handle
pcmPCM handle
callbackCallback function
private_dataCallback private data
Returns
0 otherwise a negative error code on failure

The asynchronous callback is called when period boundary elapses.

Examples
/test/pcm.c.

◆ snd_async_handler_get_pcm()

snd_pcm_t * snd_async_handler_get_pcm ( snd_async_handler_t * handler)

Return PCM handle related to an async handler.

Parameters
handlerAsync handler handle
Returns
PCM handle
Examples
/test/pcm.c.

◆ snd_pcm_access_mask_any()

void snd_pcm_access_mask_any ( snd_pcm_access_mask_t * mask)

set all bits in a #snd_pcm_access_mask_t

Parameters
maskpointer to mask

◆ snd_pcm_access_mask_copy()

void snd_pcm_access_mask_copy ( snd_pcm_access_mask_t * dst,
const snd_pcm_access_mask_t * src )

copy one #snd_pcm_access_mask_t to another

Parameters
dstpointer to destination
srcpointer to source

◆ snd_pcm_access_mask_empty()

int snd_pcm_access_mask_empty ( const snd_pcm_access_mask_t * mask)

test, if given a #snd_pcm_access_mask_t is empty

Parameters
maskpointer to mask
Return values
0not empty
1empty

◆ snd_pcm_access_mask_free()

void snd_pcm_access_mask_free ( snd_pcm_access_mask_t * obj)

frees a previously allocated #snd_pcm_access_mask_t

Parameters
objpointer to object to free

◆ snd_pcm_access_mask_malloc()

int snd_pcm_access_mask_malloc ( snd_pcm_access_mask_t ** ptr)

allocate an empty #snd_pcm_access_mask_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_access_mask_none()

void snd_pcm_access_mask_none ( snd_pcm_access_mask_t * mask)

reset all bits in a #snd_pcm_access_mask_t

Parameters
maskpointer to mask

◆ snd_pcm_access_mask_reset()

void snd_pcm_access_mask_reset ( snd_pcm_access_mask_t * mask,
snd_pcm_access_t val )

make an access type missing from a #snd_pcm_access_mask_t

Parameters
maskpointer to mask
valaccess type

◆ snd_pcm_access_mask_set()

void snd_pcm_access_mask_set ( snd_pcm_access_mask_t * mask,
snd_pcm_access_t val )

make an access type present in a #snd_pcm_access_mask_t

Parameters
maskpointer to mask
valaccess type

◆ snd_pcm_access_mask_sizeof()

size_t snd_pcm_access_mask_sizeof ( )

get size of #snd_pcm_access_mask_t

Returns
size in bytes

◆ snd_pcm_access_mask_test()

int snd_pcm_access_mask_test ( const snd_pcm_access_mask_t * mask,
snd_pcm_access_t val )

test the presence of an access type in a #snd_pcm_access_mask_t

Parameters
maskpointer to mask
valaccess type

◆ snd_pcm_access_name()

const char * snd_pcm_access_name ( const snd_pcm_access_t acc)

get name of PCM access type

Parameters
accPCM access type
Returns
ascii name of PCM access type

◆ snd_pcm_area_copy()

int snd_pcm_area_copy ( const snd_pcm_channel_area_t * dst_area,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t * src_area,
snd_pcm_uframes_t src_offset,
unsigned int samples,
snd_pcm_format_t format )

Copy an area.

Parameters
dst_areadestination area specification
dst_offsetoffset in frames inside destination area
src_areasource area specification
src_offsetoffset in frames inside source area
samplessamples to copy
formatPCM sample format
Returns
0 on success otherwise a negative error code

◆ snd_pcm_area_silence()

int snd_pcm_area_silence ( const snd_pcm_channel_area_t * dst_area,
snd_pcm_uframes_t dst_offset,
unsigned int samples,
snd_pcm_format_t format )

Silence an area.

Parameters
dst_areaarea specification
dst_offsetoffset in frames inside area
samplessamples to silence
formatPCM sample format
Returns
0 on success otherwise a negative error code

◆ snd_pcm_areas_copy()

int snd_pcm_areas_copy ( const snd_pcm_channel_area_t * dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t * src_areas,
snd_pcm_uframes_t src_offset,
unsigned int channels,
snd_pcm_uframes_t frames,
snd_pcm_format_t format )

Copy one or more areas.

Parameters
dst_areasdestination areas specification (one for each channel)
dst_offsetoffset in frames inside destination area
src_areassource areas specification (one for each channel)
src_offsetoffset in frames inside source area
channelschannels count
framesframes to copy
formatPCM sample format
Returns
0 on success otherwise a negative error code

◆ snd_pcm_areas_copy_wrap()

int snd_pcm_areas_copy_wrap ( const snd_pcm_channel_area_t * dst_channels,
snd_pcm_uframes_t dst_offset,
const snd_pcm_uframes_t dst_size,
const snd_pcm_channel_area_t * src_channels,
snd_pcm_uframes_t src_offset,
const snd_pcm_uframes_t src_size,
const unsigned int channels,
snd_pcm_uframes_t frames,
const snd_pcm_format_t format )

Copy one or more areas.

Parameters
dst_channelsdestination areas specification (one for each channel)
dst_offsetoffset in frames inside destination area
dst_sizesize in frames of the destination buffer
src_channelssource areas specification (one for each channel)
src_offsetoffset in frames inside source area
src_sizesize in frames of the source buffer
channelschannels count
framesframes to copy
formatPCM sample format
Returns
0 on success otherwise a negative error code

◆ snd_pcm_areas_silence()

int snd_pcm_areas_silence ( const snd_pcm_channel_area_t * dst_areas,
snd_pcm_uframes_t dst_offset,
unsigned int channels,
snd_pcm_uframes_t frames,
snd_pcm_format_t format )

Silence one or more areas.

Parameters
dst_areasareas specification (one for each channel)
dst_offsetoffset in frames inside area
channelschannels count
framesframes to silence
formatPCM sample format
Returns
0 on success otherwise a negative error code

◆ snd_pcm_avail()

snd_pcm_sframes_t snd_pcm_avail ( snd_pcm_t * pcm)

Return number of frames ready to be read (capture) / written (playback)

Parameters
pcmPCM handle
Returns
a positive number of frames ready otherwise a negative error code

On capture does all the actions needed to transport to application level all the ready frames across underlying layers.

The position is synced with hardware (driver) position in the sound ring buffer in this functions.

The function is thread-safe when built with the proper option.

Examples
/test/latency.c.

◆ snd_pcm_avail_delay()

int snd_pcm_avail_delay ( snd_pcm_t * pcm,
snd_pcm_sframes_t * availp,
snd_pcm_sframes_t * delayp )

Combine snd_pcm_avail and snd_pcm_delay functions.

Parameters
pcmPCM handle
availpNumber of available frames in the ring buffer
delaypTotal I/O latency in frames
Returns
zero on success otherwise a negative error code

The avail and delay values returned are in sync.

The function is thread-safe when built with the proper option.

◆ snd_pcm_avail_update()

snd_pcm_sframes_t snd_pcm_avail_update ( snd_pcm_t * pcm)

Return number of frames ready to be read (capture) / written (playback)

Parameters
pcmPCM handle
Returns
a positive number of frames ready otherwise a negative error code

On capture does all the actions needed to transport to application level all the ready frames across underlying layers.

The position is not synced with hardware (driver) position in the sound ring buffer in this function. This function is a light version of snd_pcm_avail() .

Using this function is ideal after poll() or select() when audio file descriptor made the event and when application expects just period timing.

Also this function might be called after snd_pcm_delay() or snd_pcm_hwsync() functions to move private ring buffer pointers in alsa-lib (the internal plugin chain).

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_bytes_to_frames()

snd_pcm_sframes_t snd_pcm_bytes_to_frames ( snd_pcm_t * pcm,
ssize_t bytes )

Convert bytes in frames for a PCM.

Parameters
pcmPCM handle
bytesquantity in bytes
Returns
quantity expressed in frames

◆ snd_pcm_bytes_to_samples()

long snd_pcm_bytes_to_samples ( snd_pcm_t * pcm,
ssize_t bytes )

Convert bytes in samples for a PCM.

Parameters
pcmPCM handle
bytesquantity in bytes
Returns
quantity expressed in samples

◆ snd_pcm_chmap_from_string()

unsigned int snd_pcm_chmap_from_string ( const char * str)

!brief Convert from string to channel position

Parameters
strThe string to parse
Returns
The channel position value or -1 as an error

◆ snd_pcm_chmap_long_name()

const char * snd_pcm_chmap_long_name ( enum snd_pcm_chmap_position val)

!brief Get a longer name string for a standard channel map position

Parameters
valChannel position
Returns
The string corresponding to the given position, or NULL

◆ snd_pcm_chmap_name()

const char * snd_pcm_chmap_name ( enum snd_pcm_chmap_position val)

!brief Get a name string for a standard channel map position

Parameters
valChannel position
Returns
The string corresponding to the given position, or NULL

◆ snd_pcm_chmap_parse_string()

snd_pcm_chmap_t * snd_pcm_chmap_parse_string ( const char * str)

!brief Convert from string to channel map

Parameters
strThe string to parse
Returns
The channel map

Note: the caller is requested to release the returned value via free()

◆ snd_pcm_chmap_print()

int snd_pcm_chmap_print ( const snd_pcm_chmap_t * map,
size_t maxlen,
char * buf )

!brief Print the channels in chmap on the buffer

Parameters
mapThe channel map to print
maxlenThe maximal length to write (including NUL letter)
bufThe buffer to write
Returns
The actual string length or a negative error code

◆ snd_pcm_chmap_type_name()

const char * snd_pcm_chmap_type_name ( enum snd_pcm_chmap_type val)

!brief Get a name string for a channel map type as query results

Parameters
valChannel position
Returns
The string corresponding to the given type, or NULL

◆ snd_pcm_close()

int snd_pcm_close ( snd_pcm_t * pcm)

close PCM handle

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

Closes the specified PCM handle and frees all associated resources.

Examples
/test/latency.c, /test/pcm.c, and /test/pcm_min.c.

◆ snd_pcm_delay()

int snd_pcm_delay ( snd_pcm_t * pcm,
snd_pcm_sframes_t * delayp )

Obtain delay for a running PCM handle.

Parameters
pcmPCM handle
delaypReturned delay in frames
Returns
0 on success otherwise a negative error code

For playback the delay is defined as the time that a frame that is written to the PCM stream shortly after this call will take to be actually audible. It is as such the overall latency from the write call to the final DAC.

For capture the delay is defined as the time that a frame that was digitized by the audio device takes until it can be read from the PCM stream shortly after this call returns. It is as such the overall latency from the initial ADC to the read call.

Please note that hence in case of a playback underrun this value will not necessarily got down to 0.

If the application is interested in the fill level of the playback buffer of the device, it should use snd_pcm_avail*() functions. The value returned by that call is not directly related to the delay, since the latter might include some additional, fixed latencies the former does not.

Note this function does not update the actual r/w pointer for applications. The function snd_pcm_avail_update() have to be called before any begin+commit operation.

The function is thread-safe when built with the proper option.

◆ snd_pcm_drain()

int snd_pcm_drain ( snd_pcm_t * pcm)

Stop a PCM preserving pending frames.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code
Return values
-ESTRPIPEa suspend event occurred

For playback wait for all pending frames to be played and then stop the PCM. For capture stop PCM permitting to retrieve residual frames.

For stopping the PCM stream immediately, use ::snd_pcm_drop() instead.

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, and /test/pcm_min.c.

◆ snd_pcm_drop()

int snd_pcm_drop ( snd_pcm_t * pcm)

Stop a PCM dropping pending frames.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

This function stops the PCM immediately. The pending samples on the buffer are ignored.

For processing all pending samples, use ::snd_pcm_drain() instead.

The function is thread-safe when built with the proper option.

Examples
/test/latency.c.

◆ snd_pcm_dump()

int snd_pcm_dump ( snd_pcm_t * pcm,
snd_output_t * out )

Dump PCM info.

Parameters
pcmPCM handle
outOutput handle
Returns
0 on success otherwise a negative error code
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_dump_hw_setup()

int snd_pcm_dump_hw_setup ( snd_pcm_t * pcm,
snd_output_t * out )

Dump current hardware setup for PCM.

Parameters
pcmPCM handle
outOutput handle
Returns
0 on success otherwise a negative error code

◆ snd_pcm_dump_setup()

int snd_pcm_dump_setup ( snd_pcm_t * pcm,
snd_output_t * out )

Dump current setup (hardware and software) for PCM.

Parameters
pcmPCM handle
outOutput handle
Returns
0 on success otherwise a negative error code

◆ snd_pcm_dump_sw_setup()

int snd_pcm_dump_sw_setup ( snd_pcm_t * pcm,
snd_output_t * out )

Dump current software setup for PCM.

Parameters
pcmPCM handle
outOutput handle
Returns
0 on success otherwise a negative error code

◆ snd_pcm_format_description()

const char * snd_pcm_format_description ( const snd_pcm_format_t format)

get description of PCM sample format

Parameters
formatPCM sample format
Returns
ascii description of PCM sample format

◆ snd_pcm_format_mask_any()

void snd_pcm_format_mask_any ( snd_pcm_format_mask_t * mask)

set all bits in a #snd_pcm_format_mask_t

Parameters
maskpointer to mask

◆ snd_pcm_format_mask_copy()

void snd_pcm_format_mask_copy ( snd_pcm_format_mask_t * dst,
const snd_pcm_format_mask_t * src )

copy one #snd_pcm_format_mask_t to another

Parameters
dstpointer to destination
srcpointer to source

◆ snd_pcm_format_mask_empty()

int snd_pcm_format_mask_empty ( const snd_pcm_format_mask_t * mask)

test, if given a #snd_pcm_format_mask_t is empty

Parameters
maskpointer to mask
Return values
0not empty
1empty

◆ snd_pcm_format_mask_free()

void snd_pcm_format_mask_free ( snd_pcm_format_mask_t * obj)

frees a previously allocated #snd_pcm_format_mask_t

Parameters
objpointer to object to free

◆ snd_pcm_format_mask_malloc()

int snd_pcm_format_mask_malloc ( snd_pcm_format_mask_t ** ptr)

allocate an empty #snd_pcm_format_mask_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_format_mask_none()

void snd_pcm_format_mask_none ( snd_pcm_format_mask_t * mask)

reset all bits in a #snd_pcm_format_mask_t

Parameters
maskpointer to mask

◆ snd_pcm_format_mask_reset()

void snd_pcm_format_mask_reset ( snd_pcm_format_mask_t * mask,
snd_pcm_format_t val )

make a format missing from a #snd_pcm_format_mask_t

Parameters
maskpointer to mask
valformat

◆ snd_pcm_format_mask_set()

void snd_pcm_format_mask_set ( snd_pcm_format_mask_t * mask,
snd_pcm_format_t val )

make a format present in a #snd_pcm_format_mask_t

Parameters
maskpointer to mask
valformat

◆ snd_pcm_format_mask_sizeof()

size_t snd_pcm_format_mask_sizeof ( )

get size of #snd_pcm_format_mask_t

Returns
size in bytes

◆ snd_pcm_format_mask_test()

int snd_pcm_format_mask_test ( const snd_pcm_format_mask_t * mask,
snd_pcm_format_t val )

test the presence of a format in a #snd_pcm_format_mask_t

Parameters
maskpointer to mask
valformat

◆ snd_pcm_format_name()

const char * snd_pcm_format_name ( const snd_pcm_format_t format)

get name of PCM sample format

Parameters
formatPCM sample format
Returns
ascii name of PCM sample format
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_format_value()

snd_pcm_format_t snd_pcm_format_value ( const char * name)

get PCM sample format from name

Parameters
namePCM sample format name (case insensitive)
Returns
PCM sample format
Examples
/test/latency.c.

◆ snd_pcm_forward()

snd_pcm_sframes_t snd_pcm_forward ( snd_pcm_t * pcm,
snd_pcm_uframes_t frames )

Move application frame position forward.

Parameters
pcmPCM handle
frameswanted skip in frames
Returns
a positive number for actual skip otherwise a negative error code
Return values
0means no action

The function is thread-safe when built with the proper option.

◆ snd_pcm_forwardable()

snd_pcm_sframes_t snd_pcm_forwardable ( snd_pcm_t * pcm)

Get safe count of frames which can be forwarded.

Parameters
pcmPCM handle
Returns
a positive number of frames or negative error code

Note: The snd_pcm_forward() can accept bigger value than returned by this function. But it is not guaranteed that output stream will be consistent with bigger value.

The function is thread-safe when built with the proper option.

◆ snd_pcm_frames_to_bytes()

ssize_t snd_pcm_frames_to_bytes ( snd_pcm_t * pcm,
snd_pcm_sframes_t frames )

Convert frames in bytes for a PCM.

Parameters
pcmPCM handle
framesquantity in frames
Returns
quantity expressed in bytes

◆ snd_pcm_free_chmaps()

void snd_pcm_free_chmaps ( snd_pcm_chmap_query_t ** maps)

!brief Release the channel map array allocated via snd_pcm_query_chmaps

Parameters
mapsthe array pointer to release

◆ snd_pcm_get_chmap()

snd_pcm_chmap_t * snd_pcm_get_chmap ( snd_pcm_t * pcm)

!brief Get the current channel map

Parameters
pcmPCM instance
Returns
the current channel map, or NULL if error

Note: the caller is requested to release the returned value via free()

◆ snd_pcm_get_params()

int snd_pcm_get_params ( snd_pcm_t * pcm,
snd_pcm_uframes_t * buffer_size,
snd_pcm_uframes_t * period_size )

Get the transfer size parameters in a simple way.

Parameters
pcmPCM handle
buffer_sizePCM ring buffer size in frames
period_sizePCM period size in frames
Returns
0 on success otherwise a negative error code

◆ snd_pcm_htimestamp()

int snd_pcm_htimestamp ( snd_pcm_t * pcm,
snd_pcm_uframes_t * avail,
snd_htimestamp_t * tstamp )

Obtain last position update hi-res timestamp.

Parameters
pcmPCM handle
availNumber of available frames when timestamp was grabbed
tstampHi-res timestamp
Returns
0 on success otherwise a negative error code

Note this function does not update the actual r/w pointer for applications.

The function is thread-safe when built with the proper option.

◆ snd_pcm_hw_free()

int snd_pcm_hw_free ( snd_pcm_t * pcm)

Remove PCM hardware configuration and free associated resources.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

The function will also report success if no configuration is set.

Examples
/test/latency.c.

◆ snd_pcm_hw_params()

int snd_pcm_hw_params ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params )

Install one PCM hardware configuration chosen from a configuration space and snd_pcm_prepare it.

Parameters
pcmPCM handle
paramsConfiguration space definition container
Returns
0 on success otherwise a negative error code

The configuration is chosen fixing single parameters in this order: first access, first format, first subformat, min channels, min rate, min period time, max buffer size, min tick time. If no mutually compatible set of parameters can be chosen, a negative error code will be returned.

After this call, snd_pcm_prepare() is called automatically and the stream is brought to #SND_PCM_STATE_PREPARED state.

The hardware parameters cannot be changed when the stream is running (active). The software parameters can be changed at any time.

The configuration space will be updated to reflect the chosen parameters.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_any()

int snd_pcm_hw_params_any ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params )

Fill params with a full configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space

The configuration space will be filled with all possible ranges for the PCM device.

Note that the configuration space may be constrained by the currently installed configuration on the PCM device. To remove any constrains, free the configuration with snd_pcm_hw_free first.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_can_disable_period_wakeup()

int snd_pcm_hw_params_can_disable_period_wakeup ( const snd_pcm_hw_params_t * params)

Check if hardware can disable period wakeups.

Parameters
paramsConfiguration space
Return values
0Hardware cannot disable period wakeups
1Hardware can disable period wakeups
Examples
/test/latency.c.

◆ snd_pcm_hw_params_can_mmap_sample_resolution()

int snd_pcm_hw_params_can_mmap_sample_resolution ( const snd_pcm_hw_params_t * params)

Check if hardware supports sample-resolution mmap for given configuration.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't support sample-resolution mmap
1Hardware supports sample-resolution mmap

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_can_overrange()

int snd_pcm_hw_params_can_overrange ( const snd_pcm_hw_params_t * params)

Check if hardware supports overrange detection.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't support overrange detection
1Hardware supports overrange detection

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_can_pause()

int snd_pcm_hw_params_can_pause ( const snd_pcm_hw_params_t * params)

Check if hardware supports pause.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't support pause
1Hardware supports pause

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_can_resume()

int snd_pcm_hw_params_can_resume ( const snd_pcm_hw_params_t * params)

Check if hardware supports resume.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't support resume
1Hardware supports resume

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_can_sync_start()

int snd_pcm_hw_params_can_sync_start ( const snd_pcm_hw_params_t * params)

Check if hardware supports synchronized start with sample resolution.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't support synchronized start
1Hardware supports synchronized start

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_copy()

void snd_pcm_hw_params_copy ( snd_pcm_hw_params_t * dst,
const snd_pcm_hw_params_t * src )

copy one #snd_pcm_hw_params_t to another

Parameters
dstpointer to destination
srcpointer to source
Examples
/test/latency.c.

◆ snd_pcm_hw_params_current()

int snd_pcm_hw_params_current ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params )

Retreive current PCM hardware configuration chosen with snd_pcm_hw_params.

Parameters
pcmPCM handle
paramsConfiguration space definition container
Returns
0 on success otherwise a negative error code
Return values
-EBADFDno hardware configuration is set

◆ snd_pcm_hw_params_dump()

int snd_pcm_hw_params_dump ( snd_pcm_hw_params_t * params,
snd_output_t * out )

Dump a PCM hardware configuration space.

Parameters
paramsConfiguration space
outOutput handle
Returns
0 on success otherwise a negative error code

◆ snd_pcm_hw_params_free()

void snd_pcm_hw_params_free ( snd_pcm_hw_params_t * obj)

frees a previously allocated #snd_pcm_hw_params_t

Parameters
objpointer to object to free

◆ snd_pcm_hw_params_get_access()

int snd_pcm_hw_params_get_access ( const snd_pcm_hw_params_t * params,
snd_pcm_access_t * access )

Extract access type from a configuration space.

Parameters
paramsConfiguration space
accessReturned value
Returns
access type otherwise a negative error code if the configuration space does not contain a single value

◆ snd_pcm_hw_params_get_access_mask()

int snd_pcm_hw_params_get_access_mask ( snd_pcm_hw_params_t * params,
snd_pcm_access_mask_t * mask )

Get access mask from a configuration space.

Parameters
paramsConfiguration space
maskReturned Access mask

◆ snd_pcm_hw_params_get_buffer_size()

int snd_pcm_hw_params_get_buffer_size ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Extract buffer size from a configuration space.

Parameters
paramsConfiguration space
valReturned buffer size in frames
Returns
0 otherwise a negative error code if the configuration space does not contain a single value
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_get_buffer_size_max()

int snd_pcm_hw_params_get_buffer_size_max ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Extract maximum buffer size from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate maximum buffer size in frames
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_buffer_size_min()

int snd_pcm_hw_params_get_buffer_size_min ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Extract minimum buffer size from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate minimum buffer size in frames
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_get_buffer_time()

int snd_pcm_hw_params_get_buffer_time ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract buffer time from a configuration space.

Parameters
paramsConfiguration space
valReturned buffer time in us
dirSub unit direction
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_get_buffer_time_max()

int snd_pcm_hw_params_get_buffer_time_max ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract maximum buffer time from a configuration space.

Parameters
paramsConfiguration space
valapproximate maximum buffer duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_buffer_time_min()

int snd_pcm_hw_params_get_buffer_time_min ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract minimum buffer time from a configuration space.

Parameters
paramsConfiguration space
valapproximate minimum buffer duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_channels()

int snd_pcm_hw_params_get_channels ( const snd_pcm_hw_params_t * params,
unsigned int * val )

Extract channels from a configuration space.

Parameters
paramsConfiguration space
valReturned channels count
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

◆ snd_pcm_hw_params_get_channels_max()

int snd_pcm_hw_params_get_channels_max ( const snd_pcm_hw_params_t * params,
unsigned int * val )

Extract maximum channels count from a configuration space.

Parameters
paramsConfiguration space
valmaximum channels count
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_get_channels_min()

int snd_pcm_hw_params_get_channels_min ( const snd_pcm_hw_params_t * params,
unsigned int * val )

Extract minimum channels count from a configuration space.

Parameters
paramsConfiguration space
valminimum channels count
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_get_drain_silence()

int snd_pcm_hw_params_get_drain_silence ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Extract drain with the filling of silence samples from a configuration space.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disabled, 1 = enabled
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_get_export_buffer()

int snd_pcm_hw_params_get_export_buffer ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Extract buffer accessibility from a configuration space.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disable, 1 = enable exporting buffer
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_get_fifo_size()

int snd_pcm_hw_params_get_fifo_size ( const snd_pcm_hw_params_t * params)

Get hardware FIFO size info from a configuration space.

Parameters
paramsConfiguration space
Returns
FIFO size in frames otherwise a negative error code if the info is not available

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_get_format()

int snd_pcm_hw_params_get_format ( const snd_pcm_hw_params_t * params,
snd_pcm_format_t * format )

Extract format from a configuration space.

Parameters
paramsConfiguration space
formatreturned format
Returns
format otherwise a negative error code if the configuration space does not contain a single value

◆ snd_pcm_hw_params_get_format_mask()

void snd_pcm_hw_params_get_format_mask ( snd_pcm_hw_params_t * params,
snd_pcm_format_mask_t * mask )

Get format mask from a configuration space.

Parameters
paramsConfiguration space
maskReturned Format mask

◆ snd_pcm_hw_params_get_min_align()

int snd_pcm_hw_params_get_min_align ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Get the minimum transfer align value in samples.

Parameters
paramsConfiguration space
valReturned minimum align value
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

◆ snd_pcm_hw_params_get_period_size()

int snd_pcm_hw_params_get_period_size ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val,
int * dir )

Extract period size from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate period size in frames
dirSub unit direction
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_get_period_size_max()

int snd_pcm_hw_params_get_period_size_max ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val,
int * dir )

Extract maximum period size from a configuration space.

Parameters
paramsConfiguration space
valapproximate minimum period size in frames
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_period_size_min()

int snd_pcm_hw_params_get_period_size_min ( const snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val,
int * dir )

Extract minimum period size from a configuration space.

Parameters
paramsConfiguration space
valapproximate minimum period size in frames
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_period_time()

int snd_pcm_hw_params_get_period_time ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract period time from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate period duration in us
dirSub unit direction
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

Examples
/test/latency.c.

◆ snd_pcm_hw_params_get_period_time_max()

int snd_pcm_hw_params_get_period_time_max ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract maximum period time from a configuration space.

Parameters
paramsConfiguration space
valapproximate maximum period duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_period_time_min()

int snd_pcm_hw_params_get_period_time_min ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract minimum period time from a configuration space.

Parameters
paramsConfiguration space
valapproximate minimum period duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_period_wakeup()

int snd_pcm_hw_params_get_period_wakeup ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Extract period wakeup flag from a configuration space.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disabled, 1 = enabled period wakeups
Returns
Zero on success, otherwise a negative error code.

◆ snd_pcm_hw_params_get_periods()

int snd_pcm_hw_params_get_periods ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract periods from a configuration space.

Parameters
paramsConfiguration space
valapproximate periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_get_periods_max()

int snd_pcm_hw_params_get_periods_max ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract maximum periods count from a configuration space.

Parameters
paramsConfiguration space
valapproximate maximum periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_periods_min()

int snd_pcm_hw_params_get_periods_min ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract minimum periods count from a configuration space.

Parameters
paramsConfiguration space
valapproximate minimum periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

Examples
/test/latency.c.

◆ snd_pcm_hw_params_get_rate()

int snd_pcm_hw_params_get_rate ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract rate from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate rate
dirSub unit direction
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_get_rate_max()

int snd_pcm_hw_params_get_rate_max ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract maximum rate from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate maximum rate
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_rate_min()

int snd_pcm_hw_params_get_rate_min ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Extract minimum rate from a configuration space.

Parameters
paramsConfiguration space
valReturned approximate minimum rate
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_rate_numden()

int snd_pcm_hw_params_get_rate_numden ( const snd_pcm_hw_params_t * params,
unsigned int * rate_num,
unsigned int * rate_den )

Get rate exact info from a configuration space.

Parameters
paramsConfiguration space
rate_numPointer to returned rate numerator
rate_denPointer to returned rate denominator
Returns
0 otherwise a negative error code if the info is not available

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_get_rate_resample()

int snd_pcm_hw_params_get_rate_resample ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Extract resample state from a configuration space.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disable, 1 = enable rate resampling
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_get_sbits()

int snd_pcm_hw_params_get_sbits ( const snd_pcm_hw_params_t * params)

Get sample resolution info from a configuration space.

Parameters
paramsConfiguration space
Returns
sample resolution (in bits) otherwise a negative error code if the info is not available

For linear formats, this function returns sample resolution - used bits starting from the first usable significant bit defined by the format (e.g. bit 31 for S32_LE format or bit 23 for S24_LE format - starting from bit zero). Application may use full sample bit range defined by the format, but additional bits (outside this sample resolution) are stripped (not processed).

For non-linear formats, this value may have a special meaning which may be defined in future.

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_get_subformat()

int snd_pcm_hw_params_get_subformat ( const snd_pcm_hw_params_t * params,
snd_pcm_subformat_t * subformat )

Extract subformat from a configuration space.

Parameters
paramsConfiguration space
subformatReturned subformat value
Returns
subformat otherwise a negative error code if the configuration space does not contain a single value

◆ snd_pcm_hw_params_get_subformat_mask()

void snd_pcm_hw_params_get_subformat_mask ( snd_pcm_hw_params_t * params,
snd_pcm_subformat_mask_t * mask )

Get subformat mask from a configuration space.

Parameters
paramsConfiguration space
maskReturned Subformat mask

◆ snd_pcm_hw_params_get_sync()

const unsigned char * snd_pcm_hw_params_get_sync ( const snd_pcm_hw_params_t * params)

Get hardware synchronization ID from a PCM info container.

Parameters
paramsConfiguration space
Returns
16-byte synchronization ID (use #SND_PCM_HW_PARAMS_SYNC_SIZE)

This synchronization ID determines the similar clocks for the PCM stream between multiple devices (including different cards). "All zeros" means "not set". The contents of the ID can be used only for a comparison with the contents of another ID returned from this function. Applications should not do a comparison with hard-coded values, because the implementation generating such synchronization IDs may be changed in future.

◆ snd_pcm_hw_params_get_tick_time()

int snd_pcm_hw_params_get_tick_time ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Extract tick time from a configuration space

Parameters
paramsConfiguration space
valReturned approximate tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code if the configuration space does not contain a single value

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_get_tick_time_max()

int snd_pcm_hw_params_get_tick_time_max ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Extract maximum tick time from a configuration space

Parameters
paramsConfiguration space
valReturned approximate maximum tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_get_tick_time_min()

int snd_pcm_hw_params_get_tick_time_min ( const snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Extract minimum tick time from a configuration space

Parameters
paramsConfiguration space
valReturned approximate minimum tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Exact value is <,=,> the returned one following dir (-1,0,1)

◆ snd_pcm_hw_params_is_batch()

int snd_pcm_hw_params_is_batch ( const snd_pcm_hw_params_t * params)

Check if hardware does double buffering for data transfers for given configuration.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't do double buffering for data transfers
1Hardware does double buffering for data transfers

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_is_block_transfer()

int snd_pcm_hw_params_is_block_transfer ( const snd_pcm_hw_params_t * params)

Check if hardware does block transfers for samples for given configuration.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't block transfers
1Hardware does block transfers

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_is_double()

int snd_pcm_hw_params_is_double ( const snd_pcm_hw_params_t * params)

Check if hardware does double buffering for start/stop for given configuration.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't do double buffering for start/stop
1Hardware does double buffering for start/stop

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_is_half_duplex()

int snd_pcm_hw_params_is_half_duplex ( const snd_pcm_hw_params_t * params)

Check if hardware does half-duplex only.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't do half-duplex
1Hardware does half-duplex

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_is_joint_duplex()

int snd_pcm_hw_params_is_joint_duplex ( const snd_pcm_hw_params_t * params)

Check if hardware does joint-duplex (playback and capture are somewhat correlated)

Parameters
paramsConfiguration space
Return values
0Hardware doesn't do joint-duplex
1Hardware does joint-duplex

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_is_monotonic()

int snd_pcm_hw_params_is_monotonic ( const snd_pcm_hw_params_t * params)

Check if timestamps are monotonic for given configuration.

Parameters
paramsConfiguration space
Return values
0Device doesn't do monotomic timestamps
1Device does monotonic timestamps

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_is_perfect_drain()

int snd_pcm_hw_params_is_perfect_drain ( const snd_pcm_hw_params_t * params)

Check if hardware is capable of perfect drain.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't do perfect drain
1Hardware does perfect drain

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

Perfect drain means that the hardware does not use samples beyond the stream application pointer.

◆ snd_pcm_hw_params_malloc()

int snd_pcm_hw_params_malloc ( snd_pcm_hw_params_t ** ptr)

allocate an invalid #snd_pcm_hw_params_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_hw_params_set_access()

int snd_pcm_hw_params_set_access ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_access_t access )

Restrict a configuration space to contain only one access type.

Parameters
pcmPCM handle
paramsConfiguration space
accessaccess type
Returns
0 otherwise a negative error code if configuration space would become empty
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_set_access_first()

int snd_pcm_hw_params_set_access_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_access_t * access )

Restrict a configuration space to contain only its first access type.

Parameters
pcmPCM handle
paramsConfiguration space
accessReturned first access type
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_access_last()

int snd_pcm_hw_params_set_access_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_access_t * access )

Restrict a configuration space to contain only its last access type.

Parameters
pcmPCM handle
paramsConfiguration space
accessReturned last access type
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_access_mask()

int snd_pcm_hw_params_set_access_mask ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_access_mask_t * mask )

Restrict a configuration space to contain only a set of access types.

Parameters
pcmPCM handle
paramsConfiguration space
maskAccess mask
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_buffer_size()

int snd_pcm_hw_params_set_buffer_size ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t val )

Restrict a configuration space to contain only one buffer size.

Parameters
pcmPCM handle
paramsConfiguration space
valbuffer size in frames
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_buffer_size_first()

int snd_pcm_hw_params_set_buffer_size_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Restrict a configuration space to contain only its minimum buffer size.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned minimum buffer size in frames
Returns
buffer size in frames

◆ snd_pcm_hw_params_set_buffer_size_last()

int snd_pcm_hw_params_set_buffer_size_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Restrict a configuration space to contain only its maximum buffer size.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned maximum buffer size in frames
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_buffer_size_max()

int snd_pcm_hw_params_set_buffer_size_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Restrict a configuration space with a maximum buffer size.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum buffer size in frames (on return filled with actual maximum)
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_buffer_size_min()

int snd_pcm_hw_params_set_buffer_size_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Restrict a configuration space with a minimum buffer size.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum buffer size in frames (on return filled with actual minimum)
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_buffer_size_minmax()

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 )

Restrict a configuration space to have buffer sizes in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum buffer size in frames (on return filled with actual minimum)
maxapproximate maximum buffer size in frames (on return filled with actual maximum)
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_buffer_size_near()

int snd_pcm_hw_params_set_buffer_size_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t * val )

Restrict a configuration space to have buffer size nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target buffer size in frames / returned chosen approximate target buffer size in frames
Returns
0 otherwise a negative error code if configuration space is empty
Examples
/test/latency.c.

◆ snd_pcm_hw_params_set_buffer_time()

int snd_pcm_hw_params_set_buffer_time ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Restrict a configuration space to contain only one buffer time.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate buffer duration in us
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_buffer_time_first()

int snd_pcm_hw_params_set_buffer_time_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its minimum buffer time.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate minimum buffer duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_buffer_time_last()

int snd_pcm_hw_params_set_buffer_time_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its maximum buffered time.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate maximum buffer duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_buffer_time_max()

int snd_pcm_hw_params_set_buffer_time_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a maximum buffer time.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum buffer duration in us (on return filled with actual maximum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_buffer_time_min()

int snd_pcm_hw_params_set_buffer_time_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a minimum buffer time.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum buffer duration in us (on return filled with actual minimum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_buffer_time_minmax()

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 )

Restrict a configuration space to have buffer times in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum buffer duration in us (on return filled with actual minimum)
mindirSub unit direction for minimum (on return filled with actual direction)
maxapproximate maximum buffer duration in us (on return filled with actual maximum)
maxdirSub unit direction for maximum (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_buffer_time_near()

int snd_pcm_hw_params_set_buffer_time_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to have buffer time nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target buffer duration in us / returned chosen approximate target buffer duration
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space is empty

target/chosen exact value is <,=,> val following dir (-1,0,1)

Examples
/test/pcm.c.

◆ snd_pcm_hw_params_set_channels()

int snd_pcm_hw_params_set_channels ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val )

Restrict a configuration space to contain only one channels count.

Parameters
pcmPCM handle
paramsConfiguration space
valchannels count
Returns
0 otherwise a negative error code if configuration space would become empty
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_set_channels_first()

int snd_pcm_hw_params_set_channels_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Restrict a configuration space to contain only its minimum channels count.

Parameters
pcmPCM handle
paramsConfiguration space
valminimum channels count
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_channels_last()

int snd_pcm_hw_params_set_channels_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Restrict a configuration space to contain only its maximum channels count.

Parameters
pcmPCM handle
paramsConfiguration space
valmaximum channels count
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_channels_max()

int snd_pcm_hw_params_set_channels_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Restrict a configuration space with a maximum channels count.

Parameters
pcmPCM handle
paramsConfiguration space
valmaximum channels count (on return filled with actual maximum)
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_channels_min()

int snd_pcm_hw_params_set_channels_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Restrict a configuration space with a minimum channels count.

Parameters
pcmPCM handle
paramsConfiguration space
valminimum channels count (on return filled with actual minimum)
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_channels_minmax()

int snd_pcm_hw_params_set_channels_minmax ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * min,
unsigned int * max )

Restrict a configuration space to have channels counts in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minminimum channels count (on return filled with actual minimum)
maxmaximum channels count (on return filled with actual maximum)
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_channels_near()

int snd_pcm_hw_params_set_channels_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val )

Restrict a configuration space to have channels count nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valtarget channels count, returned chosen channels count
Returns
0 otherwise a negative error code if configuration space is empty

◆ snd_pcm_hw_params_set_drain_silence()

int snd_pcm_hw_params_set_drain_silence ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val )

Restrict a configuration space to fill the end of playback stream with silence when drain() is invoked.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disabled, 1 = enabled (default) fill the end of the playback stream with silence when drain() is invoked
Returns
Zero on success, otherwise a negative error code.

When disabled, the application should handle the end of stream gracefully (fill the silent samples to align to the period size plus some extra samples for hardware / driver without perfect drain). Note that the rewind may be used for this purpose or the sw_params silencing mechanism.

◆ snd_pcm_hw_params_set_export_buffer()

int snd_pcm_hw_params_set_export_buffer ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val )

Restrict a configuration space to allow the buffer to be accessible from outside.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disable, 1 = enable (default) exporting buffer
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_format()

int snd_pcm_hw_params_set_format ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_format_t format )

Restrict a configuration space to contain only one format.

Parameters
pcmPCM handle
paramsConfiguration space
formatformat
Returns
0 otherwise a negative error code
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_set_format_first()

int snd_pcm_hw_params_set_format_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_format_t * format )

Restrict a configuration space to contain only its first format.

Parameters
pcmPCM handle
paramsConfiguration space
formatReturned first format
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_format_last()

int snd_pcm_hw_params_set_format_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_format_t * format )

Restrict a configuration space to contain only its last format.

Parameters
pcmPCM handle
paramsConfiguration space
formatReturned last format
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_format_mask()

int snd_pcm_hw_params_set_format_mask ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_format_mask_t * mask )

Restrict a configuration space to contain only a set of formats.

Parameters
pcmPCM handle
paramsConfiguration space
maskFormat mask
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_period_size()

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 )

Restrict a configuration space to contain only one period size.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate period size in frames
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_size_first()

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 )

Restrict a configuration space to contain only its minimum period size.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned maximum approximate period size in frames
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_period_size_integer()

int snd_pcm_hw_params_set_period_size_integer ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params )

Restrict a configuration space to contain only integer period sizes.

Parameters
pcmPCM handle
paramsConfiguration space
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_period_size_last()

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 )

Restrict a configuration space to contain only its maximum period size.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned maximum approximate period size in frames
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_period_size_max()

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 )

Restrict a configuration space with a maximum period size.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum period size in frames (on return filled with actual maximum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_size_min()

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 )

Restrict a configuration space with a minimum period size.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum period size in frames (on return filled with actual minimum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_size_minmax()

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 )

Restrict a configuration space to have period sizes in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum period size in frames (on return filled with actual minimum)
mindirSub unit direction for minimum (on return filled with actual direction)
maxapproximate maximum period size in frames (on return filled with actual maximum)
maxdirSub unit direction for maximum (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_size_near()

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 )

Restrict a configuration space to have period size nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target period size in frames / returned chosen approximate target period size
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space is empty

target/chosen exact value is <,=,> val following dir (-1,0,1)

Examples
/test/latency.c.

◆ snd_pcm_hw_params_set_period_time()

int snd_pcm_hw_params_set_period_time ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Restrict a configuration space to contain only one period time.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate period duration in us
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_time_first()

int snd_pcm_hw_params_set_period_time_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its minimum period time.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate period duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_period_time_last()

int snd_pcm_hw_params_set_period_time_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its maximum period time.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned maximum approximate period time
dirSub unit direction
Returns
approximate period duration in us

◆ snd_pcm_hw_params_set_period_time_max()

int snd_pcm_hw_params_set_period_time_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a maximum period time.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum period duration in us (on return filled with actual maximum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_time_min()

int snd_pcm_hw_params_set_period_time_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a minimum period time.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum period duration in us (on return filled with actual minimum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_time_minmax()

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 )

Restrict a configuration space to have period times in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum period duration in us (on return filled with actual minimum)
mindirSub unit direction for minimum (on return filled with actual direction)
maxapproximate maximum period duration in us (on return filled with actual maximum)
maxdirSub unit direction for maximum (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_period_time_near()

int snd_pcm_hw_params_set_period_time_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to have period time nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target period duration in us / returned chosen approximate target period duration
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space is empty

target/chosen exact value is <,=,> val following dir (-1,0,1)

Examples
/test/pcm.c.

◆ snd_pcm_hw_params_set_period_wakeup()

int snd_pcm_hw_params_set_period_wakeup ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val )

Restrict a configuration space to settings without period wakeups.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disable, 1 = enable (default) period wakeup
Returns
Zero on success, otherwise a negative error code.

This function must be called only on devices where non-blocking mode is enabled.

To check whether the hardware does support disabling period wakeups, call snd_pcm_hw_params_can_disable_period_wakeup(). If the hardware does not support this mode, standard period wakeups will be generated.

Even with disabled period wakeups, the period size/time/count parameters are valid; it is suggested to use snd_pcm_hw_params_set_period_size_last().

When period wakeups are disabled, the application must not use any functions that could block on this device. The use of poll should be limited to error cases. The application needs to use an external event or a timer to check the state of the ring buffer and refill it apropriately.

Examples
/test/latency.c.

◆ snd_pcm_hw_params_set_periods()

int snd_pcm_hw_params_set_periods ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Restrict a configuration space to contain only one periods count.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_periods_first()

int snd_pcm_hw_params_set_periods_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its minimum periods count.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate minimum periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_periods_integer()

int snd_pcm_hw_params_set_periods_integer ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params )

Restrict a configuration space to contain only integer periods counts.

Parameters
pcmPCM handle
paramsConfiguration space
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_periods_last()

int snd_pcm_hw_params_set_periods_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its maximum periods count.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate maximum periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_periods_max()

int snd_pcm_hw_params_set_periods_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a maximum periods count.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum periods per buffer (on return filled with actual maximum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_periods_min()

int snd_pcm_hw_params_set_periods_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a minimum periods count.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum periods per buffer (on return filled with actual minimum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_periods_minmax()

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 )

Restrict a configuration space to have periods counts in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum periods per buffer (on return filled with actual minimum)
mindirSub unit direction for minimum (on return filled with actual direction)
maxapproximate maximum periods per buffer (on return filled with actual maximum)
maxdirSub unit direction for maximum (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_periods_near()

int snd_pcm_hw_params_set_periods_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to have periods count nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target periods per buffer / returned chosen approximate target periods per buffer
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space is empty

target/chosen exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_rate()

int snd_pcm_hw_params_set_rate ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Restrict a configuration space to contain only one rate.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate rate
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_rate_first()

int snd_pcm_hw_params_set_rate_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its minimum rate.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned minimum approximate rate
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_rate_last()

int snd_pcm_hw_params_set_rate_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to contain only its maximum rate.

Parameters
pcmPCM handle
paramsConfiguration space
valReturned maximum approximate rate
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_rate_max()

int snd_pcm_hw_params_set_rate_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a maximum rate.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum rate (on return filled with actual maximum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_rate_min()

int snd_pcm_hw_params_set_rate_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space with a minimum rate.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum rate (on return filled with actual minimum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_rate_minmax()

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 )

Restrict a configuration space to have rates in a given range.

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum rate (on return filled with actual minimum)
mindirSub unit direction for minimum (on return filled with actual direction)
maxapproximate maximum rate (on return filled with actual maximum)
maxdirSub unit direction for maximum (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_rate_near()

int snd_pcm_hw_params_set_rate_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

Restrict a configuration space to have rate nearest to a target.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target rate / returned approximate set rate
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space is empty

target/chosen exact value is <,=,> val following dir (-1,0,1)

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_set_rate_resample()

int snd_pcm_hw_params_set_rate_resample ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val )

Restrict a configuration space to contain only real hardware rates.

Parameters
pcmPCM handle
paramsConfiguration space
val0 = disable, 1 = enable (default) rate resampling
Returns
0 otherwise a negative error code
Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_hw_params_set_subformat()

int snd_pcm_hw_params_set_subformat ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_subformat_t subformat )

Restrict a configuration space to contain only one subformat.

Parameters
pcmPCM handle
paramsConfiguration space
subformatsubformat value
Returns
0 otherwise a negative error code if configuration space would become empty

◆ snd_pcm_hw_params_set_subformat_first()

int snd_pcm_hw_params_set_subformat_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_subformat_t * subformat )

Restrict a configuration space to contain only its first subformat.

Parameters
pcmPCM handle
paramsConfiguration space
subformatReturned subformat
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_subformat_last()

int snd_pcm_hw_params_set_subformat_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_subformat_t * subformat )

Restrict a configuration space to contain only its last subformat.

Parameters
pcmPCM handle
paramsConfiguration space
subformatReturned subformat
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_subformat_mask()

int snd_pcm_hw_params_set_subformat_mask ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_subformat_mask_t * mask )

Restrict a configuration space to contain only a set of subformats.

Parameters
pcmPCM handle
paramsConfiguration space
maskSubformat mask
Returns
0 otherwise a negative error code

◆ snd_pcm_hw_params_set_tick_time()

int snd_pcm_hw_params_set_tick_time ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

(DEPRECATED) Restrict a configuration space to contain only one tick time

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_tick_time_first()

int snd_pcm_hw_params_set_tick_time_first ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Restrict a configuration space to contain only its minimum tick time

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate minimum tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_tick_time_last()

int snd_pcm_hw_params_set_tick_time_last ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Restrict a configuration space to contain only its maximum tick time

Parameters
pcmPCM handle
paramsConfiguration space
valReturned approximate maximum tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code

Actual exact value is <,=,> the approximate one following dir (-1, 0, 1)

◆ snd_pcm_hw_params_set_tick_time_max()

int snd_pcm_hw_params_set_tick_time_max ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Restrict a configuration space with a maximum tick time

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate maximum tick duration in us (on return filled with actual maximum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact maximum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_tick_time_min()

int snd_pcm_hw_params_set_tick_time_min ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Restrict a configuration space with a minimum tick time

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate minimum tick duration in us (on return filled with actual minimum)
dirSub unit direction (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact minimum is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_tick_time_minmax()

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 )

(DEPRECATED) Restrict a configuration space to have tick times in a given range

Parameters
pcmPCM handle
paramsConfiguration space
minapproximate minimum tick duration in us (on return filled with actual minimum)
mindirSub unit direction for minimum (on return filled with actual direction)
maxapproximate maximum tick duration in us (on return filled with actual maximum)
maxdirSub unit direction for maximum (on return filled with actual direction)
Returns
0 otherwise a negative error code if configuration space would become empty

Wanted/actual exact min/max is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_set_tick_time_near()

int snd_pcm_hw_params_set_tick_time_near ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int * val,
int * dir )

(DEPRECATED) Restrict a configuration space to have tick time nearest to a target

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate target tick duration in us / returned chosen approximate target tick duration in us
dirSub unit direction
Returns
0 otherwise a negative error code if configuration space is empty

target/chosen exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_sizeof()

size_t snd_pcm_hw_params_sizeof ( )

get size of #snd_pcm_hw_params_t

Returns
size in bytes

◆ snd_pcm_hw_params_supports_audio_ts_type()

int snd_pcm_hw_params_supports_audio_ts_type ( const snd_pcm_hw_params_t * params,
int type )

Check if hardware supports type of audio timestamps.

Parameters
paramsConfiguration space
typeAudio timestamp type
Return values
0Hardware doesn't support type of audio timestamps
1Hardware supports type of audio timestamps

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_supports_audio_wallclock_ts()

int snd_pcm_hw_params_supports_audio_wallclock_ts ( const snd_pcm_hw_params_t * params)

Check if hardware supports audio wallclock timestamps.

Parameters
paramsConfiguration space
Return values
0Hardware doesn't support audio wallclock timestamps
1Hardware supports audio wallclock timestamps

This function should only be called when the configuration space contains a single configuration. Call snd_pcm_hw_params to choose a single configuration from the configuration space.

◆ snd_pcm_hw_params_test_access()

int snd_pcm_hw_params_test_access ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_access_t access )

Verify if an access type is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
accessaccess type
Returns
0 if available a negative error code otherwise

◆ snd_pcm_hw_params_test_buffer_size()

int snd_pcm_hw_params_test_buffer_size ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_uframes_t val )

Verify if a buffer size is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valbuffer size in frames
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_test_buffer_time()

int snd_pcm_hw_params_test_buffer_time ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Verify if a buffer time is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate buffer duration in us
dirSub unit direction
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_test_channels()

int snd_pcm_hw_params_test_channels ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val )

Verify if a channels count is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valchannels count
Returns
0 if available a negative error code otherwise

◆ snd_pcm_hw_params_test_format()

int snd_pcm_hw_params_test_format ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_format_t format )

Verify if a format is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
formatformat
Returns
0 if available a negative error code otherwise

◆ snd_pcm_hw_params_test_period_size()

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 )

Verify if a period size is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate period size in frames
dirSub unit direction
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_test_period_time()

int snd_pcm_hw_params_test_period_time ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Verify if a period time is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate period duration in us
dirSub unit direction
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_test_periods()

int snd_pcm_hw_params_test_periods ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Verify if a periods count is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate periods per buffer
dirSub unit direction
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_test_rate()

int snd_pcm_hw_params_test_rate ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

Verify if a rate is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate rate
dirSub unit direction
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hw_params_test_subformat()

int snd_pcm_hw_params_test_subformat ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
snd_pcm_subformat_t subformat )

Verify if a subformat is available inside a configuration space for a PCM.

Parameters
pcmPCM handle
paramsConfiguration space
subformatsubformat value
Returns
0 if available a negative error code otherwise

◆ snd_pcm_hw_params_test_tick_time()

int snd_pcm_hw_params_test_tick_time ( snd_pcm_t * pcm,
snd_pcm_hw_params_t * params,
unsigned int val,
int dir )

(DEPRECATED) Verify if a tick time is available inside a configuration space for a PCM

Parameters
pcmPCM handle
paramsConfiguration space
valapproximate tick duration in us
dirSub unit direction
Returns
0 if available a negative error code otherwise

Wanted exact value is <,=,> val following dir (-1,0,1)

◆ snd_pcm_hwsync()

int snd_pcm_hwsync ( snd_pcm_t * pcm)

(DEPRECATED) Synchronize stream position with hardware

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

Note this function does not update the actual r/w pointer for applications. The function snd_pcm_avail_update() have to be called before any mmap begin+commit operation.

The function is thread-safe when built with the proper option.

This function is deprecated. Use snd_pcm_avail_update() instead.

◆ snd_pcm_info()

int snd_pcm_info ( snd_pcm_t * pcm,
snd_pcm_info_t * info )

Obtain general (static) information for PCM handle.

Parameters
pcmPCM handle
infoInformation container
Returns
0 on success otherwise a negative error code

◆ snd_pcm_info_copy()

void snd_pcm_info_copy ( snd_pcm_info_t * dst,
const snd_pcm_info_t * src )

copy one #snd_pcm_info_t to another

Parameters
dstpointer to destination
srcpointer to source

◆ snd_pcm_info_free()

void snd_pcm_info_free ( snd_pcm_info_t * obj)

frees a previously allocated #snd_pcm_info_t

Parameters
objpointer to object to free

◆ snd_pcm_info_get_card()

int snd_pcm_info_get_card ( const snd_pcm_info_t * obj)

Get card from a PCM info container.

Parameters
objPCM info container
Returns
card number otherwise a negative error code if not associable to a card

◆ snd_pcm_info_get_class()

snd_pcm_class_t snd_pcm_info_get_class ( const snd_pcm_info_t * obj)

Get class from a PCM info container.

Parameters
objPCM info container
Returns
class of PCM

◆ snd_pcm_info_get_device()

unsigned int snd_pcm_info_get_device ( const snd_pcm_info_t * obj)

Get device from a PCM info container.

Parameters
objPCM info container
Returns
device number

◆ snd_pcm_info_get_id()

const char * snd_pcm_info_get_id ( const snd_pcm_info_t * obj)

Get id from a PCM info container.

Parameters
objPCM info container
Returns
short id of PCM

◆ snd_pcm_info_get_name()

const char * snd_pcm_info_get_name ( const snd_pcm_info_t * obj)

Get name from a PCM info container.

Parameters
objPCM info container
Returns
name of PCM

◆ snd_pcm_info_get_stream()

snd_pcm_stream_t snd_pcm_info_get_stream ( const snd_pcm_info_t * obj)

Get stream (direction) from a PCM info container.

Parameters
objPCM info container
Returns
stream

◆ snd_pcm_info_get_subclass()

snd_pcm_subclass_t snd_pcm_info_get_subclass ( const snd_pcm_info_t * obj)

Get subclass from a PCM info container.

Parameters
objPCM info container
Returns
subclass of PCM

◆ snd_pcm_info_get_subdevice()

unsigned int snd_pcm_info_get_subdevice ( const snd_pcm_info_t * obj)

Get subdevice from a PCM info container.

Parameters
objPCM info container
Returns
subdevice number

◆ snd_pcm_info_get_subdevice_name()

const char * snd_pcm_info_get_subdevice_name ( const snd_pcm_info_t * obj)

Get subdevice name from a PCM info container.

Parameters
objPCM info container
Returns
name of used PCM subdevice

◆ snd_pcm_info_get_subdevices_avail()

unsigned int snd_pcm_info_get_subdevices_avail ( const snd_pcm_info_t * obj)

Get available subdevices count from a PCM info container.

Parameters
objPCM info container
Returns
available subdevices count of PCM

◆ snd_pcm_info_get_subdevices_count()

unsigned int snd_pcm_info_get_subdevices_count ( const snd_pcm_info_t * obj)

Get subdevices count from a PCM info container.

Parameters
objPCM info container
Returns
subdevices total count of PCM

◆ snd_pcm_info_get_sync()

snd_pcm_sync_id_t snd_pcm_info_get_sync ( const snd_pcm_info_t * obj)

(DEPRECATED) Get hardware synchronization ID from a PCM info container

Parameters
objPCM info container
Returns
hardware synchronization ID

◆ snd_pcm_info_malloc()

int snd_pcm_info_malloc ( snd_pcm_info_t ** ptr)

allocate an invalid #snd_pcm_info_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_info_set_device()

void snd_pcm_info_set_device ( snd_pcm_info_t * obj,
unsigned int val )

Set wanted device inside a PCM info container (see snd_ctl_pcm_info)

Parameters
objPCM info container
valDevice number

◆ snd_pcm_info_set_stream()

void snd_pcm_info_set_stream ( snd_pcm_info_t * obj,
snd_pcm_stream_t val )

Set wanted stream inside a PCM info container (see snd_ctl_pcm_info)

Parameters
objPCM info container
valStream

◆ snd_pcm_info_set_subdevice()

void snd_pcm_info_set_subdevice ( snd_pcm_info_t * obj,
unsigned int val )

Set wanted subdevice inside a PCM info container (see snd_ctl_pcm_info)

Parameters
objPCM info container
valSubdevice number

◆ snd_pcm_info_sizeof()

size_t snd_pcm_info_sizeof ( )

get size of #snd_pcm_info_t

Returns
size in bytes

◆ snd_pcm_link()

int snd_pcm_link ( snd_pcm_t * pcm1,
snd_pcm_t * pcm2 )

Link two PCMs.

Parameters
pcm1first PCM handle
pcm2first PCM handle
Returns
0 on success otherwise a negative error code

The two PCMs will start/stop/prepare in sync.

Examples
/test/latency.c.

◆ snd_pcm_mmap_begin()

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 )

Application request to access a portion of direct (mmap) area.

Parameters
pcmPCM handle
areasReturned mmap channel areas
offsetReturned mmap area offset in area steps (== frames)
framesmmap area portion size in frames (wanted on entry, contiguous available on exit)
Returns
0 on success otherwise a negative error code

It is necessary to call the snd_pcm_avail_update() function directly before this call. Otherwise, this function can return a wrong count of available frames.

The function should be called before a sample-direct area can be accessed. The resulting size parameter is always less or equal to the input count of frames and can be zero, if no frames can be processed (the ring buffer is full).

See the snd_pcm_mmap_commit() function to finish the frame processing in the direct areas.

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_mmap_commit()

snd_pcm_sframes_t snd_pcm_mmap_commit ( snd_pcm_t * pcm,
snd_pcm_uframes_t offset,
snd_pcm_uframes_t frames )

Application has completed the access to area requested with snd_pcm_mmap_begin.

Parameters
pcmPCM handle
offsetarea offset in area steps (== frames)
framesarea portion size in frames
Returns
count of transferred frames otherwise a negative error code

You should pass this function the offset value that snd_pcm_mmap_begin() returned. The frames parameter should hold the number of frames you have written or read to/from the audio buffer. The frames parameter must never exceed the contiguous frames count that snd_pcm_mmap_begin() returned. Each call to snd_pcm_mmap_begin() must be followed by a call to snd_pcm_mmap_commit().

Example:

double phase = 0;
const snd_pcm_area_t *areas;
snd_pcm_sframes_t avail, size, commitres;
snd_pcm_uframes_t offset, frames;
int err;
avail = snd_pcm_avail_update(pcm);
if (avail < 0)
error(avail);
// at this point, we can transfer at least 'avail' frames
// we want to process frames in chunks (period_size)
if (avail < period_size)
goto _skip;
size = period_size;
// it is possible that contiguous areas are smaller, thus we use a loop
while (size > 0) {
frames = size;
err = snd_pcm_mmap_begin(pcm_handle, &areas, &offset, &frames);
if (err < 0)
error(err);
// this function fills the areas from offset with count of frames
generate_sine(areas, offset, frames, &phase);
commitres = snd_pcm_mmap_commit(pcm_handle, offset, frames);
if (commitres < 0 || commitres != frames)
error(commitres >= 0 ? -EPIPE : commitres);
size -= frames;
}
_skip:
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)
Application request to access a portion of direct (mmap) area.
Definition pcm.c:7422
snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm)
Return number of frames ready to be read (capture) / written (playback)
Definition pcm.c:3050
snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm, snd_pcm_uframes_t offset, snd_pcm_uframes_t frames)
Application has completed the access to area requested with snd_pcm_mmap_begin.
Definition pcm.c:7535

Look to the Sine-wave generator example for more details about the generate_sine function.

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_name()

const char * snd_pcm_name ( snd_pcm_t * pcm)

get identifier of PCM handle

Parameters
pcmPCM handle
Returns
ascii identifier of PCM handle

Returns the ASCII identifier of given PCM handle. It's the same identifier specified in snd_pcm_open().

◆ snd_pcm_nonblock()

int snd_pcm_nonblock ( snd_pcm_t * pcm,
int nonblock )

set nonblock mode

Parameters
pcmPCM handle
nonblock0 = block, 1 = nonblock mode, 2 = abort
Returns
0 on success otherwise a negative error code

The function is thread-safe when built with the proper option.

Examples
/test/latency.c.

◆ snd_pcm_open()

int snd_pcm_open ( snd_pcm_t ** pcmp,
const char * name,
snd_pcm_stream_t stream,
int mode )

Opens a PCM.

Parameters
pcmpReturned PCM handle
nameASCII identifier of the PCM handle
streamWanted stream
modeOpen mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
Returns
0 on success otherwise a negative error code
Examples
/test/latency.c, /test/pcm.c, and /test/pcm_min.c.

◆ snd_pcm_open_fallback()

int snd_pcm_open_fallback ( snd_pcm_t ** pcmp,
snd_config_t * root,
const char * name,
const char * orig_name,
snd_pcm_stream_t stream,
int mode )

Opens a fallback PCM.

Parameters
pcmpReturned PCM handle
rootConfiguration root
nameASCII identifier of the PCM handle
orig_nameThe original ASCII name
streamWanted stream
modeOpen mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
Returns
0 on success otherwise a negative error code

◆ snd_pcm_open_lconf()

int snd_pcm_open_lconf ( snd_pcm_t ** pcmp,
const char * name,
snd_pcm_stream_t stream,
int mode,
snd_config_t * lconf )

Opens a PCM using local configuration.

Parameters
pcmpReturned PCM handle
nameASCII identifier of the PCM handle
streamWanted stream
modeOpen mode (see #SND_PCM_NONBLOCK, #SND_PCM_ASYNC)
lconfLocal configuration
Returns
0 on success otherwise a negative error code

◆ snd_pcm_pause()

int snd_pcm_pause ( snd_pcm_t * pcm,
int enable )

Pause/resume PCM.

Parameters
pcmPCM handle
enable0 = resume, 1 = pause
Returns
0 on success otherwise a negative error code

Note that this function works only on the hardware which supports pause feature. You can check it via ::snd_pcm_hw_params_can_pause() function.

The function is thread-safe when built with the proper option.

◆ snd_pcm_poll_descriptors()

int snd_pcm_poll_descriptors ( snd_pcm_t * pcm,
struct pollfd * pfds,
unsigned int space )

get poll descriptors

Parameters
pcmPCM handle
pfdsarray of poll descriptors
spacespace in the poll descriptor array
Returns
count of filled descriptors

This function fills the given poll descriptor structs for the specified PCM handle. The poll desctiptor array should have the size returned by ::snd_pcm_poll_descriptors_count() function.

The result is intended for direct use with the poll() syscall.

For reading the returned events of poll descriptor after poll() system call, use ::snd_pcm_poll_descriptors_revents() function. The field values in pollfd structs may be bogus regarding the stream direction from the application perspective (POLLIN might not imply read direction and POLLOUT might not imply write), but the ::snd_pcm_poll_descriptors_revents() function does the right "demangling".

You can use output from this function as arguments for the select() syscall, too. Do not forget to translate POLLIN and POLLOUT events to corresponding FD_SET arrays and demangle events using ::snd_pcm_poll_descriptors_revents() .

It is guaranteed that for the given PCM handle, the output poll descriptor structs (and their count) will not change after hardware and software parameters setup. Thus it is valid to call the function once when all parameters are set and reuse its output for the lifetime of the stream parameters.

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_poll_descriptors_count()

int snd_pcm_poll_descriptors_count ( snd_pcm_t * pcm)

get count of poll descriptors for PCM handle

Parameters
pcmPCM handle
Returns
count of poll descriptors

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_poll_descriptors_revents()

int snd_pcm_poll_descriptors_revents ( snd_pcm_t * pcm,
struct pollfd * pfds,
unsigned int nfds,
unsigned short * revents )

get returned events from poll descriptors

Parameters
pcmPCM handle
pfdsarray of poll descriptors
nfdscount of poll descriptors
reventspointer to the returned (single) event
Returns
zero if success, otherwise a negative error code

This function does "demangling" of the revents mask returned from the poll() syscall to correct semantics (POLLIN = read, POLLOUT = write).

Note: The null event also exists. Even if poll() or select() syscall returned that some events are waiting, this function might return empty set of events. In this case, application should do next event waiting using poll() or select().

Note: Even if multiple poll descriptors are used (i.e. pfds > 1), this function returns only a single event.

The passed in count of poll descriptors must be equal to ::snd_pcm_poll_descriptors_count() and the passed in array must match the array returned by ::snd_pcm_poll_descriptors() (in its full length and original order) with the revent fields updated according to the poll() result. This function will not modify the file descriptor or event field of any element of the given poll descriptor array.

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_prepare()

int snd_pcm_prepare ( snd_pcm_t * pcm)

Prepare PCM for use.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_query_chmaps()

snd_pcm_chmap_query_t ** snd_pcm_query_chmaps ( snd_pcm_t * pcm)

!brief Query the available channel maps

Parameters
pcmPCM handle to query
Returns
the NULL-terminated array of integer pointers, each of which contains the channel map. A channel map is represented by an integer array, beginning with the channel map type, followed by the number of channels, and the position of each channel. Return NULL in case of an error.

Note: the caller is requested to release the returned value via snd_pcm_free_chmaps().

◆ snd_pcm_readi()

snd_pcm_sframes_t snd_pcm_readi ( snd_pcm_t * pcm,
void * buffer,
snd_pcm_uframes_t size )

Read interleaved frames from a PCM.

Parameters
pcmPCM handle
bufferframes containing buffer
sizeframes to be read
Returns
a positive number of frames actually read otherwise a negative error code
Return values
-EBADFDPCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
-EPIPEan overrun occurred
-ESTRPIPEa suspend event occurred (stream is suspended and waiting for an application recovery)

If the blocking behaviour was selected and it is running, then routine waits until all requested frames are filled. The returned number of frames can be less only if a signal or underrun occurred.

If the non-blocking behaviour is selected, then routine doesn't wait at all.

The function is thread-safe when built with the proper option.

Examples
/test/latency.c.

◆ snd_pcm_readn()

snd_pcm_sframes_t snd_pcm_readn ( snd_pcm_t * pcm,
void ** bufs,
snd_pcm_uframes_t size )

Read non interleaved frames to a PCM.

Parameters
pcmPCM handle
bufsframes containing buffers (one for each channel)
sizeframes to be read
Returns
a positive number of frames actually read otherwise a negative error code
Return values
-EBADFDPCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
-EPIPEan overrun occurred
-ESTRPIPEa suspend event occurred (stream is suspended and waiting for an application recovery)

If the blocking behaviour was selected and it is running, then routine waits until all requested frames are filled. The returned number of frames can be less only if a signal or underrun occurred.

If the non-blocking behaviour is selected, then routine doesn't wait at all.

The function is thread-safe when built with the proper option.

◆ snd_pcm_recover()

int snd_pcm_recover ( snd_pcm_t * pcm,
int err,
int silent )

Recover the stream state from an error or suspend.

Parameters
pcmPCM handle
errerror number
silentdo not print error reason
Returns
0 when error code was handled successfuly, otherwise a negative error code

This a high-level helper function building on other functions.

This functions handles -EINTR (interrupted system call), -EPIPE (overrun or underrun) and -ESTRPIPE (stream is suspended) error codes trying to prepare given stream for next I/O.

Note that this function returns the original error code when it is not handled inside this function (for example -EAGAIN is returned back).

Examples
/test/pcm_min.c.

◆ snd_pcm_reset()

int snd_pcm_reset ( snd_pcm_t * pcm)

Reset PCM position.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

Reduce PCM delay to 0.

The function is thread-safe when built with the proper option.

◆ snd_pcm_resume()

int snd_pcm_resume ( snd_pcm_t * pcm)

Resume from suspend, no samples are lost.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code
Return values
-EAGAINresume can't be proceed immediately (audio hardware is probably still suspended)
-ENOSYShardware doesn't support this feature

This function can be used when the stream is in the suspend state to do the fine resume from this state. Not all hardware supports this feature, when an -ENOSYS error is returned, use the ::snd_pcm_prepare() function to recovery.

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_rewind()

snd_pcm_sframes_t snd_pcm_rewind ( snd_pcm_t * pcm,
snd_pcm_uframes_t frames )

Move application frame position backward.

Parameters
pcmPCM handle
frameswanted displacement in frames
Returns
a positive number for actual displacement otherwise a negative error code

The function is thread-safe when built with the proper option.

◆ snd_pcm_rewindable()

snd_pcm_sframes_t snd_pcm_rewindable ( snd_pcm_t * pcm)

Get safe count of frames which can be rewinded.

Parameters
pcmPCM handle
Returns
a positive number of frames or negative error code

Note: The snd_pcm_rewind() can accept bigger value than returned by this function. But it is not guaranteed that output stream will be consistent with bigger value.

The function is thread-safe when built with the proper option.

◆ snd_pcm_samples_to_bytes()

ssize_t snd_pcm_samples_to_bytes ( snd_pcm_t * pcm,
long samples )

Convert samples in bytes for a PCM.

Parameters
pcmPCM handle
samplesquantity in samples
Returns
quantity expressed in bytes

◆ snd_pcm_set_chmap()

int snd_pcm_set_chmap ( snd_pcm_t * pcm,
const snd_pcm_chmap_t * map )

!brief Configure the current channel map

Parameters
pcmPCM instance
mapthe channel map to write
Returns
zero if succeeded, or a negative error code

◆ snd_pcm_set_params()

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 )

Set the hardware and software parameters in a simple way.

Parameters
pcmPCM handle
formatrequired PCM format
accessrequired PCM access
channelsrequired PCM channels
raterequired sample rate in Hz
soft_resample0 = disallow alsa-lib resample stream, 1 = allow resampling
latencyrequired overall latency in us
Returns
0 on success otherwise a negative error code
Examples
/test/pcm_min.c.

◆ snd_pcm_start()

int snd_pcm_start ( snd_pcm_t * pcm)

Start a PCM.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_start_mode_name()

const char * snd_pcm_start_mode_name ( snd_pcm_start_t mode)

(DEPRECATED) get name of PCM start mode setting

Parameters
modePCM start mode
Returns
ascii name of PCM start mode setting

◆ snd_pcm_state()

snd_pcm_state_t snd_pcm_state ( snd_pcm_t * pcm)

Return PCM state.

Parameters
pcmPCM handle
Returns
PCM state #snd_pcm_state_t of given PCM handle

This is a faster way to obtain only the PCM state without calling ::snd_pcm_status().

Note that this function always returns one of the #snd_pcm_state_t enum variants. It will never return a negative error code.

The function is thread-safe when built with the proper option.

Examples
/test/pcm.c.

◆ snd_pcm_state_name()

const char * snd_pcm_state_name ( const snd_pcm_state_t state)

get name of PCM state

Parameters
statePCM state
Returns
ascii name of PCM state

◆ snd_pcm_status()

int snd_pcm_status ( snd_pcm_t * pcm,
snd_pcm_status_t * status )

Obtain status (runtime) information for PCM handle.

Parameters
pcmPCM handle
statusStatus container
Returns
0 on success otherwise a negative error code

The function is thread-safe when built with the proper option.

Examples
/test/latency.c.

◆ snd_pcm_status_copy()

void snd_pcm_status_copy ( snd_pcm_status_t * dst,
const snd_pcm_status_t * src )

copy one #snd_pcm_status_t to another

Parameters
dstpointer to destination
srcpointer to source

◆ snd_pcm_status_dump()

int snd_pcm_status_dump ( snd_pcm_status_t * status,
snd_output_t * out )

Dump status.

Parameters
statusStatus container
outOutput handle
Returns
0 on success otherwise a negative error code
Examples
/test/latency.c.

◆ snd_pcm_status_free()

void snd_pcm_status_free ( snd_pcm_status_t * obj)

frees a previously allocated #snd_pcm_status_t

Parameters
objpointer to object to free

◆ snd_pcm_status_get_audio_htstamp()

void snd_pcm_status_get_audio_htstamp ( const snd_pcm_status_t * obj,
snd_htimestamp_t * ptr )

Get "now" hi-res audio timestamp from a PCM status container.

Parameters
objpointer to #snd_pcm_status_t
ptrPointer to returned timestamp

◆ snd_pcm_status_get_audio_htstamp_report()

void snd_pcm_status_get_audio_htstamp_report ( const snd_pcm_status_t * obj,
snd_pcm_audio_tstamp_report_t * audio_tstamp_report )

Get audio_tstamp_report from a PCM status container.

Parameters
objpointer to #snd_pcm_status_t
audio_tstamp_reportPointer to returned report

◆ snd_pcm_status_get_avail()

snd_pcm_uframes_t snd_pcm_status_get_avail ( const snd_pcm_status_t * obj)

Get number of frames available from a PCM status container (see snd_pcm_avail_update)

Returns
Number of frames ready to be read/written

◆ snd_pcm_status_get_avail_max()

snd_pcm_uframes_t snd_pcm_status_get_avail_max ( const snd_pcm_status_t * obj)

Get maximum number of frames available from a PCM status container after last snd_pcm_status call.

Returns
Maximum number of frames ready to be read/written

This value returns the peak for the available frames between snd_pcm_status calls.

◆ snd_pcm_status_get_delay()

snd_pcm_sframes_t snd_pcm_status_get_delay ( const snd_pcm_status_t * obj)

Get delay from a PCM status container (see snd_pcm_delay)

Returns
Delay in frames

Delay is distance between current application frame position and sound frame position. It's positive and less than buffer size in normal situation, negative on playback underrun and greater than buffer size on capture overrun.

◆ snd_pcm_status_get_driver_htstamp()

void snd_pcm_status_get_driver_htstamp ( const snd_pcm_status_t * obj,
snd_htimestamp_t * ptr )

Get "now" hi-res driver timestamp from a PCM status container. Defines when the status was generated by driver, may differ from normal timestamp.

Parameters
objpointer to #snd_pcm_status_t
ptrPointer to returned timestamp

◆ snd_pcm_status_get_htstamp()

void snd_pcm_status_get_htstamp ( const snd_pcm_status_t * obj,
snd_htimestamp_t * ptr )

Get "now" hi-res timestamp from a PCM status container.

Parameters
objpointer to #snd_pcm_status_t
ptrPointer to returned timestamp

◆ snd_pcm_status_get_overrange()

snd_pcm_uframes_t snd_pcm_status_get_overrange ( const snd_pcm_status_t * obj)

Get count of ADC overrange detections since last call.

Returns
Count of ADC overrange detections

◆ snd_pcm_status_get_state()

snd_pcm_state_t snd_pcm_status_get_state ( const snd_pcm_status_t * obj)

Get state from a PCM status container (see snd_pcm_state)

Parameters
obj#snd_pcm_status_t pointer
Returns
PCM state

◆ snd_pcm_status_get_trigger_htstamp()

void snd_pcm_status_get_trigger_htstamp ( const snd_pcm_status_t * obj,
snd_htimestamp_t * ptr )

Get trigger hi-res timestamp from a PCM status container.

Parameters
obj#snd_pcm_status_t pointer
ptrPointer to returned timestamp

Trigger means a PCM state transition (from stopped to running or versa vice). It applies also to pause and suspend. In other words, timestamp contains time when stream started or when it was stopped.

◆ snd_pcm_status_get_trigger_tstamp()

void snd_pcm_status_get_trigger_tstamp ( const snd_pcm_status_t * obj,
snd_timestamp_t * ptr )

Get trigger timestamp from a PCM status container.

Parameters
obj#snd_pcm_status_t pointer
ptrPointer to returned timestamp

Trigger means a PCM state transition (from stopped to running or versa vice). It applies also to pause and suspend. In other words, timestamp contains time when stream started or when it was stopped.

Examples
/test/latency.c.

◆ snd_pcm_status_get_tstamp()

void snd_pcm_status_get_tstamp ( const snd_pcm_status_t * obj,
snd_timestamp_t * ptr )

Get "now" timestamp from a PCM status container.

Parameters
obj#snd_pcm_status_t pointer
ptrPointer to returned timestamp

◆ snd_pcm_status_malloc()

int snd_pcm_status_malloc ( snd_pcm_status_t ** ptr)

allocate an invalid #snd_pcm_status_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_status_set_audio_htstamp_config()

void snd_pcm_status_set_audio_htstamp_config ( snd_pcm_status_t * obj,
snd_pcm_audio_tstamp_config_t * audio_tstamp_config )

set audio_tstamp_config from a PCM status container

Parameters
objpointer to #snd_pcm_status_t
audio_tstamp_configPointer to config (valid fields are type_requested and report_delay)

◆ snd_pcm_status_sizeof()

size_t snd_pcm_status_sizeof ( )

get size of #snd_pcm_status_t

Returns
size in bytes

◆ snd_pcm_stream()

snd_pcm_stream_t snd_pcm_stream ( snd_pcm_t * pcm)

get stream for a PCM handle

Parameters
pcmPCM handle
Returns
stream of PCM handle

Returns the type #snd_pcm_stream_t of given PCM handle.

◆ snd_pcm_stream_name()

const char * snd_pcm_stream_name ( const snd_pcm_stream_t stream)

get name of PCM stream type

Parameters
streamPCM stream type
Returns
ascii name of PCM stream type

◆ snd_pcm_subformat_description()

const char * snd_pcm_subformat_description ( const snd_pcm_subformat_t subformat)

get description of PCM sample subformat

Parameters
subformatPCM sample subformat
Returns
ascii description of PCM sample subformat

◆ snd_pcm_subformat_mask_any()

void snd_pcm_subformat_mask_any ( snd_pcm_subformat_mask_t * mask)

set all bits in a #snd_pcm_subformat_mask_t

Parameters
maskpointer to mask

◆ snd_pcm_subformat_mask_copy()

void snd_pcm_subformat_mask_copy ( snd_pcm_subformat_mask_t * dst,
const snd_pcm_subformat_mask_t * src )

copy one #snd_pcm_subformat_mask_t to another

Parameters
dstpointer to destination
srcpointer to source

◆ snd_pcm_subformat_mask_empty()

int snd_pcm_subformat_mask_empty ( const snd_pcm_subformat_mask_t * mask)

test, if given a #snd_pcm_subformat_mask_t is empty

Parameters
maskpointer to mask
Return values
0not empty
1empty

◆ snd_pcm_subformat_mask_free()

void snd_pcm_subformat_mask_free ( snd_pcm_subformat_mask_t * obj)

frees a previously allocated #snd_pcm_subformat_mask_t

Parameters
objpointer to object to free

◆ snd_pcm_subformat_mask_malloc()

int snd_pcm_subformat_mask_malloc ( snd_pcm_subformat_mask_t ** ptr)

allocate an empty #snd_pcm_subformat_mask_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_subformat_mask_none()

void snd_pcm_subformat_mask_none ( snd_pcm_subformat_mask_t * mask)

reset all bits in a #snd_pcm_subformat_mask_t

Parameters
maskpointer to mask

◆ snd_pcm_subformat_mask_reset()

void snd_pcm_subformat_mask_reset ( snd_pcm_subformat_mask_t * mask,
snd_pcm_subformat_t val )

make a subformat missing from a #snd_pcm_subformat_mask_t

Parameters
maskpointer to mask
valsubformat

◆ snd_pcm_subformat_mask_set()

void snd_pcm_subformat_mask_set ( snd_pcm_subformat_mask_t * mask,
snd_pcm_subformat_t val )

make a subformat present in a #snd_pcm_subformat_mask_t

Parameters
maskpointer to mask
valsubformat

◆ snd_pcm_subformat_mask_sizeof()

size_t snd_pcm_subformat_mask_sizeof ( )

get size of #snd_pcm_subformat_mask_t

Returns
size in bytes

◆ snd_pcm_subformat_mask_test()

int snd_pcm_subformat_mask_test ( const snd_pcm_subformat_mask_t * mask,
snd_pcm_subformat_t val )

test the presence of a subformat in a #snd_pcm_subformat_mask_t

Parameters
maskpointer to mask
valsubformat

◆ snd_pcm_subformat_name()

const char * snd_pcm_subformat_name ( const snd_pcm_subformat_t subformat)

get name of PCM sample subformat

Parameters
subformatPCM sample subformat
Returns
ascii name of PCM sample subformat

◆ snd_pcm_subformat_value()

snd_pcm_subformat_t snd_pcm_subformat_value ( const char * name)

get PCM sample subformat from name

Parameters
namePCM sample subformat name (case insensitive)
Returns
PCM sample subformat

◆ snd_pcm_sw_params()

int snd_pcm_sw_params ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params )

Install PCM software configuration defined by params.

Parameters
pcmPCM handle
paramsConfiguration container
Returns
0 on success otherwise a negative error code

The software parameters can be changed at any time. The hardware parameters cannot be changed when the stream is running (active).

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_sw_params_copy()

void snd_pcm_sw_params_copy ( snd_pcm_sw_params_t * dst,
const snd_pcm_sw_params_t * src )

copy one #snd_pcm_sw_params_t to another

Parameters
dstpointer to destination
srcpointer to source

◆ snd_pcm_sw_params_current()

int snd_pcm_sw_params_current ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params )

Return current software configuration for a PCM.

Parameters
pcmPCM handle
paramsSoftware configuration container
Returns
0 on success otherwise a negative error code

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_sw_params_dump()

int snd_pcm_sw_params_dump ( snd_pcm_sw_params_t * params,
snd_output_t * out )

Dump a software configuration.

Parameters
paramsSoftware configuration container
outOutput handle
Returns
0 on success otherwise a negative error code

◆ snd_pcm_sw_params_free()

void snd_pcm_sw_params_free ( snd_pcm_sw_params_t * obj)

frees a previously allocated #snd_pcm_sw_params_t

Parameters
objpointer to object to free

◆ snd_pcm_sw_params_get_avail_min()

int snd_pcm_sw_params_get_avail_min ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

Get avail min from a software configuration container.

Parameters
paramsSoftware configuration container
valreturned minimum available frames to consider PCM ready
Returns
0 otherwise a negative error code

This is a threshold value when the PCM stream is considered as ready for another read/write operation or poll event.

◆ snd_pcm_sw_params_get_boundary()

int snd_pcm_sw_params_get_boundary ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

Get boundary for ring pointers from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned boundary in frames
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_get_period_event()

int snd_pcm_sw_params_get_period_event ( const snd_pcm_sw_params_t * params,
int * val )

Get period event from a software configuration container.

Parameters
paramsSoftware configuration container
valreturned period event state
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_get_silence_size()

int snd_pcm_sw_params_get_silence_size ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

Get silence size from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned silence size in frames (0 for disabled)
Returns
0 otherwise a negative error code

A portion of playback buffer is overwritten with silence when playback underrun is nearer than silence threshold (see snd_pcm_sw_params_set_silence_threshold)

◆ snd_pcm_sw_params_get_silence_threshold()

int snd_pcm_sw_params_get_silence_threshold ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

Get silence threshold from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned silence threshold in frames
Returns
0 otherwise a negative error value

A portion of playback buffer is overwritten with silence (see snd_pcm_sw_params_set_silence_size) when playback underrun is nearer than silence threshold.

◆ snd_pcm_sw_params_get_sleep_min()

int snd_pcm_sw_params_get_sleep_min ( const snd_pcm_sw_params_t * params,
unsigned int * val )

(DEPRECATED) Get minimum numbers of ticks to sleep from a software configuration container

Parameters
paramsSoftware configuration container
valreturned minimum number of ticks to sleep or 0 if tick timer is disabled
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_get_start_mode()

snd_pcm_start_t snd_pcm_sw_params_get_start_mode ( const snd_pcm_sw_params_t * params)

(DEPRECATED) Get start mode from a software configuration container

Parameters
paramsSoftware configuration container
Returns
start mode

◆ snd_pcm_sw_params_get_start_threshold()

int snd_pcm_sw_params_get_start_threshold ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

Get start threshold from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned start threshold in frames
Returns
0 otherwise a negative error code

PCM is automatically started when playback frames available to PCM are >= threshold or when requested capture frames are >= threshold

◆ snd_pcm_sw_params_get_stop_threshold()

int snd_pcm_sw_params_get_stop_threshold ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

Get stop threshold from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned stop threshold in frames
Returns
0 otherwise a negative error code

PCM is automatically stopped in #SND_PCM_STATE_XRUN state when available frames is >= threshold. If the stop threshold is equal to boundary (also software parameter - sw_param) then automatic stop will be disabled (thus device will do the endless loop in the ring buffer).

◆ snd_pcm_sw_params_get_tstamp_mode()

int snd_pcm_sw_params_get_tstamp_mode ( const snd_pcm_sw_params_t * params,
snd_pcm_tstamp_t * val )

Get timestamp mode from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned timestamp
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_get_tstamp_type()

int snd_pcm_sw_params_get_tstamp_type ( const snd_pcm_sw_params_t * params,
snd_pcm_tstamp_type_t * val )

Get timestamp type from a software configuration container.

Parameters
paramsSoftware configuration container
valReturned timestamp type
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_get_xfer_align()

int snd_pcm_sw_params_get_xfer_align ( const snd_pcm_sw_params_t * params,
snd_pcm_uframes_t * val )

(DEPRECATED) Get xfer align from a software configuration container

Parameters
paramsSoftware configuration container
valreturned chunk size (frames are attempted to be transferred in chunks)
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_get_xrun_mode()

snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode ( const snd_pcm_sw_params_t * params)

(DEPRECATED) Get xrun mode from a software configuration container

Parameters
paramsSoftware configuration container
Returns
xrun mode

◆ snd_pcm_sw_params_malloc()

int snd_pcm_sw_params_malloc ( snd_pcm_sw_params_t ** ptr)

allocate an invalid #snd_pcm_sw_params_t using standard malloc

Parameters
ptrreturned pointer
Returns
0 on success otherwise negative error code

◆ snd_pcm_sw_params_set_avail_min()

int snd_pcm_sw_params_set_avail_min ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val )

Set avail min inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valMinimum avail frames to consider PCM ready
Returns
0 otherwise a negative error code

Note: This is similar to setting an OSS wakeup point. The valid values for 'val' are determined by the specific hardware. Most PC sound cards can only accept power of 2 frame counts (i.e. 512, 1024, 2048). You cannot use this as a high resolution timer - it is limited to how often the sound card hardware raises an interrupt.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_sw_params_set_period_event()

int snd_pcm_sw_params_set_period_event ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
int val )

Set period event inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
val0 = disable period event, 1 = enable period event
Returns
0 otherwise a negative error code

An poll (select) wakeup event is raised if enabled.

Examples
/test/pcm.c.

◆ snd_pcm_sw_params_set_silence_size()

int snd_pcm_sw_params_set_silence_size ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val )

Set silence size inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valSilence size in frames (0 for disabled)
Returns
0 otherwise a negative error code

A portion of playback buffer is overwritten with silence when playback underrun is nearer than silence threshold (see snd_pcm_sw_params_set_silence_threshold)

When drain silence (see snd_pcm_hw_params_get_drain_silence) is disabled, this will also apply for draining, i.e. silence is written also when the drain end is nearer than the silence threshold.

The special case is when silence size value is equal or greater than boundary. The unused portion of the ring buffer (initial written samples are untouched) is filled with silence at start. Later, only just processed sample area is filled with silence. Note: silence_threshold must be set to zero.

◆ snd_pcm_sw_params_set_silence_threshold()

int snd_pcm_sw_params_set_silence_threshold ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val )

Set silence threshold inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valSilence threshold in frames
Returns
0 otherwise a negative error code

A portion of playback buffer is overwritten with silence (see snd_pcm_sw_params_set_silence_size) when playback underrun is nearer than silence threshold.

◆ snd_pcm_sw_params_set_sleep_min()

int snd_pcm_sw_params_set_sleep_min ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
unsigned int val )

(DEPRECATED) Set minimum number of ticks to sleep inside a software configuration container

Parameters
pcmPCM handle
paramsSoftware configuration container
valMinimum ticks to sleep or 0 to disable the use of tick timer
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_set_start_mode()

int snd_pcm_sw_params_set_start_mode ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_start_t val )

(DEPRECATED) Set start mode inside a software configuration container

Parameters
pcmPCM handle
paramsSoftware configuration container
valStart mode
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_set_start_threshold()

int snd_pcm_sw_params_set_start_threshold ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val )

Set start threshold inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valStart threshold in frames
Returns
0 otherwise a negative error code

PCM is automatically started when playback frames available to PCM are >= threshold or when requested capture frames are >= threshold

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_sw_params_set_stop_threshold()

int snd_pcm_sw_params_set_stop_threshold ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val )

Set stop threshold inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valStop threshold in frames
Returns
0 otherwise a negative error code

PCM is automatically stopped in #SND_PCM_STATE_XRUN state when available frames is >= threshold. If the stop threshold is equal to boundary (also software parameter - sw_param) then automatic stop will be disabled (thus device will do the endless loop in the ring buffer).

◆ snd_pcm_sw_params_set_tstamp_mode()

int snd_pcm_sw_params_set_tstamp_mode ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_tstamp_t val )

Set timestamp mode inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valTimestamp mode
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_set_tstamp_type()

int snd_pcm_sw_params_set_tstamp_type ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_tstamp_type_t val )

Set timestamp type inside a software configuration container.

Parameters
pcmPCM handle
paramsSoftware configuration container
valTimestamp type
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_set_xfer_align()

int snd_pcm_sw_params_set_xfer_align ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_uframes_t val )

(DEPRECATED) Set xfer align inside a software configuration container

Parameters
pcmPCM handle
paramsSoftware configuration container
valChunk size (frames are attempted to be transferred in chunks)
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_set_xrun_mode()

int snd_pcm_sw_params_set_xrun_mode ( snd_pcm_t * pcm,
snd_pcm_sw_params_t * params,
snd_pcm_xrun_t val )

(DEPRECATED) Set xrun mode inside a software configuration container

Parameters
pcmPCM handle
paramsSoftware configuration container
valXrun mode
Returns
0 otherwise a negative error code

◆ snd_pcm_sw_params_sizeof()

size_t snd_pcm_sw_params_sizeof ( )

get size of #snd_pcm_sw_params_t

Returns
size in bytes

◆ snd_pcm_tstamp_mode_name()

const char * snd_pcm_tstamp_mode_name ( const snd_pcm_tstamp_t mode)

get name of PCM tstamp mode setting

Parameters
modePCM tstamp mode
Returns
ascii name of PCM tstamp mode setting

◆ snd_pcm_tstamp_type_name()

const char * snd_pcm_tstamp_type_name ( snd_pcm_tstamp_type_t type)

get name of PCM tstamp type setting

Parameters
typePCM tstamp type
Returns
ascii name of PCM tstamp type setting

◆ snd_pcm_type()

snd_pcm_type_t snd_pcm_type ( snd_pcm_t * pcm)

get type of PCM handle

Parameters
pcmPCM handle
Returns
type of PCM handle

Returns the type #snd_pcm_type_t of given PCM handle.

◆ snd_pcm_type_name()

const char * snd_pcm_type_name ( snd_pcm_type_t type)

get name of PCM type

Parameters
typePCM type
Returns
ascii name of PCM type

◆ snd_pcm_unlink()

int snd_pcm_unlink ( snd_pcm_t * pcm)

Remove a PCM from a linked group.

Parameters
pcmPCM handle
Returns
0 on success otherwise a negative error code
Examples
/test/latency.c.

◆ snd_pcm_wait()

int snd_pcm_wait ( snd_pcm_t * pcm,
int timeout )

Wait for a PCM to become ready.

Parameters
pcmPCM handle
timeoutmaximum time in milliseconds to wait, a -1 value means infinity (SND_PCM_WAIT_INFINITE), see also SND_PCM_WAIT_IO and SND_PCM_WAIT_DRAIN
Returns
a positive value on success otherwise a negative error code (-EPIPE for the xrun and -ESTRPIPE for the suspended status, others for general errors)
Return values
0timeout occurred
1PCM stream is ready for I/O

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, and /test/pcm.c.

◆ snd_pcm_writei()

snd_pcm_sframes_t snd_pcm_writei ( snd_pcm_t * pcm,
const void * buffer,
snd_pcm_uframes_t size )

Write interleaved frames to a PCM.

Parameters
pcmPCM handle
bufferframes containing buffer
sizeframes to be written
Returns
a positive number of frames actually written otherwise a negative error code
Return values
-EBADFDPCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
-EPIPEan underrun occurred
-ESTRPIPEa suspend event occurred (stream is suspended and waiting for an application recovery)

If the blocking behaviour is selected and it is running, then routine waits until all requested frames are played or put to the playback ring buffer. The returned number of frames can be less only if a signal or underrun occurred.

If the non-blocking behaviour is selected, then routine doesn't wait at all.

The function is thread-safe when built with the proper option.

Examples
/test/latency.c, /test/pcm.c, and /test/pcm_min.c.

◆ snd_pcm_writen()

snd_pcm_sframes_t snd_pcm_writen ( snd_pcm_t * pcm,
void ** bufs,
snd_pcm_uframes_t size )

Write non interleaved frames to a PCM.

Parameters
pcmPCM handle
bufsframes containing buffers (one for each channel)
sizeframes to be written
Returns
a positive number of frames actually written otherwise a negative error code
Return values
-EBADFDPCM is not in the right state (#SND_PCM_STATE_PREPARED or #SND_PCM_STATE_RUNNING)
-EPIPEan underrun occurred
-ESTRPIPEa suspend event occurred (stream is suspended and waiting for an application recovery)

If the blocking behaviour is selected and it is running, then routine waits until all requested frames are played or put to the playback ring buffer. The returned number of frames can be less only if a signal or underrun occurred.

If the non-blocking behaviour is selected, then routine doesn't wait at all.

The function is thread-safe when built with the proper option.

◆ snd_pcm_xrun_mode_name()

const char * snd_pcm_xrun_mode_name ( snd_pcm_xrun_t mode)

(DEPRECATED) get name of PCM xrun mode setting

Parameters
modePCM xrun mode
Returns
ascii name of PCM xrun mode setting