Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages | Examples

PCM Interface


Files

file  pcm.c
 PCM Interface.

file  pcm_plugin.c
 PCM Interface.


Modules

group Stream Information
group Hardware Parameters
group Software Parameters
group Access Mask Functions
group Format Mask Functions
group Subformat Mask Functions
group Status Functions
group Description Functions
group Debug Functions
group Direct Access (MMAP) Functions
group Helper Functions
group Hook Extension
group Scope Plugin Extension
group Deprecated Functions

Data Structures

struct  _snd_pcm_channel_area
union  _snd_pcm_sync_id

Defines

#define SND_PCM_DLSYM_VERSION   _dlsym_pcm_001
#define SND_PCM_NONBLOCK
#define SND_PCM_ASYNC

Typedefs

typedef _snd_pcm_info snd_pcm_info_t
typedef _snd_pcm_hw_params snd_pcm_hw_params_t
typedef _snd_pcm_sw_params snd_pcm_sw_params_t
typedef _snd_pcm_status snd_pcm_status_t
typedef _snd_pcm_access_mask snd_pcm_access_mask_t
typedef _snd_pcm_format_mask snd_pcm_format_mask_t
typedef _snd_pcm_subformat_mask snd_pcm_subformat_mask_t
typedef enum _snd_pcm_class snd_pcm_class_t
typedef enum _snd_pcm_subclass snd_pcm_subclass_t
typedef enum _snd_pcm_stream snd_pcm_stream_t
typedef enum _snd_pcm_access snd_pcm_access_t
typedef enum _snd_pcm_format snd_pcm_format_t
typedef enum _snd_pcm_subformat snd_pcm_subformat_t
typedef enum _snd_pcm_state snd_pcm_state_t
typedef enum _snd_pcm_start snd_pcm_start_t
typedef enum _snd_pcm_xrun snd_pcm_xrun_t
typedef enum _snd_pcm_tstamp snd_pcm_tstamp_t
typedef unsigned long snd_pcm_uframes_t
typedef long snd_pcm_sframes_t
typedef _snd_pcm snd_pcm_t
typedef enum _snd_pcm_type snd_pcm_type_t
typedef _snd_pcm_channel_area snd_pcm_channel_area_t
typedef _snd_pcm_sync_id snd_pcm_sync_id_t
typedef _snd_pcm_scope snd_pcm_scope_t

Enumerations

