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

Stream Information
Hardware Parameters
Software Parameters
Access Mask Functions
Format Mask Functions
Subformat Mask Functions
Status Functions
Description Functions
Debug Functions
Direct Access (MMAP) Functions
Helper Functions
Hook Extension
Scope Plugin Extension
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 timeval snd_timestamp_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_LAST = SND_PCM_STATE_SUSPENDED
}
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
}

Functions

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

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. More...

int snd_pcm_close (snd_pcm_t *pcm)
 close PCM handle. More...

const char * snd_pcm_name (snd_pcm_t *pcm)
 get identifier of PCM handle. More...

snd_pcm_type_t snd_pcm_type (snd_pcm_t *pcm)
 get type of PCM handle. More...

snd_pcm_stream_t snd_pcm_stream (snd_pcm_t *pcm)
 get stream for a PCM handle. More...

int snd_pcm_poll_descriptors_count (snd_pcm_t *pcm)
 get count of poll descriptors for PCM handle. More...

int snd_pcm_poll_descriptors (snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space)
 get poll descriptors. More...

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. More...

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

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. More...

snd_pcm_tsnd_async_handler_get_pcm (snd_async_handler_t *handler)
 Return PCM handle related to an async handler. More...

int snd_pcm_info (snd_pcm_t *pcm, snd_pcm_info_t *info)
 Obtain general (static) information for PCM handle. More...

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. More...

int snd_pcm_hw_free (snd_pcm_t *pcm)
 Remove PCM hardware configuration and free associated resources. More...

int snd_pcm_sw_params (snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
 Install PCM software configuration defined by params. More...

int snd_pcm_prepare (snd_pcm_t *pcm)
 Prepare PCM for use. More...

int snd_pcm_reset (snd_pcm_t *pcm)
 Reset PCM position. More...

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

int snd_pcm_start (snd_pcm_t *pcm)
 Start a PCM. More...

int snd_pcm_drop (snd_pcm_t *pcm)
 Stop a PCM dropping pending frames. More...

int snd_pcm_drain (snd_pcm_t *pcm)
 Stop a PCM preserving pending frames. More...

int snd_pcm_pause (snd_pcm_t *pcm, int enable)
 Pause/resume PCM. More...

snd_pcm_state_t snd_pcm_state (snd_pcm_t *pcm)
 Return PCM state. More...

int snd_pcm_delay (snd_pcm_t *pcm, snd_pcm_sframes_t *delayp)
 Obtain delay for a running PCM handle. More...

int snd_pcm_resume (snd_pcm_t *pcm)
 Resume from suspend, no samples are lost. More...

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

snd_pcm_sframes_t snd_pcm_rewind (snd_pcm_t *pcm, snd_pcm_uframes_t frames)
 Move application frame position backward. More...

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. More...

snd_pcm_sframes_t snd_pcm_readi (snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size)
 Read interleaved frames from a PCM. More...

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. More...

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. More...

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

int snd_pcm_link (snd_pcm_t *pcm1, snd_pcm_t *pcm2)
 Link two PCMs. More...

int snd_pcm_unlink (snd_pcm_t *pcm)
 Remove a PCM from a linked group. More...


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

typedef struct timeval snd_timestamp_t
 

Timestamp


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

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

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.

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.
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
Examples:
/test/latency.c.

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
Examples:
/test/latency.c, and /test/pcm.c.

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

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
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
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 snd_pcm_prepare 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
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.

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
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 Sun Sep 29 12:29:30 2002 for ALSA project - the C library reference by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002