/**
* \file include/pcm.h
* \brief Application interface library for the ALSA driver
* \author Jaroslav Kysela <perex@perex.cz>
* \author Abramo Bagnara <abramo@alsa-project.org>
* \author Takashi Iwai <tiwai@suse.de>
* \date 1998-2001
*
* Application interface library for the ALSA driver.
* See the \ref pcm page for more details.
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __ALSA_PCM_H
#define __ALSA_PCM_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup PCM PCM Interface
* See the \ref pcm page for more details.
* \{
*/
/** dlsym version for interface entry callback */
#define SND_PCM_DLSYM_VERSION _dlsym_pcm_001
/** PCM generic info container */
typedef struct _snd_pcm_info snd_pcm_info_t;
/** PCM hardware configuration space container
*
* snd_pcm_hw_params_t is an opaque structure which contains a set of possible
* PCM hardware configurations. For example, a given instance might include a
* range of buffer sizes, a range of period sizes, and a set of several sample
* formats. Some subset of all possible combinations these sets may be valid,
* but not necessarily any combination will be valid.
*
* When a parameter is set or restricted using a snd_pcm_hw_params_set*
* function, all of the other ranges will be updated to exclude as many
* impossible configurations as possible. Attempting to set a parameter
* outside of its acceptable range will result in the function failing
* and an error code being returned.
*/
typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;
/** PCM software configuration container */
typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;
/** PCM status container */
typedef struct _snd_pcm_status snd_pcm_status_t;
/** PCM access types mask */
typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t;
/** PCM formats mask */
typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t;
/** PCM subformats mask */
typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t;
/** PCM class */
typedef enum _snd_pcm_class {
/** standard device */
SND_PCM_CLASS_GENERIC = 0,
/** multichannel device */
SND_PCM_CLASS_MULTI,
/** software modem device */
SND_PCM_CLASS_MODEM,
/** digitizer device */
SND_PCM_CLASS_DIGITIZER,
SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER
} snd_pcm_class_t;
/** PCM subclass */
typedef enum _snd_pcm_subclass {
/** subdevices are mixed together */
SND_PCM_SUBCLASS_GENERIC_MIX = 0,
/** multichannel subdevices are mixed together */
SND_PCM_SUBCLASS_MULTI_MIX,
SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX
} snd_pcm_subclass_t;
/** PCM stream (direction) */
typedef enum _snd_pcm_stream {
/** Playback stream */
SND_PCM_STREAM_PLAYBACK = 0,
/** Capture stream */
SND_PCM_STREAM_CAPTURE,
SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE
} snd_pcm_stream_t;
/** PCM access type */
typedef enum _snd_pcm_access {
/** mmap access with simple interleaved channels */
SND_PCM_ACCESS_MMAP_INTERLEAVED = 0,
/** mmap access with simple non interleaved channels */
SND_PCM_ACCESS_MMAP_NONINTERLEAVED,
/** mmap access with complex placement */
SND_PCM_ACCESS_MMAP_COMPLEX,
/** snd_pcm_readi/snd_pcm_writei access */
SND_PCM_ACCESS_RW_INTERLEAVED,
/** snd_pcm_readn/snd_pcm_writen access */
SND_PCM_ACCESS_RW_NONINTERLEAVED,
SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED
} snd_pcm_access_t;
/** PCM sample format */
typedef enum _snd_pcm_format {
/** Unknown */
SND_PCM_FORMAT_UNKNOWN = -1,
/** Signed 8 bit */
SND_PCM_FORMAT_S8 = 0,
/** Unsigned 8 bit */
SND_PCM_FORMAT_U8,
/** Signed 16 bit Little Endian */
SND_PCM_FORMAT_S16_LE,
/** Signed 16 bit Big Endian */
SND_PCM_FORMAT_S16_BE,
/** Unsigned 16 bit Little Endian */
SND_PCM_FORMAT_U16_LE,
/** Unsigned 16 bit Big Endian */
SND_PCM_FORMAT_U16_BE,
/** Signed 24 bit Little Endian using low three bytes in 32-bit word */
SND_PCM_FORMAT_S24_LE,
/** Signed 24 bit Big Endian using low three bytes in 32-bit word */
SND_PCM_FORMAT_S24_BE,
/** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */
SND_PCM_FORMAT_U24_LE,
/** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */
SND_PCM_FORMAT_U24_BE,
/** Signed 32 bit Little Endian */
SND_PCM_FORMAT_S32_LE,
/** Signed 32 bit Big Endian */
SND_PCM_FORMAT_S32_BE,
/** Unsigned 32 bit Little Endian */
SND_PCM_FORMAT_U32_LE,
/** Unsigned 32 bit Big Endian */
SND_PCM_FORMAT_U32_BE,
/** Float 32 bit Little Endian, Range -1.0 to 1.0 */
SND_PCM_FORMAT_FLOAT_LE,
/** Float 32 bit Big Endian, Range -1.0 to 1.0 */
SND_PCM_FORMAT_FLOAT_BE,
/** Float 64 bit Little Endian, Range -1.0 to 1.0 */
SND_PCM_FORMAT_FLOAT64_LE,
/** Float 64 bit Big Endian, Range -1.0 to 1.0 */
SND_PCM_FORMAT_FLOAT64_BE,
/** IEC-958 Little Endian */
SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
/** IEC-958 Big Endian */
SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
/** Mu-Law */
SND_PCM_FORMAT_MU_LAW,
/** A-Law */
SND_PCM_FORMAT_A_LAW,
/** Ima-ADPCM */
SND_PCM_FORMAT_IMA_ADPCM,
/** MPEG */
SND_PCM_FORMAT_MPEG,
/** GSM */
SND_PCM_FORMAT_GSM,
/** Special */
SND_PCM_FORMAT_SPECIAL = 31,
/** Signed 24bit Little Endian in 3bytes format */
SND_PCM_FORMAT_S24_3LE = 32,
/** Signed 24bit Big Endian in 3bytes format */
SND_PCM_FORMAT_S24_3BE,
/** Unsigned 24bit Little Endian in 3bytes format */
SND_PCM_FORMAT_U24_3LE,
/** Unsigned 24bit Big Endian in 3bytes format */
SND_PCM_FORMAT_U24_3BE,
/** Signed 20bit Little Endian in 3bytes format */
SND_PCM_FORMAT_S20_3LE,
/** Signed 20bit Big Endian in 3bytes format */
SND_PCM_FORMAT_S20_3BE,
/** Unsigned 20bit Little Endian in 3bytes format */
SND_PCM_FORMAT_U20_3LE,
/** Unsigned 20bit Big Endian in 3bytes format */
SND_PCM_FORMAT_U20_3BE,
/** Signed 18bit Little Endian in 3bytes format */
SND_PCM_FORMAT_S18_3LE,
/** Signed 18bit Big Endian in 3bytes format */
SND_PCM_FORMAT_S18_3BE,
/** Unsigned 18bit Little Endian in 3bytes format */
SND_PCM_FORMAT_U18_3LE,
/** Unsigned 18bit Big Endian in 3bytes format */
SND_PCM_FORMAT_U18_3BE,
/* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */
SND_PCM_FORMAT_G723_24,
/* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */
SND_PCM_FORMAT_G723_24_1B,
/* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */
SND_PCM_FORMAT_G723_40,
/* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */
SND_PCM_FORMAT_G723_40_1B,
/* Direct Stream Digital (DSD) in 1-byte samples (x8) */
SND_PCM_FORMAT_DSD_U8,
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
SND_PCM_FORMAT_DSD_U16_LE,
/* Direct Stream Digital (DSD) in 4-byte samples (x32) */
SND_PCM_FORMAT_DSD_U32_LE,
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
SND_PCM_FORMAT_DSD_U16_BE,
/* Direct Stream Digital (DSD) in 4-byte samples (x32) */
SND_PCM_FORMAT_DSD_U32_BE,
SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE,
#if __BYTE_ORDER == __LITTLE_ENDIAN
/** Signed 16 bit CPU endian */
SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE,
/** Unsigned 16 bit CPU endian */
SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE,
/** Signed 24 bit CPU endian */
SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE,
/** Unsigned 24 bit CPU endian */
SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,
/** Signed 32 bit CPU endian */
SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE,
/** Unsigned 32 bit CPU endian */
SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE,
/** Float 32 bit CPU endian */
SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE,
/** Float 64 bit CPU endian */
SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,
/** IEC-958 CPU Endian */
SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE
#elif __BYTE_ORDER == __BIG_ENDIAN
/** Signed 16 bit CPU endian */
SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE,
/** Unsigned 16 bit CPU endian */
SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE,
/** Signed 24 bit CPU endian */
SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE,
/** Unsigned 24 bit CPU endian */
SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE,
/** Signed 32 bit CPU endian */
SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE,
/** Unsigned 32 bit CPU endian */
SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE,
/** Float 32 bit CPU endian */
SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE,
/** Float 64 bit CPU endian */
SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE,
/** IEC-958 CPU Endian */
SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE
#else
#error "Unknown endian"
#endif
} snd_pcm_format_t;
/** PCM sample subformat */
typedef enum _snd_pcm_subformat {
/** Standard */
SND_PCM_SUBFORMAT_STD = 0,
SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD
} snd_pcm_subformat_t;
/** PCM state */
typedef enum _snd_pcm_state {
/** Open */
SND_PCM_STATE_OPEN = 0,
/** Setup installed */
SND_PCM_STATE_SETUP,
/** Ready to start */
SND_PCM_STATE_PREPARED,
/** Running */
SND_PCM_STATE_RUNNING,
/** Stopped: underrun (playback) or overrun (capture) detected */
SND_PCM_STATE_XRUN,
/** Draining: running (playback) or stopped (capture) */
SND_PCM_STATE_DRAINING,
/** Paused */
SND_PCM_STATE_PAUSED,
/** Hardware is suspended */
SND_PCM_STATE_SUSPENDED,
/** Hardware is disconnected */
SND_PCM_STATE_DISCONNECTED,
SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED
} snd_pcm_state_t;
/** PCM start mode */
typedef enum _snd_pcm_start {
/** Automatic start on data read/write */
SND_PCM_START_DATA = 0,
/** Explicit start */
SND_PCM_START_EXPLICIT,
SND_PCM_START_LAST = SND_PCM_START_EXPLICIT
} snd_pcm_start_t;
/** PCM xrun mode */
typedef enum _snd_pcm_xrun {
/** Xrun detection disabled */
SND_PCM_XRUN_NONE = 0,
/** Stop on xrun detection */
SND_PCM_XRUN_STOP,
SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP
} snd_pcm_xrun_t;
/** PCM timestamp mode */
typedef enum _snd_pcm_tstamp {
/** No timestamp */
SND_PCM_TSTAMP_NONE = 0,
/** Update timestamp at every hardware position update */
SND_PCM_TSTAMP_ENABLE,
/** Equivalent with #SND_PCM_TSTAMP_ENABLE,
* just for compatibility with older versions
*/
SND_PCM_TSTAMP_MMAP = SND_PCM_TSTAMP_ENABLE,
SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE
} snd_pcm_tstamp_t;
typedef enum _snd_pcm_tstamp_type {
SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /**< gettimeofday equivalent */
SND_PCM_TSTAMP_TYPE_MONOTONIC, /**< posix_clock_monotonic equivalent */
SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /**< monotonic_raw (no NTP) */
SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,
} snd_pcm_tstamp_type_t;
typedef struct _snd_pcm_audio_tstamp_config {
/* 5 of max 16 bits used */
unsigned int type_requested:4;
unsigned int report_delay:1; /* add total delay to A/D or D/A */
} snd_pcm_audio_tstamp_config_t;
typedef struct _snd_pcm_audio_tstamp_report {
/* 6 of max 16 bits used for bit-fields */
/* for backwards compatibility */
unsigned int valid:1;
/* actual type if hardware could not support requested timestamp */
Loading ...