enum  _snd_pcm_class {
  SND_PCM_CLASS_GENERIC = 0, SND_PCM_CLASS_MULTI, SND_PCM_CLASS_MODEM, SND_PCM_CLASS_DIGITIZER,
  SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER
}
enum  _snd_pcm_subclass { SND_PCM_SUBCLASS_GENERIC_MIX = 0, SND_PCM_SUBCLASS_MULTI_MIX, SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX }
enum  _snd_pcm_stream { SND_PCM_STREAM_PLAYBACK = 0, SND_PCM_STREAM_CAPTURE, SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE }
enum  _snd_pcm_access {
  SND_PCM_ACCESS_MMAP_INTERLEAVED = 0, SND_PCM_ACCESS_MMAP_NONINTERLEAVED, SND_PCM_ACCESS_MMAP_COMPLEX, SND_PCM_ACCESS_RW_INTERLEAVED,
  SND_PCM_ACCESS_RW_NONINTERLEAVED, SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED
}
enum  _snd_pcm_format {
  SND_PCM_FORMAT_UNKNOWN = -1, SND_PCM_FORMAT_S8 = 0, SND_PCM_FORMAT_U8, SND_PCM_FORMAT_S16_LE,
  SND_PCM_FORMAT_S16_BE, SND_PCM_FORMAT_U16_LE, SND_PCM_FORMAT_U16_BE, SND_PCM_FORMAT_S24_LE,
  SND_PCM_FORMAT_S24_BE, SND_PCM_FORMAT_U24_LE, SND_PCM_FORMAT_U24_BE, SND_PCM_FORMAT_S32_LE,
  SND_PCM_FORMAT_S32_BE, SND_PCM_FORMAT_U32_LE, SND_PCM_FORMAT_U32_BE, SND_PCM_FORMAT_FLOAT_LE,
  SND_PCM_FORMAT_FLOAT_BE, SND_PCM_FORMAT_FLOAT64_LE, SND_PCM_FORMAT_FLOAT64_BE, SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
  SND_PCM_FORMAT_IEC958_SUBFRAME_BE, SND_PCM_FORMAT_MU_LAW, SND_PCM_FORMAT_A_LAW, SND_PCM_FORMAT_IMA_ADPCM,
  SND_PCM_FORMAT_MPEG, SND_PCM_FORMAT_GSM, SND_PCM_FORMAT_SPECIAL = 31, SND_PCM_FORMAT_S24_3LE = 32,
  SND_PCM_FORMAT_S24_3BE, SND_PCM_FORMAT_U24_3LE, SND_PCM_FORMAT_U24_3BE, SND_PCM_FORMAT_S20_3LE,
  SND_PCM_FORMAT_S20_3BE, SND_PCM_FORMAT_U20_3LE, SND_PCM_FORMAT_U20_3BE, SND_PCM_FORMAT_S18_3LE,
  SND_PCM_FORMAT_S18_3BE, SND_PCM_FORMAT_U18_3LE, SND_PCM_FORMAT_U18_3BE, SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE,
  SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE, SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE, SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE, SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,
  SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE, SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE, SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE, SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,
  SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE
}
enum  _snd_pcm_subformat { SND_PCM_SUBFORMAT_STD = 0, SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD }
enum  _snd_pcm_state {
  SND_PCM_STATE_OPEN = 0, SND_PCM_STATE_SETUP, SND_PCM_STATE_PREPARED, SND_PCM_STATE_RUNNING,
  SND_PCM_STATE_XRUN, SND_PCM_STATE_DRAINING, SND_PCM_STATE_PAUSED, SND_PCM_STATE_SUSPENDED,
  SND_PCM_STATE_DISCONNECTED, SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED
}
enum  _snd_pcm_start { SND_PCM_START_DATA = 0, SND_PCM_START_EXPLICIT, SND_PCM_START_LAST = SND_PCM_START_EXPLICIT }
enum  _snd_pcm_xrun { SND_PCM_XRUN_NONE = 0, SND_PCM_XRUN_STOP, SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP }
enum  _snd_pcm_tstamp { SND_PCM_TSTAMP_NONE = 0, SND_PCM_TSTAMP_MMAP, SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_MMAP }
enum  _snd_pcm_type {
  SND_PCM_TYPE_HW = 0, SND_PCM_TYPE_HOOKS, SND_PCM_TYPE_MULTI, SND_PCM_TYPE_FILE,
  SND_PCM_TYPE_NULL, SND_PCM_TYPE_SHM, SND_PCM_TYPE_INET, SND_PCM_TYPE_COPY,
  SND_PCM_TYPE_LINEAR, SND_PCM_TYPE_ALAW, SND_PCM_TYPE_MULAW, SND_PCM_TYPE_ADPCM,
  SND_PCM_TYPE_RATE, SND_PCM_TYPE_ROUTE, SND_PCM_TYPE_PLUG, SND_PCM_TYPE_SHARE,
  SND_PCM_TYPE_METER, SND_PCM_TYPE_MIX, SND_PCM_TYPE_DROUTE, SND_PCM_TYPE_LBSERVER,
  SND_PCM_TYPE_LINEAR_FLOAT, SND_PCM_TYPE_LADSPA, SND_PCM_TYPE_DMIX, SND_PCM_TYPE_JACK,
  SND_PCM_TYPE_DSNOOP, SND_PCM_TYPE_DSHARE, SND_PCM_TYPE_LAST = SND_PCM_TYPE_DSNOOP
}

Functions

int snd_pcm_open (snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode)
 Opens a PCM.

int snd_pcm_open_lconf (snd_pcm_t **pcm, const char *name, snd_pcm_stream_t stream, int mode, snd_config_t *lconf)
 Opens a PCM using local configuration.

int snd_pcm_close (snd_pcm_t *pcm)
 close PCM handle

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_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

int snd_pcm_nonblock (snd_pcm_t *pcm, int nonblock)
 set nonblock mode

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_tsnd_async_handler_get_pcm (snd_async_handler_t *handler)
 Return PCM handle related to an async handler.

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_current (snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 Return current software configuration for a PCM.

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_prepare (snd_pcm_t *pcm)
 Prepare PCM for use.

int snd_pcm_reset (snd_pcm_t *pcm)
 Reset PCM position.

int snd_pcm_status (snd_pcm_t *pcm, snd_pcm_status_t *status)
 Obtain status (runtime) information for PCM handle.

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_state_t snd_pcm_state (snd_pcm_t *pcm)
 Return PCM state.

int snd_pcm_hwsync (snd_pcm_t *pcm)
 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.

snd_pcm_sframes_t snd_pcm_avail_update (snd_pcm_t *pcm)
 Return number of frames ready to be read/written.

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_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_readi (snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
 Read interleaved frames from 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_readn (snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
 Read non interleaved frames to a PCM.

int snd_pcm_wait (snd_pcm_t *pcm, int timeout)
 Wait for a PCM to become ready.

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.


Detailed Description

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

Define Documentation

#define SND_PCM_ASYNC
 

Async notification (flag for open mode)

#define SND_PCM_DLSYM_VERSION   _dlsym_pcm_001
 

dlsym version for interface entry callback

#define SND_PCM_NONBLOCK
 

Non blocking mode (flag for open mode)


Typedef Documentation

typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t
 

PCM access types mask

typedef enum _snd_pcm_access snd_pcm_access_t
 

PCM access type

typedef struct _snd_pcm_channel_area snd_pcm_channel_area_t
 

PCM area specification

typedef enum _snd_pcm_class snd_pcm_class_t
 

PCM class

typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t
 

PCM formats mask

typedef enum _snd_pcm_format snd_pcm_format_t
 

PCM sample format

typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t
 

PCM hardware configuration space container

typedef struct _snd_pcm_info snd_pcm_info_t
 

PCM generic info container

typedef struct _snd_pcm_scope snd_pcm_scope_t
 

SND_PCM_TYPE_METER scope handle

typedef long snd_pcm_sframes_t
 

Signed frames quantity

typedef enum _snd_pcm_start snd_pcm_start_t
 

PCM start mode

typedef enum _snd_pcm_state snd_pcm_state_t
 

PCM state

typedef struct _snd_pcm_status snd_pcm_status_t
 

PCM status container

typedef enum _snd_pcm_stream snd_pcm_stream_t
 

PCM stream (direction)

typedef enum _snd_pcm_subclass snd_pcm_subclass_t
 

PCM subclass

typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t
 

PCM subformats mask

typedef enum _snd_pcm_subformat snd_pcm_subformat_t
 

PCM sample subformat

typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t
 

PCM software configuration container

typedef union _snd_pcm_sync_id snd_pcm_sync_id_t
 

PCM synchronization ID

typedef struct _snd_pcm snd_pcm_t
 

PCM handle

typedef enum _snd_pcm_tstamp snd_pcm_tstamp_t
 

PCM timestamp mode

typedef enum _snd_pcm_type snd_pcm_type_t
 

PCM type

typedef unsigned long snd_pcm_uframes_t
 

Unsigned frames quantity

typedef enum _snd_pcm_xrun snd_pcm_xrun_t
 

PCM xrun mode


Enumeration Type Documentation

enum _snd_pcm_access
 

PCM access type

Enumeration values:
SND_PCM_ACCESS_MMAP_INTERLEAVED  mmap access with simple interleaved channels
SND_PCM_ACCESS_MMAP_NONINTERLEAVED  mmap access with simple non interleaved channels
SND_PCM_ACCESS_MMAP_COMPLEX  mmap access with complex placement
SND_PCM_ACCESS_RW_INTERLEAVED  snd_pcm_readi/snd_pcm_writei access
SND_PCM_ACCESS_RW_NONINTERLEAVED  snd_pcm_readn/snd_pcm_writen access

enum _snd_pcm_class
 

PCM class

Enumeration values:
SND_PCM_CLASS_GENERIC  standard device
SND_PCM_CLASS_MULTI  multichannel device
SND_PCM_CLASS_MODEM  software modem device
SND_PCM_CLASS_DIGITIZER  digitizer device

enum _snd_pcm_format
 

PCM sample format

Enumeration values:
SND_PCM_FORMAT_UNKNOWN  Unknown
SND_PCM_FORMAT_S8  Signed 8 bit
SND_PCM_FORMAT_U8  Unsigned 8 bit
SND_PCM_FORMAT_S16_LE  Signed 16 bit Little Endian
SND_PCM_FORMAT_S16_BE  Signed 16 bit Big Endian
SND_PCM_FORMAT_U16_LE  Unsigned 16 bit Little Endian
SND_PCM_FORMAT_U16_BE  Unsigned 16 bit Big Endian
SND_PCM_FORMAT_S24_LE  Signed 24 bit Little Endian
SND_PCM_FORMAT_S24_BE  Signed 24 bit Big Endian
SND_PCM_FORMAT_U24_LE  Unsigned 24 bit Little Endian
SND_PCM_FORMAT_U24_BE  Unsigned 24 bit Big Endian
SND_PCM_FORMAT_S32_LE  Signed 32 bit Little Endian
SND_PCM_FORMAT_S32_BE  Signed 32 bit Big Endian
SND_PCM_FORMAT_U32_LE  Unsigned 32 bit Little Endian
SND_PCM_FORMAT_U32_BE  Unsigned 32 bit Big Endian
SND_PCM_FORMAT_FLOAT_LE  Float 32 bit Little Endian, Range -1.0 to 1.0
SND_PCM_FORMAT_FLOAT_BE  Float 32 bit Big Endian, Range -1.0 to 1.0
SND_PCM_FORMAT_FLOAT64_LE  Float 64 bit Little Endian, Range -1.0 to 1.0
SND_PCM_FORMAT_FLOAT64_BE  Float 64 bit Big Endian, Range -1.0 to 1.0
SND_PCM_FORMAT_IEC958_SUBFRAME_LE  IEC-958 Little Endian
SND_PCM_FORMAT_IEC958_SUBFRAME_BE  IEC-958 Big Endian
SND_PCM_FORMAT_MU_LAW  Mu-Law
SND_PCM_FORMAT_A_LAW  A-Law
SND_PCM_FORMAT_IMA_ADPCM  Ima-ADPCM
SND_PCM_FORMAT_MPEG  MPEG
SND_PCM_FORMAT_GSM  GSM
SND_PCM_FORMAT_SPECIAL  Special
SND_PCM_FORMAT_S24_3LE  Signed 24bit Little Endian in 3bytes format
SND_PCM_FORMAT_S24_3BE  Signed 24bit Big Endian in 3bytes format
SND_PCM_FORMAT_U24_3LE  Unsigned 24bit Little Endian in 3bytes format
SND_PCM_FORMAT_U24_3BE  Unsigned 24bit Big Endian in 3bytes format
SND_PCM_FORMAT_S20_3LE  Signed 20bit Little Endian in 3bytes format
SND_PCM_FORMAT_S20_3BE  Signed 20bit Big Endian in 3bytes format
SND_PCM_FORMAT_U20_3LE  Unsigned 20bit Little Endian in 3bytes format
SND_PCM_FORMAT_U20_3BE  Unsigned 20bit Big Endian in 3bytes format
SND_PCM_FORMAT_S18_3LE  Signed 18bit Little Endian in 3bytes format
SND_PCM_FORMAT_S18_3BE  Signed 18bit Big Endian in 3bytes format
SND_PCM_FORMAT_U18_3LE  Unsigned 18bit Little Endian in 3bytes format
SND_PCM_FORMAT_U18_3BE  Unsigned 18bit Big Endian in 3bytes format
SND_PCM_FORMAT_S16  Signed 16 bit CPU endian
SND_PCM_FORMAT_U16  Unsigned 16 bit CPU endian
SND_PCM_FORMAT_S24  Signed 24 bit CPU endian
SND_PCM_FORMAT_U24  Unsigned 24 bit CPU endian
SND_PCM_FORMAT_S32  Signed 32 bit CPU endian
SND_PCM_FORMAT_U32  Unsigned 32 bit CPU endian
SND_PCM_FORMAT_FLOAT  Float 32 bit CPU endian
SND_PCM_FORMAT_FLOAT64  Float 64 bit CPU endian
SND_PCM_FORMAT_IEC958_SUBFRAME  IEC-958 CPU Endian

enum _snd_pcm_start
 

PCM start mode

Enumeration values:
SND_PCM_START_DATA  Automatic start on data read/write
SND_PCM_START_EXPLICIT  Explicit start

enum _snd_pcm_state
 

PCM state

Enumeration values:
SND_PCM_STATE_OPEN  Open
SND_PCM_STATE_SETUP  Setup installed
SND_PCM_STATE_PREPARED  Ready to start
SND_PCM_STATE_RUNNING  Running
SND_PCM_STATE_XRUN  Stopped: underrun (playback) or overrun (capture) detected
SND_PCM_STATE_DRAINING  Draining: running (playback) or stopped (capture)
SND_PCM_STATE_PAUSED  Paused
SND_PCM_STATE_SUSPENDED  Hardware is suspended
SND_PCM_STATE_DISCONNECTED  Hardware is disconnected

enum _snd_pcm_stream
 

PCM stream (direction)

Enumeration values:
SND_PCM_STREAM_PLAYBACK  Playback stream
SND_PCM_STREAM_CAPTURE  Capture stream

enum _snd_pcm_subclass
 

PCM subclass

Enumeration values:
SND_PCM_SUBCLASS_GENERIC_MIX  subdevices are mixed together
SND_PCM_SUBCLASS_MULTI_MIX  multichannel subdevices are mixed together

enum _snd_pcm_subformat
 

PCM sample subformat

Enumeration values:
SND_PCM_SUBFORMAT_STD  Standard

enum _snd_pcm_tstamp
 

PCM timestamp mode

Enumeration values:
SND_PCM_TSTAMP_NONE  No timestamp
SND_PCM_TSTAMP_MMAP  Update mmap'ed timestamp

enum _snd_pcm_type
 

PCM type

Enumeration values:
SND_PCM_TYPE_HW  Kernel level PCM
SND_PCM_TYPE_HOOKS  Hooked PCM
SND_PCM_TYPE_MULTI  One ore more linked PCM with exclusive access to selected channels
SND_PCM_TYPE_FILE  File writing plugin
SND_PCM_TYPE_NULL  Null endpoint PCM
SND_PCM_TYPE_SHM  Shared memory client PCM
SND_PCM_TYPE_INET  INET client PCM (not yet implemented)
SND_PCM_TYPE_COPY  Copying plugin
SND_PCM_TYPE_LINEAR  Linear format conversion PCM
SND_PCM_TYPE_ALAW  A-Law format conversion PCM
SND_PCM_TYPE_MULAW  Mu-Law format conversion PCM
SND_PCM_TYPE_ADPCM  IMA-ADPCM format conversion PCM
SND_PCM_TYPE_RATE  Rate conversion PCM
SND_PCM_TYPE_ROUTE  Attenuated static route PCM
SND_PCM_TYPE_PLUG  Format adjusted PCM
SND_PCM_TYPE_SHARE  Sharing PCM
SND_PCM_TYPE_METER  Meter plugin
SND_PCM_TYPE_MIX  Mixing PCM
SND_PCM_TYPE_DROUTE  Attenuated dynamic route PCM (not yet implemented)
SND_PCM_TYPE_LBSERVER  Loopback server plugin (not yet implemented)
SND_PCM_TYPE_LINEAR_FLOAT  Linear Integer <-> Linear Float format conversion PCM
SND_PCM_TYPE_LADSPA  LADSPA integration plugin
SND_PCM_TYPE_DMIX  Direct Mixing plugin
SND_PCM_TYPE_JACK  Jack Audio Connection Kit plugin
SND_PCM_TYPE_DSNOOP  Direct Snooping plugin
SND_PCM_TYPE_DSHARE  Direct Sharing plugin

enum _snd_pcm_xrun
 

PCM xrun mode

Enumeration values:
SND_PCM_XRUN_NONE  Xrun detection disabled
SND_PCM_XRUN_STOP  Stop on xrun detection


Function Documentation

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:
handler Returned handler handle
pcm PCM handle
callback Callback function
private_data Callback 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_pcm_t* snd_async_handler_get_pcm snd_async_handler_t handler  ) 
 

Return PCM handle related to an async handler.

Parameters:
handler Async handler handle
Returns:
PCM handle
Examples:
/test/pcm.c.

snd_pcm_sframes_t snd_pcm_avail_update snd_pcm_t pcm  ) 
 

Return number of frames ready to be read/written.

Parameters:
pcm PCM 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.
Examples:
/test/pcm.c.

int snd_pcm_close snd_pcm_t pcm  ) 
 

close PCM handle

Parameters:
pcm PCM handle
Returns:
0 on success otherwise a negative error code
Closes the specified PCM handle and frees all associated resources.
Examples:
/test/latency.c, and /test/pcm.c.

int snd_pcm_delay snd_pcm_t pcm,
snd_pcm_sframes_t delayp
 

Obtain delay for a running PCM handle.

Parameters:
pcm PCM handle
delayp Returned delay in frames
Returns:
0 on success otherwise a negative error code
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.

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 read/write/begin+commit operation.

int snd_pcm_drain snd_pcm_t pcm  ) 
 

Stop a PCM preserving pending frames.

Parameters:
pcm PCM handle
Returns:
0 on success otherwise a negative error code
Return values:
-ESTRPIPE a 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 instead.

Examples:
/test/latency.c.

int snd_pcm_drop snd_pcm_t pcm  ) 
 

Stop a PCM dropping pending frames.

Parameters:
pcm PCM 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 instead.

Examples:
/test/latency.c.

snd_pcm_sframes_t snd_pcm_forward snd_pcm_t pcm,
snd_pcm_uframes_t  frames
 

Move application frame position forward.

Parameters:
pcm PCM handle
frames wanted skip in frames
Returns:
a positive number for actual skip otherwise a negative error code

int snd_pcm_hw_free snd_pcm_t pcm  ) 
 

Remove PCM hardware configuration and free associated resources.

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

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:
pcm PCM handle
params Configuration 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

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

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

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:
pcm PCM handle
params Configuration space definition container
Returns:
0 on success otherwise a negative error code

int snd_pcm_hwsync snd_pcm_t pcm  ) 
 

Synchronize stream position with hardware.

Parameters:
pcm PCM 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 read/write/begin+commit operation.

int snd_pcm_info snd_pcm_t pcm,
snd_pcm_info_t info
 

Obtain general (static) information for PCM handle.

Parameters:
pcm PCM handle
info Information container
Returns:
0 on success otherwise a negative error code

int snd_pcm_link snd_pcm_t pcm1,
snd_pcm_t pcm2
 

Link two PCMs.

Parameters:
pcm1 first PCM handle
pcm2 first PCM handle
Returns:
0 on success otherwise a negative error code
The two PCMs will start/stop/prepare in sync.
Examples:
/test/latency.c.

const char* snd_pcm_name snd_pcm_t pcm  ) 
 

get identifier of PCM handle

Parameters:
pcm PCM 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().

int snd_pcm_nonblock snd_pcm_t pcm,
int  nonblock
 

set nonblock mode

Parameters:
pcm PCM handle
nonblock 0 = block, 1 = nonblock mode
Returns:
0 on success otherwise a negative error code
Examples:
/test/latency.c.

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

Opens a PCM.

Parameters:
pcmp Returned PCM handle
name ASCII identifier of the PCM handle
stream Wanted stream
mode Open mode (see SND_PCM_NONBLOCK, SND_PCM_ASYNC)
Returns:
0 on success otherwise a negative error code
Examples:
/test/latency.c, and /test/pcm.c.

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:
pcmp Returned PCM handle
name ASCII identifier of the PCM handle
stream Wanted stream
mode Open mode (see SND_PCM_NONBLOCK, SND_PCM_ASYNC)
lconf Local configuration
Returns:
0 on success otherwise a negative error code

int snd_pcm_pause snd_pcm_t pcm,
int  enable
 

Pause/resume PCM.

Parameters:
pcm PCM handle
pause 0 = 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 function.

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

get poll descriptors

Parameters:
pcm PCM handle
pfds array of poll descriptors
space space 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 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 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).

Examples:
/test/pcm.c.

int snd_pcm_poll_descriptors_count snd_pcm_t pcm  ) 
 

get count of poll descriptors for PCM handle

Parameters:
pcm PCM handle
Returns:
count of poll descriptors
Examples:
/test/pcm.c.

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:
pcm PCM handle
pfds array of poll descriptors
nfds count of poll descriptors
revents returned events
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).
Examples:
/test/pcm.c.

int snd_pcm_prepare snd_pcm_t pcm  ) 
 

Prepare PCM for use.

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

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:
pcm PCM handle
buffer frames containing buffer
size frames to be written
Returns:
a positive number of frames actually read otherwise a negative error code
Return values:
-EBADFD PCM is not in the right state (SND_PCM_STATE_PREPARED or SND_PCM_STATE_RUNNING)
-EPIPE an overrun occurred
-ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
If the blocking behaviour was selected, then routine waits until all requested bytes are filled. The count of bytes can be less only if a signal or underrun occurred.

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

Examples:
/test/latency.c.

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:
pcm PCM handle
bufs frames containing buffers (one for each channel)
size frames to be written
Returns:
a positive number of frames actually read otherwise a negative error code
Return values:
-EBADFD PCM is not in the right state (SND_PCM_STATE_PREPARED or SND_PCM_STATE_RUNNING)
-EPIPE an overrun occurred
-ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
If the blocking behaviour was selected, then routine waits until all requested bytes are filled. The count of bytes can be less only if a signal or underrun occurred.

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

int snd_pcm_reset snd_pcm_t pcm  ) 
 

Reset PCM position.

Parameters:
pcm PCM handle
Returns:
0 on success otherwise a negative error code
Reduce PCM delay to 0.

int snd_pcm_resume snd_pcm_t pcm  ) 
 

Resume from suspend, no samples are lost.

Parameters:
pcm PCM handle
Returns:
0 on success otherwise a negative error code
Return values:
-EAGAIN resume can't be proceed immediately (audio hardware is probably still suspended)
-ENOSYS hardware 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 function to recovery.
Examples:
/test/pcm.c.

snd_pcm_sframes_t snd_pcm_rewind snd_pcm_t pcm,
snd_pcm_uframes_t  frames
 

Move application frame position backward.

Parameters:
pcm PCM handle
frames wanted displacement in frames
Returns:
a positive number for actual displacement otherwise a negative error code

int snd_pcm_start snd_pcm_t pcm  ) 
 

Start a PCM.

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

snd_pcm_state_t snd_pcm_state snd_pcm_t pcm  ) 
 

Return PCM state.

Parameters:
pcm PCM 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 .
Examples:
/test/pcm.c.

int snd_pcm_status snd_pcm_t pcm,
snd_pcm_status_t status
 

Obtain status (runtime) information for PCM handle.

Parameters:
pcm PCM handle
status Status container
Returns:
0 on success otherwise a negative error code
Examples:
/test/latency.c.

snd_pcm_stream_t snd_pcm_stream snd_pcm_t pcm  ) 
 

get stream for a PCM handle

Parameters:
pcm PCM handle
Returns:
stream of PCM handle
Returns the type snd_pcm_stream_t of given PCM handle.

int snd_pcm_sw_params snd_pcm_t pcm,
snd_pcm_sw_params_t params
 

Install PCM software configuration defined by params.

Parameters:
pcm PCM handle
params Configuration container
Returns:
0 on success otherwise a negative error code
Examples:
/test/latency.c, and /test/pcm.c.

int snd_pcm_sw_params_current snd_pcm_t pcm,
snd_pcm_sw_params_t params
 

Return current software configuration for a PCM.

Parameters:
pcm PCM handle
params Software configuration container
Returns:
0 on success otherwise a negative error code
Examples:
/test/latency.c, and /test/pcm.c.

snd_pcm_type_t snd_pcm_type snd_pcm_t pcm  ) 
 

get type of PCM handle

Parameters:
pcm PCM handle
Returns:
type of PCM handle
Returns the type snd_pcm_type_t of given PCM handle.

int snd_pcm_unlink snd_pcm_t pcm  ) 
 

Remove a PCM from a linked group.

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

int snd_pcm_wait snd_pcm_t pcm,
int  timeout
 

Wait for a PCM to become ready.

Parameters:
pcm PCM handle
timeout maximum time in milliseconds to wait
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:
0 timeout occurred
1 PCM stream is ready for I/O
Examples:
/test/latency.c, and /test/pcm.c.

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:
pcm PCM handle
buffer frames containing buffer
size frames to be written
Returns:
a positive number of frames actually written otherwise a negative error code
Return values:
-EBADFD PCM is not in the right state (SND_PCM_STATE_PREPARED or SND_PCM_STATE_RUNNING)
-EPIPE an underrun occurred
-ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
If the blocking behaviour is selected, then routine waits until all requested bytes are played or put to the playback ring buffer. The count of bytes can be less only if a signal or underrun occurred.

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

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

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:
pcm PCM handle
bufs frames containing buffers (one for each channel)
size frames to be written
Returns:
a positive number of frames actually written otherwise a negative error code
Return values:
-EBADFD PCM is not in the right state (SND_PCM_STATE_PREPARED or SND_PCM_STATE_RUNNING)
-EPIPE an underrun occurred
-ESTRPIPE a suspend event occurred (stream is suspended and waiting for an application recovery)
If the blocking behaviour is selected, then routine waits until all requested bytes are played or put to the playback ring buffer. The count of bytes can be less only if a signal or underrun occurred.

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


Generated on Mon May 3 16:15:22 2004 for ALSA project - the C library reference by doxygen 1.3.6