Path: blob/master/thirdparty/linuxbsd_headers/alsa/pcm.h
9898 views
/**1* \file include/pcm.h2* \brief Application interface library for the ALSA driver3* \author Jaroslav Kysela <[email protected]>4* \author Abramo Bagnara <[email protected]>5* \author Takashi Iwai <[email protected]>6* \date 1998-20017*8* Application interface library for the ALSA driver.9* See the \ref pcm page for more details.10*/11/*12* This library is free software; you can redistribute it and/or modify13* it under the terms of the GNU Lesser General Public License as14* published by the Free Software Foundation; either version 2.1 of15* the License, or (at your option) any later version.16*17* This program is distributed in the hope that it will be useful,18* but WITHOUT ANY WARRANTY; without even the implied warranty of19* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20* GNU Lesser General Public License for more details.21*22* You should have received a copy of the GNU Lesser General Public23* License along with this library; if not, write to the Free Software24* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA25*26*/2728#ifndef __ALSA_PCM_H29#define __ALSA_PCM_H3031#ifdef __cplusplus32extern "C" {33#endif3435/**36* \defgroup PCM PCM Interface37* See the \ref pcm page for more details.38* \{39*/4041/** dlsym version for interface entry callback */42#define SND_PCM_DLSYM_VERSION _dlsym_pcm_0014344/** PCM generic info container */45typedef struct _snd_pcm_info snd_pcm_info_t;4647/** PCM hardware configuration space container48*49* snd_pcm_hw_params_t is an opaque structure which contains a set of possible50* PCM hardware configurations. For example, a given instance might include a51* range of buffer sizes, a range of period sizes, and a set of several sample52* formats. Some subset of all possible combinations these sets may be valid,53* but not necessarily any combination will be valid.54*55* When a parameter is set or restricted using a snd_pcm_hw_params_set*56* function, all of the other ranges will be updated to exclude as many57* impossible configurations as possible. Attempting to set a parameter58* outside of its acceptable range will result in the function failing59* and an error code being returned.60*/61typedef struct _snd_pcm_hw_params snd_pcm_hw_params_t;6263/** PCM software configuration container */64typedef struct _snd_pcm_sw_params snd_pcm_sw_params_t;65/** PCM status container */66typedef struct _snd_pcm_status snd_pcm_status_t;67/** PCM access types mask */68typedef struct _snd_pcm_access_mask snd_pcm_access_mask_t;69/** PCM formats mask */70typedef struct _snd_pcm_format_mask snd_pcm_format_mask_t;71/** PCM subformats mask */72typedef struct _snd_pcm_subformat_mask snd_pcm_subformat_mask_t;7374/** PCM class */75typedef enum _snd_pcm_class {76/** standard device */7778SND_PCM_CLASS_GENERIC = 0,79/** multichannel device */80SND_PCM_CLASS_MULTI,81/** software modem device */82SND_PCM_CLASS_MODEM,83/** digitizer device */84SND_PCM_CLASS_DIGITIZER,85SND_PCM_CLASS_LAST = SND_PCM_CLASS_DIGITIZER86} snd_pcm_class_t;8788/** PCM subclass */89typedef enum _snd_pcm_subclass {90/** subdevices are mixed together */91SND_PCM_SUBCLASS_GENERIC_MIX = 0,92/** multichannel subdevices are mixed together */93SND_PCM_SUBCLASS_MULTI_MIX,94SND_PCM_SUBCLASS_LAST = SND_PCM_SUBCLASS_MULTI_MIX95} snd_pcm_subclass_t;9697/** PCM stream (direction) */98typedef enum _snd_pcm_stream {99/** Playback stream */100SND_PCM_STREAM_PLAYBACK = 0,101/** Capture stream */102SND_PCM_STREAM_CAPTURE,103SND_PCM_STREAM_LAST = SND_PCM_STREAM_CAPTURE104} snd_pcm_stream_t;105106/** PCM access type */107typedef enum _snd_pcm_access {108/** mmap access with simple interleaved channels */109SND_PCM_ACCESS_MMAP_INTERLEAVED = 0,110/** mmap access with simple non interleaved channels */111SND_PCM_ACCESS_MMAP_NONINTERLEAVED,112/** mmap access with complex placement */113SND_PCM_ACCESS_MMAP_COMPLEX,114/** snd_pcm_readi/snd_pcm_writei access */115SND_PCM_ACCESS_RW_INTERLEAVED,116/** snd_pcm_readn/snd_pcm_writen access */117SND_PCM_ACCESS_RW_NONINTERLEAVED,118SND_PCM_ACCESS_LAST = SND_PCM_ACCESS_RW_NONINTERLEAVED119} snd_pcm_access_t;120121/** PCM sample format */122typedef enum _snd_pcm_format {123/** Unknown */124SND_PCM_FORMAT_UNKNOWN = -1,125/** Signed 8 bit */126SND_PCM_FORMAT_S8 = 0,127/** Unsigned 8 bit */128SND_PCM_FORMAT_U8,129/** Signed 16 bit Little Endian */130SND_PCM_FORMAT_S16_LE,131/** Signed 16 bit Big Endian */132SND_PCM_FORMAT_S16_BE,133/** Unsigned 16 bit Little Endian */134SND_PCM_FORMAT_U16_LE,135/** Unsigned 16 bit Big Endian */136SND_PCM_FORMAT_U16_BE,137/** Signed 24 bit Little Endian using low three bytes in 32-bit word */138SND_PCM_FORMAT_S24_LE,139/** Signed 24 bit Big Endian using low three bytes in 32-bit word */140SND_PCM_FORMAT_S24_BE,141/** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */142SND_PCM_FORMAT_U24_LE,143/** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */144SND_PCM_FORMAT_U24_BE,145/** Signed 32 bit Little Endian */146SND_PCM_FORMAT_S32_LE,147/** Signed 32 bit Big Endian */148SND_PCM_FORMAT_S32_BE,149/** Unsigned 32 bit Little Endian */150SND_PCM_FORMAT_U32_LE,151/** Unsigned 32 bit Big Endian */152SND_PCM_FORMAT_U32_BE,153/** Float 32 bit Little Endian, Range -1.0 to 1.0 */154SND_PCM_FORMAT_FLOAT_LE,155/** Float 32 bit Big Endian, Range -1.0 to 1.0 */156SND_PCM_FORMAT_FLOAT_BE,157/** Float 64 bit Little Endian, Range -1.0 to 1.0 */158SND_PCM_FORMAT_FLOAT64_LE,159/** Float 64 bit Big Endian, Range -1.0 to 1.0 */160SND_PCM_FORMAT_FLOAT64_BE,161/** IEC-958 Little Endian */162SND_PCM_FORMAT_IEC958_SUBFRAME_LE,163/** IEC-958 Big Endian */164SND_PCM_FORMAT_IEC958_SUBFRAME_BE,165/** Mu-Law */166SND_PCM_FORMAT_MU_LAW,167/** A-Law */168SND_PCM_FORMAT_A_LAW,169/** Ima-ADPCM */170SND_PCM_FORMAT_IMA_ADPCM,171/** MPEG */172SND_PCM_FORMAT_MPEG,173/** GSM */174SND_PCM_FORMAT_GSM,175/** Special */176SND_PCM_FORMAT_SPECIAL = 31,177/** Signed 24bit Little Endian in 3bytes format */178SND_PCM_FORMAT_S24_3LE = 32,179/** Signed 24bit Big Endian in 3bytes format */180SND_PCM_FORMAT_S24_3BE,181/** Unsigned 24bit Little Endian in 3bytes format */182SND_PCM_FORMAT_U24_3LE,183/** Unsigned 24bit Big Endian in 3bytes format */184SND_PCM_FORMAT_U24_3BE,185/** Signed 20bit Little Endian in 3bytes format */186SND_PCM_FORMAT_S20_3LE,187/** Signed 20bit Big Endian in 3bytes format */188SND_PCM_FORMAT_S20_3BE,189/** Unsigned 20bit Little Endian in 3bytes format */190SND_PCM_FORMAT_U20_3LE,191/** Unsigned 20bit Big Endian in 3bytes format */192SND_PCM_FORMAT_U20_3BE,193/** Signed 18bit Little Endian in 3bytes format */194SND_PCM_FORMAT_S18_3LE,195/** Signed 18bit Big Endian in 3bytes format */196SND_PCM_FORMAT_S18_3BE,197/** Unsigned 18bit Little Endian in 3bytes format */198SND_PCM_FORMAT_U18_3LE,199/** Unsigned 18bit Big Endian in 3bytes format */200SND_PCM_FORMAT_U18_3BE,201/* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */202SND_PCM_FORMAT_G723_24,203/* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */204SND_PCM_FORMAT_G723_24_1B,205/* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */206SND_PCM_FORMAT_G723_40,207/* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */208SND_PCM_FORMAT_G723_40_1B,209/* Direct Stream Digital (DSD) in 1-byte samples (x8) */210SND_PCM_FORMAT_DSD_U8,211/* Direct Stream Digital (DSD) in 2-byte samples (x16) */212SND_PCM_FORMAT_DSD_U16_LE,213/* Direct Stream Digital (DSD) in 4-byte samples (x32) */214SND_PCM_FORMAT_DSD_U32_LE,215/* Direct Stream Digital (DSD) in 2-byte samples (x16) */216SND_PCM_FORMAT_DSD_U16_BE,217/* Direct Stream Digital (DSD) in 4-byte samples (x32) */218SND_PCM_FORMAT_DSD_U32_BE,219SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE,220221#if __BYTE_ORDER == __LITTLE_ENDIAN222/** Signed 16 bit CPU endian */223SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE,224/** Unsigned 16 bit CPU endian */225SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE,226/** Signed 24 bit CPU endian */227SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE,228/** Unsigned 24 bit CPU endian */229SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,230/** Signed 32 bit CPU endian */231SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE,232/** Unsigned 32 bit CPU endian */233SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE,234/** Float 32 bit CPU endian */235SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE,236/** Float 64 bit CPU endian */237SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,238/** IEC-958 CPU Endian */239SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE240#elif __BYTE_ORDER == __BIG_ENDIAN241/** Signed 16 bit CPU endian */242SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE,243/** Unsigned 16 bit CPU endian */244SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE,245/** Signed 24 bit CPU endian */246SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE,247/** Unsigned 24 bit CPU endian */248SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE,249/** Signed 32 bit CPU endian */250SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE,251/** Unsigned 32 bit CPU endian */252SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE,253/** Float 32 bit CPU endian */254SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE,255/** Float 64 bit CPU endian */256SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE,257/** IEC-958 CPU Endian */258SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE259#else260#error "Unknown endian"261#endif262} snd_pcm_format_t;263264/** PCM sample subformat */265typedef enum _snd_pcm_subformat {266/** Standard */267SND_PCM_SUBFORMAT_STD = 0,268SND_PCM_SUBFORMAT_LAST = SND_PCM_SUBFORMAT_STD269} snd_pcm_subformat_t;270271/** PCM state */272typedef enum _snd_pcm_state {273/** Open */274SND_PCM_STATE_OPEN = 0,275/** Setup installed */276SND_PCM_STATE_SETUP,277/** Ready to start */278SND_PCM_STATE_PREPARED,279/** Running */280SND_PCM_STATE_RUNNING,281/** Stopped: underrun (playback) or overrun (capture) detected */282SND_PCM_STATE_XRUN,283/** Draining: running (playback) or stopped (capture) */284SND_PCM_STATE_DRAINING,285/** Paused */286SND_PCM_STATE_PAUSED,287/** Hardware is suspended */288SND_PCM_STATE_SUSPENDED,289/** Hardware is disconnected */290SND_PCM_STATE_DISCONNECTED,291SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED292} snd_pcm_state_t;293294/** PCM start mode */295typedef enum _snd_pcm_start {296/** Automatic start on data read/write */297SND_PCM_START_DATA = 0,298/** Explicit start */299SND_PCM_START_EXPLICIT,300SND_PCM_START_LAST = SND_PCM_START_EXPLICIT301} snd_pcm_start_t;302303/** PCM xrun mode */304typedef enum _snd_pcm_xrun {305/** Xrun detection disabled */306SND_PCM_XRUN_NONE = 0,307/** Stop on xrun detection */308SND_PCM_XRUN_STOP,309SND_PCM_XRUN_LAST = SND_PCM_XRUN_STOP310} snd_pcm_xrun_t;311312/** PCM timestamp mode */313typedef enum _snd_pcm_tstamp {314/** No timestamp */315SND_PCM_TSTAMP_NONE = 0,316/** Update timestamp at every hardware position update */317SND_PCM_TSTAMP_ENABLE,318/** Equivalent with #SND_PCM_TSTAMP_ENABLE,319* just for compatibility with older versions320*/321SND_PCM_TSTAMP_MMAP = SND_PCM_TSTAMP_ENABLE,322SND_PCM_TSTAMP_LAST = SND_PCM_TSTAMP_ENABLE323} snd_pcm_tstamp_t;324325typedef enum _snd_pcm_tstamp_type {326SND_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /**< gettimeofday equivalent */327SND_PCM_TSTAMP_TYPE_MONOTONIC, /**< posix_clock_monotonic equivalent */328SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /**< monotonic_raw (no NTP) */329SND_PCM_TSTAMP_TYPE_LAST = SND_PCM_TSTAMP_TYPE_MONOTONIC_RAW,330} snd_pcm_tstamp_type_t;331332typedef struct _snd_pcm_audio_tstamp_config {333/* 5 of max 16 bits used */334unsigned int type_requested:4;335unsigned int report_delay:1; /* add total delay to A/D or D/A */336} snd_pcm_audio_tstamp_config_t;337338typedef struct _snd_pcm_audio_tstamp_report {339/* 6 of max 16 bits used for bit-fields */340341/* for backwards compatibility */342unsigned int valid:1;343344/* actual type if hardware could not support requested timestamp */345unsigned int actual_type:4;346347/* accuracy represented in ns units */348unsigned int accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */349unsigned int accuracy; /* up to 4.29s, will be packed in separate field */350} snd_pcm_audio_tstamp_report_t;351352/** Unsigned frames quantity */353typedef unsigned long snd_pcm_uframes_t;354/** Signed frames quantity */355typedef long snd_pcm_sframes_t;356357/** Non blocking mode (flag for open mode) \hideinitializer */358#define SND_PCM_NONBLOCK 0x00000001359/** Async notification (flag for open mode) \hideinitializer */360#define SND_PCM_ASYNC 0x00000002361/** In an abort state (internal, not allowed for open) */362#define SND_PCM_ABORT 0x00008000363/** Disable automatic (but not forced!) rate resamplinig */364#define SND_PCM_NO_AUTO_RESAMPLE 0x00010000365/** Disable automatic (but not forced!) channel conversion */366#define SND_PCM_NO_AUTO_CHANNELS 0x00020000367/** Disable automatic (but not forced!) format conversion */368#define SND_PCM_NO_AUTO_FORMAT 0x00040000369/** Disable soft volume control */370#define SND_PCM_NO_SOFTVOL 0x00080000371372/** PCM handle */373typedef struct _snd_pcm snd_pcm_t;374375/** PCM type */376enum _snd_pcm_type {377/** Kernel level PCM */378SND_PCM_TYPE_HW = 0,379/** Hooked PCM */380SND_PCM_TYPE_HOOKS,381/** One or more linked PCM with exclusive access to selected382channels */383SND_PCM_TYPE_MULTI,384/** File writing plugin */385SND_PCM_TYPE_FILE,386/** Null endpoint PCM */387SND_PCM_TYPE_NULL,388/** Shared memory client PCM */389SND_PCM_TYPE_SHM,390/** INET client PCM (not yet implemented) */391SND_PCM_TYPE_INET,392/** Copying plugin */393SND_PCM_TYPE_COPY,394/** Linear format conversion PCM */395SND_PCM_TYPE_LINEAR,396/** A-Law format conversion PCM */397SND_PCM_TYPE_ALAW,398/** Mu-Law format conversion PCM */399SND_PCM_TYPE_MULAW,400/** IMA-ADPCM format conversion PCM */401SND_PCM_TYPE_ADPCM,402/** Rate conversion PCM */403SND_PCM_TYPE_RATE,404/** Attenuated static route PCM */405SND_PCM_TYPE_ROUTE,406/** Format adjusted PCM */407SND_PCM_TYPE_PLUG,408/** Sharing PCM */409SND_PCM_TYPE_SHARE,410/** Meter plugin */411SND_PCM_TYPE_METER,412/** Mixing PCM */413SND_PCM_TYPE_MIX,414/** Attenuated dynamic route PCM (not yet implemented) */415SND_PCM_TYPE_DROUTE,416/** Loopback server plugin (not yet implemented) */417SND_PCM_TYPE_LBSERVER,418/** Linear Integer <-> Linear Float format conversion PCM */419SND_PCM_TYPE_LINEAR_FLOAT,420/** LADSPA integration plugin */421SND_PCM_TYPE_LADSPA,422/** Direct Mixing plugin */423SND_PCM_TYPE_DMIX,424/** Jack Audio Connection Kit plugin */425SND_PCM_TYPE_JACK,426/** Direct Snooping plugin */427SND_PCM_TYPE_DSNOOP,428/** Direct Sharing plugin */429SND_PCM_TYPE_DSHARE,430/** IEC958 subframe plugin */431SND_PCM_TYPE_IEC958,432/** Soft volume plugin */433SND_PCM_TYPE_SOFTVOL,434/** External I/O plugin */435SND_PCM_TYPE_IOPLUG,436/** External filter plugin */437SND_PCM_TYPE_EXTPLUG,438/** Mmap-emulation plugin */439SND_PCM_TYPE_MMAP_EMUL,440SND_PCM_TYPE_LAST = SND_PCM_TYPE_MMAP_EMUL441};442443/** PCM type */444typedef enum _snd_pcm_type snd_pcm_type_t;445446/** PCM area specification */447typedef struct _snd_pcm_channel_area {448/** base address of channel samples */449void *addr;450/** offset to first sample in bits */451unsigned int first;452/** samples distance in bits */453unsigned int step;454} snd_pcm_channel_area_t;455456/** PCM synchronization ID */457typedef union _snd_pcm_sync_id {458/** 8-bit ID */459unsigned char id[16];460/** 16-bit ID */461unsigned short id16[8];462/** 32-bit ID */463unsigned int id32[4];464} snd_pcm_sync_id_t;465466/** #SND_PCM_TYPE_METER scope handle */467typedef struct _snd_pcm_scope snd_pcm_scope_t;468469int snd_pcm_open(snd_pcm_t **pcm, const char *name,470snd_pcm_stream_t stream, int mode);471int snd_pcm_open_lconf(snd_pcm_t **pcm, const char *name,472snd_pcm_stream_t stream, int mode,473snd_config_t *lconf);474int snd_pcm_open_fallback(snd_pcm_t **pcm, snd_config_t *root,475const char *name, const char *orig_name,476snd_pcm_stream_t stream, int mode);477478int snd_pcm_close(snd_pcm_t *pcm);479const char *snd_pcm_name(snd_pcm_t *pcm);480snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);481snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm);482int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);483int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);484int snd_pcm_poll_descriptors_revents(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);485int snd_pcm_nonblock(snd_pcm_t *pcm, int nonblock);486static __inline__ int snd_pcm_abort(snd_pcm_t *pcm) { return snd_pcm_nonblock(pcm, 2); }487int snd_async_add_pcm_handler(snd_async_handler_t **handler, snd_pcm_t *pcm,488snd_async_callback_t callback, void *private_data);489snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler);490int snd_pcm_info(snd_pcm_t *pcm, snd_pcm_info_t *info);491int snd_pcm_hw_params_current(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);492int snd_pcm_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);493int snd_pcm_hw_free(snd_pcm_t *pcm);494int snd_pcm_sw_params_current(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);495int snd_pcm_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t *params);496int snd_pcm_prepare(snd_pcm_t *pcm);497int snd_pcm_reset(snd_pcm_t *pcm);498int snd_pcm_status(snd_pcm_t *pcm, snd_pcm_status_t *status);499int snd_pcm_start(snd_pcm_t *pcm);500int snd_pcm_drop(snd_pcm_t *pcm);501int snd_pcm_drain(snd_pcm_t *pcm);502int snd_pcm_pause(snd_pcm_t *pcm, int enable);503snd_pcm_state_t snd_pcm_state(snd_pcm_t *pcm);504int snd_pcm_hwsync(snd_pcm_t *pcm);505int snd_pcm_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *delayp);506int snd_pcm_resume(snd_pcm_t *pcm);507int snd_pcm_htimestamp(snd_pcm_t *pcm, snd_pcm_uframes_t *avail, snd_htimestamp_t *tstamp);508snd_pcm_sframes_t snd_pcm_avail(snd_pcm_t *pcm);509snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);510int snd_pcm_avail_delay(snd_pcm_t *pcm, snd_pcm_sframes_t *availp, snd_pcm_sframes_t *delayp);511snd_pcm_sframes_t snd_pcm_rewindable(snd_pcm_t *pcm);512snd_pcm_sframes_t snd_pcm_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames);513snd_pcm_sframes_t snd_pcm_forwardable(snd_pcm_t *pcm);514snd_pcm_sframes_t snd_pcm_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames);515snd_pcm_sframes_t snd_pcm_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);516snd_pcm_sframes_t snd_pcm_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);517snd_pcm_sframes_t snd_pcm_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);518snd_pcm_sframes_t snd_pcm_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);519int snd_pcm_wait(snd_pcm_t *pcm, int timeout);520521int snd_pcm_link(snd_pcm_t *pcm1, snd_pcm_t *pcm2);522int snd_pcm_unlink(snd_pcm_t *pcm);523524/** channel mapping API version number */525#define SND_CHMAP_API_VERSION ((1 << 16) | (0 << 8) | 1)526527/** channel map list type */528enum snd_pcm_chmap_type {529SND_CHMAP_TYPE_NONE = 0,/**< unspecified channel position */530SND_CHMAP_TYPE_FIXED, /**< fixed channel position */531SND_CHMAP_TYPE_VAR, /**< freely swappable channel position */532SND_CHMAP_TYPE_PAIRED, /**< pair-wise swappable channel position */533SND_CHMAP_TYPE_LAST = SND_CHMAP_TYPE_PAIRED, /**< last entry */534};535536/** channel positions */537enum snd_pcm_chmap_position {538SND_CHMAP_UNKNOWN = 0, /**< unspecified */539SND_CHMAP_NA, /**< N/A, silent */540SND_CHMAP_MONO, /**< mono stream */541SND_CHMAP_FL, /**< front left */542SND_CHMAP_FR, /**< front right */543SND_CHMAP_RL, /**< rear left */544SND_CHMAP_RR, /**< rear right */545SND_CHMAP_FC, /**< front center */546SND_CHMAP_LFE, /**< LFE */547SND_CHMAP_SL, /**< side left */548SND_CHMAP_SR, /**< side right */549SND_CHMAP_RC, /**< rear center */550SND_CHMAP_FLC, /**< front left center */551SND_CHMAP_FRC, /**< front right center */552SND_CHMAP_RLC, /**< rear left center */553SND_CHMAP_RRC, /**< rear right center */554SND_CHMAP_FLW, /**< front left wide */555SND_CHMAP_FRW, /**< front right wide */556SND_CHMAP_FLH, /**< front left high */557SND_CHMAP_FCH, /**< front center high */558SND_CHMAP_FRH, /**< front right high */559SND_CHMAP_TC, /**< top center */560SND_CHMAP_TFL, /**< top front left */561SND_CHMAP_TFR, /**< top front right */562SND_CHMAP_TFC, /**< top front center */563SND_CHMAP_TRL, /**< top rear left */564SND_CHMAP_TRR, /**< top rear right */565SND_CHMAP_TRC, /**< top rear center */566SND_CHMAP_TFLC, /**< top front left center */567SND_CHMAP_TFRC, /**< top front right center */568SND_CHMAP_TSL, /**< top side left */569SND_CHMAP_TSR, /**< top side right */570SND_CHMAP_LLFE, /**< left LFE */571SND_CHMAP_RLFE, /**< right LFE */572SND_CHMAP_BC, /**< bottom center */573SND_CHMAP_BLC, /**< bottom left center */574SND_CHMAP_BRC, /**< bottom right center */575SND_CHMAP_LAST = SND_CHMAP_BRC,576};577578/** bitmask for channel position */579#define SND_CHMAP_POSITION_MASK 0xffff580581/** bit flag indicating the channel is phase inverted */582#define SND_CHMAP_PHASE_INVERSE (0x01 << 16)583/** bit flag indicating the non-standard channel value */584#define SND_CHMAP_DRIVER_SPEC (0x02 << 16)585586/** the channel map header */587typedef struct snd_pcm_chmap {588unsigned int channels; /**< number of channels */589unsigned int pos[0]; /**< channel position array */590} snd_pcm_chmap_t;591592/** the header of array items returned from snd_pcm_query_chmaps() */593typedef struct snd_pcm_chmap_query {594enum snd_pcm_chmap_type type; /**< channel map type */595snd_pcm_chmap_t map; /**< available channel map */596} snd_pcm_chmap_query_t;597598599snd_pcm_chmap_query_t **snd_pcm_query_chmaps(snd_pcm_t *pcm);600snd_pcm_chmap_query_t **snd_pcm_query_chmaps_from_hw(int card, int dev,601int subdev,602snd_pcm_stream_t stream);603void snd_pcm_free_chmaps(snd_pcm_chmap_query_t **maps);604snd_pcm_chmap_t *snd_pcm_get_chmap(snd_pcm_t *pcm);605int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map);606607const char *snd_pcm_chmap_type_name(enum snd_pcm_chmap_type val);608const char *snd_pcm_chmap_name(enum snd_pcm_chmap_position val);609const char *snd_pcm_chmap_long_name(enum snd_pcm_chmap_position val);610int snd_pcm_chmap_print(const snd_pcm_chmap_t *map, size_t maxlen, char *buf);611unsigned int snd_pcm_chmap_from_string(const char *str);612snd_pcm_chmap_t *snd_pcm_chmap_parse_string(const char *str);613614//int snd_pcm_mixer_element(snd_pcm_t *pcm, snd_mixer_t *mixer, snd_mixer_elem_t **elem);615616/*617* application helpers - these functions are implemented on top618* of the basic API619*/620621int snd_pcm_recover(snd_pcm_t *pcm, int err, int silent);622int snd_pcm_set_params(snd_pcm_t *pcm,623snd_pcm_format_t format,624snd_pcm_access_t access,625unsigned int channels,626unsigned int rate,627int soft_resample,628unsigned int latency);629int snd_pcm_get_params(snd_pcm_t *pcm,630snd_pcm_uframes_t *buffer_size,631snd_pcm_uframes_t *period_size);632633/** \} */634635/**636* \defgroup PCM_Info Stream Information637* \ingroup PCM638* See the \ref pcm page for more details.639* \{640*/641642size_t snd_pcm_info_sizeof(void);643/** \hideinitializer644* \brief allocate an invalid #snd_pcm_info_t using standard alloca645* \param ptr returned pointer646*/647#define snd_pcm_info_alloca(ptr) __snd_alloca(ptr, snd_pcm_info)648int snd_pcm_info_malloc(snd_pcm_info_t **ptr);649void snd_pcm_info_free(snd_pcm_info_t *obj);650void snd_pcm_info_copy(snd_pcm_info_t *dst, const snd_pcm_info_t *src);651unsigned int snd_pcm_info_get_device(const snd_pcm_info_t *obj);652unsigned int snd_pcm_info_get_subdevice(const snd_pcm_info_t *obj);653snd_pcm_stream_t snd_pcm_info_get_stream(const snd_pcm_info_t *obj);654int snd_pcm_info_get_card(const snd_pcm_info_t *obj);655const char *snd_pcm_info_get_id(const snd_pcm_info_t *obj);656const char *snd_pcm_info_get_name(const snd_pcm_info_t *obj);657const char *snd_pcm_info_get_subdevice_name(const snd_pcm_info_t *obj);658snd_pcm_class_t snd_pcm_info_get_class(const snd_pcm_info_t *obj);659snd_pcm_subclass_t snd_pcm_info_get_subclass(const snd_pcm_info_t *obj);660unsigned int snd_pcm_info_get_subdevices_count(const snd_pcm_info_t *obj);661unsigned int snd_pcm_info_get_subdevices_avail(const snd_pcm_info_t *obj);662snd_pcm_sync_id_t snd_pcm_info_get_sync(const snd_pcm_info_t *obj);663void snd_pcm_info_set_device(snd_pcm_info_t *obj, unsigned int val);664void snd_pcm_info_set_subdevice(snd_pcm_info_t *obj, unsigned int val);665void snd_pcm_info_set_stream(snd_pcm_info_t *obj, snd_pcm_stream_t val);666667/** \} */668669/**670* \defgroup PCM_HW_Params Hardware Parameters671* \ingroup PCM672* See the \ref pcm page for more details.673* \{674*/675676int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);677678int snd_pcm_hw_params_can_mmap_sample_resolution(const snd_pcm_hw_params_t *params);679int snd_pcm_hw_params_is_double(const snd_pcm_hw_params_t *params);680int snd_pcm_hw_params_is_batch(const snd_pcm_hw_params_t *params);681int snd_pcm_hw_params_is_block_transfer(const snd_pcm_hw_params_t *params);682int snd_pcm_hw_params_is_monotonic(const snd_pcm_hw_params_t *params);683int snd_pcm_hw_params_can_overrange(const snd_pcm_hw_params_t *params);684int snd_pcm_hw_params_can_pause(const snd_pcm_hw_params_t *params);685int snd_pcm_hw_params_can_resume(const snd_pcm_hw_params_t *params);686int snd_pcm_hw_params_is_half_duplex(const snd_pcm_hw_params_t *params);687int snd_pcm_hw_params_is_joint_duplex(const snd_pcm_hw_params_t *params);688int snd_pcm_hw_params_can_sync_start(const snd_pcm_hw_params_t *params);689int snd_pcm_hw_params_can_disable_period_wakeup(const snd_pcm_hw_params_t *params);690int snd_pcm_hw_params_supports_audio_wallclock_ts(const snd_pcm_hw_params_t *params); /* deprecated, use audio_ts_type */691int snd_pcm_hw_params_supports_audio_ts_type(const snd_pcm_hw_params_t *params, int type);692int snd_pcm_hw_params_get_rate_numden(const snd_pcm_hw_params_t *params,693unsigned int *rate_num,694unsigned int *rate_den);695int snd_pcm_hw_params_get_sbits(const snd_pcm_hw_params_t *params);696int snd_pcm_hw_params_get_fifo_size(const snd_pcm_hw_params_t *params);697698#if 0699typedef struct _snd_pcm_hw_strategy snd_pcm_hw_strategy_t;700701/* choices need to be sorted on ascending badness */702typedef struct _snd_pcm_hw_strategy_simple_choices_list {703unsigned int value;704unsigned int badness;705} snd_pcm_hw_strategy_simple_choices_list_t;706707int snd_pcm_hw_params_strategy(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,708const snd_pcm_hw_strategy_t *strategy,709unsigned int badness_min,710unsigned int badness_max);711712void snd_pcm_hw_strategy_free(snd_pcm_hw_strategy_t *strategy);713int snd_pcm_hw_strategy_simple(snd_pcm_hw_strategy_t **strategyp,714unsigned int badness_min,715unsigned int badness_max);716int snd_pcm_hw_params_try_explain_failure(snd_pcm_t *pcm,717snd_pcm_hw_params_t *fail,718snd_pcm_hw_params_t *success,719unsigned int depth,720snd_output_t *out);721722#endif723724size_t snd_pcm_hw_params_sizeof(void);725/** \hideinitializer726* \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca727* \param ptr returned pointer728*/729#define snd_pcm_hw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_hw_params)730int snd_pcm_hw_params_malloc(snd_pcm_hw_params_t **ptr);731void snd_pcm_hw_params_free(snd_pcm_hw_params_t *obj);732void snd_pcm_hw_params_copy(snd_pcm_hw_params_t *dst, const snd_pcm_hw_params_t *src);733734#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)735736int snd_pcm_hw_params_get_access(const snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);737int snd_pcm_hw_params_test_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);738int snd_pcm_hw_params_set_access(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t _access);739int snd_pcm_hw_params_set_access_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);740int snd_pcm_hw_params_set_access_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_t *_access);741int snd_pcm_hw_params_set_access_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);742int snd_pcm_hw_params_get_access_mask(snd_pcm_hw_params_t *params, snd_pcm_access_mask_t *mask);743744int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params, snd_pcm_format_t *val);745int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);746int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val);747int snd_pcm_hw_params_set_format_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);748int snd_pcm_hw_params_set_format_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t *format);749int snd_pcm_hw_params_set_format_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);750void snd_pcm_hw_params_get_format_mask(snd_pcm_hw_params_t *params, snd_pcm_format_mask_t *mask);751752int snd_pcm_hw_params_get_subformat(const snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);753int snd_pcm_hw_params_test_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);754int snd_pcm_hw_params_set_subformat(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t subformat);755int snd_pcm_hw_params_set_subformat_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);756int snd_pcm_hw_params_set_subformat_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_t *subformat);757int snd_pcm_hw_params_set_subformat_mask(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);758void snd_pcm_hw_params_get_subformat_mask(snd_pcm_hw_params_t *params, snd_pcm_subformat_mask_t *mask);759760int snd_pcm_hw_params_get_channels(const snd_pcm_hw_params_t *params, unsigned int *val);761int snd_pcm_hw_params_get_channels_min(const snd_pcm_hw_params_t *params, unsigned int *val);762int snd_pcm_hw_params_get_channels_max(const snd_pcm_hw_params_t *params, unsigned int *val);763int snd_pcm_hw_params_test_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);764int snd_pcm_hw_params_set_channels(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);765int snd_pcm_hw_params_set_channels_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);766int snd_pcm_hw_params_set_channels_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);767int snd_pcm_hw_params_set_channels_minmax(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *min, unsigned int *max);768int snd_pcm_hw_params_set_channels_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);769int snd_pcm_hw_params_set_channels_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);770int snd_pcm_hw_params_set_channels_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);771772int snd_pcm_hw_params_get_rate(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);773int snd_pcm_hw_params_get_rate_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);774int snd_pcm_hw_params_get_rate_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);775int snd_pcm_hw_params_test_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);776int snd_pcm_hw_params_set_rate(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);777int snd_pcm_hw_params_set_rate_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);778int snd_pcm_hw_params_set_rate_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);779int 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);780int snd_pcm_hw_params_set_rate_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);781int snd_pcm_hw_params_set_rate_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);782int snd_pcm_hw_params_set_rate_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);783int snd_pcm_hw_params_set_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);784int snd_pcm_hw_params_get_rate_resample(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);785int snd_pcm_hw_params_set_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);786int snd_pcm_hw_params_get_export_buffer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);787int snd_pcm_hw_params_set_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val);788int snd_pcm_hw_params_get_period_wakeup(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val);789790int snd_pcm_hw_params_get_period_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);791int snd_pcm_hw_params_get_period_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);792int snd_pcm_hw_params_get_period_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);793int snd_pcm_hw_params_test_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);794int snd_pcm_hw_params_set_period_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);795int snd_pcm_hw_params_set_period_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);796int snd_pcm_hw_params_set_period_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);797int 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);798int snd_pcm_hw_params_set_period_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);799int snd_pcm_hw_params_set_period_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);800int snd_pcm_hw_params_set_period_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);801802int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);803int snd_pcm_hw_params_get_period_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);804int snd_pcm_hw_params_get_period_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *frames, int *dir);805int snd_pcm_hw_params_test_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);806int snd_pcm_hw_params_set_period_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val, int dir);807int 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);808int 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);809int 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);810int 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);811int 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);812int 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);813int snd_pcm_hw_params_set_period_size_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);814815int snd_pcm_hw_params_get_periods(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);816int snd_pcm_hw_params_get_periods_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);817int snd_pcm_hw_params_get_periods_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);818int snd_pcm_hw_params_test_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);819int snd_pcm_hw_params_set_periods(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);820int snd_pcm_hw_params_set_periods_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);821int snd_pcm_hw_params_set_periods_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);822int 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);823int snd_pcm_hw_params_set_periods_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);824int snd_pcm_hw_params_set_periods_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);825int snd_pcm_hw_params_set_periods_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);826int snd_pcm_hw_params_set_periods_integer(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);827828int snd_pcm_hw_params_get_buffer_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);829int snd_pcm_hw_params_get_buffer_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);830int snd_pcm_hw_params_get_buffer_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir);831int snd_pcm_hw_params_test_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);832int snd_pcm_hw_params_set_buffer_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir);833int snd_pcm_hw_params_set_buffer_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);834int snd_pcm_hw_params_set_buffer_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);835int 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);836int snd_pcm_hw_params_set_buffer_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);837int snd_pcm_hw_params_set_buffer_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);838int snd_pcm_hw_params_set_buffer_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir);839840int snd_pcm_hw_params_get_buffer_size(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);841int snd_pcm_hw_params_get_buffer_size_min(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);842int snd_pcm_hw_params_get_buffer_size_max(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);843int snd_pcm_hw_params_test_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);844int snd_pcm_hw_params_set_buffer_size(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t val);845int snd_pcm_hw_params_set_buffer_size_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);846int snd_pcm_hw_params_set_buffer_size_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);847int 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);848int snd_pcm_hw_params_set_buffer_size_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);849int snd_pcm_hw_params_set_buffer_size_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);850int snd_pcm_hw_params_set_buffer_size_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);851852#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */853854int snd_pcm_hw_params_get_min_align(const snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val);855856/** \} */857858/**859* \defgroup PCM_SW_Params Software Parameters860* \ingroup PCM861* See the \ref pcm page for more details.862* \{863*/864865size_t snd_pcm_sw_params_sizeof(void);866/** \hideinitializer867* \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca868* \param ptr returned pointer869*/870#define snd_pcm_sw_params_alloca(ptr) __snd_alloca(ptr, snd_pcm_sw_params)871int snd_pcm_sw_params_malloc(snd_pcm_sw_params_t **ptr);872void snd_pcm_sw_params_free(snd_pcm_sw_params_t *obj);873void snd_pcm_sw_params_copy(snd_pcm_sw_params_t *dst, const snd_pcm_sw_params_t *src);874int snd_pcm_sw_params_get_boundary(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);875876#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)877878int snd_pcm_sw_params_set_tstamp_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_t val);879int snd_pcm_sw_params_get_tstamp_mode(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_t *val);880int snd_pcm_sw_params_set_tstamp_type(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t val);881int snd_pcm_sw_params_get_tstamp_type(const snd_pcm_sw_params_t *params, snd_pcm_tstamp_type_t *val);882int snd_pcm_sw_params_set_avail_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);883int snd_pcm_sw_params_get_avail_min(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);884int snd_pcm_sw_params_set_period_event(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, int val);885int snd_pcm_sw_params_get_period_event(const snd_pcm_sw_params_t *params, int *val);886int snd_pcm_sw_params_set_start_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);887int snd_pcm_sw_params_get_start_threshold(const snd_pcm_sw_params_t *paramsm, snd_pcm_uframes_t *val);888int snd_pcm_sw_params_set_stop_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);889int snd_pcm_sw_params_get_stop_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);890int snd_pcm_sw_params_set_silence_threshold(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);891int snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);892int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);893int snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val);894895#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */896897/** \} */898899/* include old API */900#ifndef ALSA_LIBRARY_BUILD901#if defined(ALSA_PCM_OLD_HW_PARAMS_API) || defined(ALSA_PCM_OLD_SW_PARAMS_API)902#include "pcm_old.h"903#endif904#endif905906/**907* \defgroup PCM_Access Access Mask Functions908* \ingroup PCM909* See the \ref pcm page for more details.910* \{911*/912913size_t snd_pcm_access_mask_sizeof(void);914/** \hideinitializer915* \brief allocate an empty #snd_pcm_access_mask_t using standard alloca916* \param ptr returned pointer917*/918#define snd_pcm_access_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_access_mask)919int snd_pcm_access_mask_malloc(snd_pcm_access_mask_t **ptr);920void snd_pcm_access_mask_free(snd_pcm_access_mask_t *obj);921void snd_pcm_access_mask_copy(snd_pcm_access_mask_t *dst, const snd_pcm_access_mask_t *src);922void snd_pcm_access_mask_none(snd_pcm_access_mask_t *mask);923void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask);924int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val);925int snd_pcm_access_mask_empty(const snd_pcm_access_mask_t *mask);926void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);927void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);928929/** \} */930931/**932* \defgroup PCM_Format Format Mask Functions933* \ingroup PCM934* See the \ref pcm page for more details.935* \{936*/937938size_t snd_pcm_format_mask_sizeof(void);939/** \hideinitializer940* \brief allocate an empty #snd_pcm_format_mask_t using standard alloca941* \param ptr returned pointer942*/943#define snd_pcm_format_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_format_mask)944int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);945void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);946void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);947void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask);948void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask);949int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val);950int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask);951void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);952void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);953954/** \} */955956/**957* \defgroup PCM_SubFormat Subformat Mask Functions958* \ingroup PCM959* See the \ref pcm page for more details.960* \{961*/962963size_t snd_pcm_subformat_mask_sizeof(void);964/** \hideinitializer965* \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca966* \param ptr returned pointer967*/968#define snd_pcm_subformat_mask_alloca(ptr) __snd_alloca(ptr, snd_pcm_subformat_mask)969int snd_pcm_subformat_mask_malloc(snd_pcm_subformat_mask_t **ptr);970void snd_pcm_subformat_mask_free(snd_pcm_subformat_mask_t *obj);971void snd_pcm_subformat_mask_copy(snd_pcm_subformat_mask_t *dst, const snd_pcm_subformat_mask_t *src);972void snd_pcm_subformat_mask_none(snd_pcm_subformat_mask_t *mask);973void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask);974int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);975int snd_pcm_subformat_mask_empty(const snd_pcm_subformat_mask_t *mask);976void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);977void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);978979/** \} */980981/**982* \defgroup PCM_Status Status Functions983* \ingroup PCM984* See the \ref pcm page for more details.985* \{986*/987988size_t snd_pcm_status_sizeof(void);989/** \hideinitializer990* \brief allocate an invalid #snd_pcm_status_t using standard alloca991* \param ptr returned pointer992*/993#define snd_pcm_status_alloca(ptr) __snd_alloca(ptr, snd_pcm_status)994int snd_pcm_status_malloc(snd_pcm_status_t **ptr);995void snd_pcm_status_free(snd_pcm_status_t *obj);996void snd_pcm_status_copy(snd_pcm_status_t *dst, const snd_pcm_status_t *src);997snd_pcm_state_t snd_pcm_status_get_state(const snd_pcm_status_t *obj);998void snd_pcm_status_get_trigger_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);999void snd_pcm_status_get_trigger_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);1000void snd_pcm_status_get_tstamp(const snd_pcm_status_t *obj, snd_timestamp_t *ptr);1001void snd_pcm_status_get_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);1002void snd_pcm_status_get_audio_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);1003void snd_pcm_status_get_driver_htstamp(const snd_pcm_status_t *obj, snd_htimestamp_t *ptr);1004void snd_pcm_status_get_audio_htstamp_report(const snd_pcm_status_t *obj,1005snd_pcm_audio_tstamp_report_t *audio_tstamp_report);1006void snd_pcm_status_set_audio_htstamp_config(snd_pcm_status_t *obj,1007snd_pcm_audio_tstamp_config_t *audio_tstamp_config);10081009static inline void snd_pcm_pack_audio_tstamp_config(unsigned int *data,1010snd_pcm_audio_tstamp_config_t *config)1011{1012*data = config->report_delay;1013*data <<= 4;1014*data |= config->type_requested;1015}10161017static inline void snd_pcm_unpack_audio_tstamp_report(unsigned int data, unsigned int accuracy,1018snd_pcm_audio_tstamp_report_t *report)1019{1020data >>= 16;1021report->valid = data & 1;1022report->actual_type = (data >> 1) & 0xF;1023report->accuracy_report = (data >> 5) & 1;1024report->accuracy = accuracy;1025}10261027snd_pcm_sframes_t snd_pcm_status_get_delay(const snd_pcm_status_t *obj);1028snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);1029snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);1030snd_pcm_uframes_t snd_pcm_status_get_overrange(const snd_pcm_status_t *obj);10311032/** \} */10331034/**1035* \defgroup PCM_Description Description Functions1036* \ingroup PCM1037* See the \ref pcm page for more details.1038* \{1039*/10401041const char *snd_pcm_type_name(snd_pcm_type_t type);1042const char *snd_pcm_stream_name(const snd_pcm_stream_t stream);1043const char *snd_pcm_access_name(const snd_pcm_access_t _access);1044const char *snd_pcm_format_name(const snd_pcm_format_t format);1045const char *snd_pcm_format_description(const snd_pcm_format_t format);1046const char *snd_pcm_subformat_name(const snd_pcm_subformat_t subformat);1047const char *snd_pcm_subformat_description(const snd_pcm_subformat_t subformat);1048snd_pcm_format_t snd_pcm_format_value(const char* name);1049const char *snd_pcm_tstamp_mode_name(const snd_pcm_tstamp_t mode);1050const char *snd_pcm_state_name(const snd_pcm_state_t state);10511052/** \} */10531054/**1055* \defgroup PCM_Dump Debug Functions1056* \ingroup PCM1057* See the \ref pcm page for more details.1058* \{1059*/10601061int snd_pcm_dump(snd_pcm_t *pcm, snd_output_t *out);1062int snd_pcm_dump_hw_setup(snd_pcm_t *pcm, snd_output_t *out);1063int snd_pcm_dump_sw_setup(snd_pcm_t *pcm, snd_output_t *out);1064int snd_pcm_dump_setup(snd_pcm_t *pcm, snd_output_t *out);1065int snd_pcm_hw_params_dump(snd_pcm_hw_params_t *params, snd_output_t *out);1066int snd_pcm_sw_params_dump(snd_pcm_sw_params_t *params, snd_output_t *out);1067int snd_pcm_status_dump(snd_pcm_status_t *status, snd_output_t *out);10681069/** \} */10701071/**1072* \defgroup PCM_Direct Direct Access (MMAP) Functions1073* \ingroup PCM1074* See the \ref pcm page for more details.1075* \{1076*/10771078int snd_pcm_mmap_begin(snd_pcm_t *pcm,1079const snd_pcm_channel_area_t **areas,1080snd_pcm_uframes_t *offset,1081snd_pcm_uframes_t *frames);1082snd_pcm_sframes_t snd_pcm_mmap_commit(snd_pcm_t *pcm,1083snd_pcm_uframes_t offset,1084snd_pcm_uframes_t frames);1085snd_pcm_sframes_t snd_pcm_mmap_writei(snd_pcm_t *pcm, const void *buffer, snd_pcm_uframes_t size);1086snd_pcm_sframes_t snd_pcm_mmap_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_uframes_t size);1087snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);1088snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);10891090/** \} */10911092/**1093* \defgroup PCM_Helpers Helper Functions1094* \ingroup PCM1095* See the \ref pcm page for more details.1096* \{1097*/10981099int snd_pcm_format_signed(snd_pcm_format_t format);1100int snd_pcm_format_unsigned(snd_pcm_format_t format);1101int snd_pcm_format_linear(snd_pcm_format_t format);1102int snd_pcm_format_float(snd_pcm_format_t format);1103int snd_pcm_format_little_endian(snd_pcm_format_t format);1104int snd_pcm_format_big_endian(snd_pcm_format_t format);1105int snd_pcm_format_cpu_endian(snd_pcm_format_t format);1106int snd_pcm_format_width(snd_pcm_format_t format); /* in bits */1107int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */1108snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);1109ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);1110u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);1111u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);1112u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);1113u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);1114int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);11151116snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);1117ssize_t snd_pcm_frames_to_bytes(snd_pcm_t *pcm, snd_pcm_sframes_t frames);1118long snd_pcm_bytes_to_samples(snd_pcm_t *pcm, ssize_t bytes);1119ssize_t snd_pcm_samples_to_bytes(snd_pcm_t *pcm, long samples);11201121int snd_pcm_area_silence(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,1122unsigned int samples, snd_pcm_format_t format);1123int snd_pcm_areas_silence(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,1124unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);1125int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_channel, snd_pcm_uframes_t dst_offset,1126const snd_pcm_channel_area_t *src_channel, snd_pcm_uframes_t src_offset,1127unsigned int samples, snd_pcm_format_t format);1128int snd_pcm_areas_copy(const snd_pcm_channel_area_t *dst_channels, snd_pcm_uframes_t dst_offset,1129const snd_pcm_channel_area_t *src_channels, snd_pcm_uframes_t src_offset,1130unsigned int channels, snd_pcm_uframes_t frames, snd_pcm_format_t format);11311132/** \} */11331134/**1135* \defgroup PCM_Hook Hook Extension1136* \ingroup PCM1137* See the \ref pcm page for more details.1138* \{1139*/11401141/** type of pcm hook */1142typedef enum _snd_pcm_hook_type {1143SND_PCM_HOOK_TYPE_HW_PARAMS = 0,1144SND_PCM_HOOK_TYPE_HW_FREE,1145SND_PCM_HOOK_TYPE_CLOSE,1146SND_PCM_HOOK_TYPE_LAST = SND_PCM_HOOK_TYPE_CLOSE1147} snd_pcm_hook_type_t;11481149/** PCM hook container */1150typedef struct _snd_pcm_hook snd_pcm_hook_t;1151/** PCM hook callback function */1152typedef int (*snd_pcm_hook_func_t)(snd_pcm_hook_t *hook);1153snd_pcm_t *snd_pcm_hook_get_pcm(snd_pcm_hook_t *hook);1154void *snd_pcm_hook_get_private(snd_pcm_hook_t *hook);1155void snd_pcm_hook_set_private(snd_pcm_hook_t *hook, void *private_data);1156int snd_pcm_hook_add(snd_pcm_hook_t **hookp, snd_pcm_t *pcm,1157snd_pcm_hook_type_t type,1158snd_pcm_hook_func_t func, void *private_data);1159int snd_pcm_hook_remove(snd_pcm_hook_t *hook);11601161/** \} */11621163/**1164* \defgroup PCM_Scope Scope Plugin Extension1165* \ingroup PCM1166* See the \ref pcm page for more details.1167* \{1168*/11691170/** #SND_PCM_TYPE_METER scope functions */1171typedef struct _snd_pcm_scope_ops {1172/** \brief Enable and prepare it using current params1173* \param scope scope handle1174*/1175int (*enable)(snd_pcm_scope_t *scope);1176/** \brief Disable1177* \param scope scope handle1178*/1179void (*disable)(snd_pcm_scope_t *scope);1180/** \brief PCM has been started1181* \param scope scope handle1182*/1183void (*start)(snd_pcm_scope_t *scope);1184/** \brief PCM has been stopped1185* \param scope scope handle1186*/1187void (*stop)(snd_pcm_scope_t *scope);1188/** \brief New frames are present1189* \param scope scope handle1190*/1191void (*update)(snd_pcm_scope_t *scope);1192/** \brief Reset status1193* \param scope scope handle1194*/1195void (*reset)(snd_pcm_scope_t *scope);1196/** \brief PCM is closing1197* \param scope scope handle1198*/1199void (*close)(snd_pcm_scope_t *scope);1200} snd_pcm_scope_ops_t;12011202snd_pcm_uframes_t snd_pcm_meter_get_bufsize(snd_pcm_t *pcm);1203unsigned int snd_pcm_meter_get_channels(snd_pcm_t *pcm);1204unsigned int snd_pcm_meter_get_rate(snd_pcm_t *pcm);1205snd_pcm_uframes_t snd_pcm_meter_get_now(snd_pcm_t *pcm);1206snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm);1207int snd_pcm_meter_add_scope(snd_pcm_t *pcm, snd_pcm_scope_t *scope);1208snd_pcm_scope_t *snd_pcm_meter_search_scope(snd_pcm_t *pcm, const char *name);1209int snd_pcm_scope_malloc(snd_pcm_scope_t **ptr);1210void snd_pcm_scope_set_ops(snd_pcm_scope_t *scope,1211const snd_pcm_scope_ops_t *val);1212void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val);1213const char *snd_pcm_scope_get_name(snd_pcm_scope_t *scope);1214void *snd_pcm_scope_get_callback_private(snd_pcm_scope_t *scope);1215void snd_pcm_scope_set_callback_private(snd_pcm_scope_t *scope, void *val);1216int snd_pcm_scope_s16_open(snd_pcm_t *pcm, const char *name,1217snd_pcm_scope_t **scopep);1218int16_t *snd_pcm_scope_s16_get_channel_buffer(snd_pcm_scope_t *scope,1219unsigned int channel);12201221/** \} */12221223/**1224* \defgroup PCM_Simple Simple setup functions1225* \ingroup PCM1226* See the \ref pcm page for more details.1227* \{1228*/12291230/** Simple PCM latency type */1231typedef enum _snd_spcm_latency {1232/** standard latency - for standard playback or capture1233(estimated latency in one direction 350ms) */1234SND_SPCM_LATENCY_STANDARD = 0,1235/** medium latency - software phones etc.1236(estimated latency in one direction maximally 25ms */1237SND_SPCM_LATENCY_MEDIUM,1238/** realtime latency - realtime applications (effect processors etc.)1239(estimated latency in one direction 5ms and better) */1240SND_SPCM_LATENCY_REALTIME1241} snd_spcm_latency_t;12421243/** Simple PCM xrun type */1244typedef enum _snd_spcm_xrun_type {1245/** driver / library will ignore all xruns, the stream runs forever */1246SND_SPCM_XRUN_IGNORE = 0,1247/** driver / library stops the stream when an xrun occurs */1248SND_SPCM_XRUN_STOP1249} snd_spcm_xrun_type_t;12501251/** Simple PCM duplex type */1252typedef enum _snd_spcm_duplex_type {1253/** liberal duplex - the buffer and period sizes might not match */1254SND_SPCM_DUPLEX_LIBERAL = 0,1255/** pedantic duplex - the buffer and period sizes MUST match */1256SND_SPCM_DUPLEX_PEDANTIC1257} snd_spcm_duplex_type_t;12581259int snd_spcm_init(snd_pcm_t *pcm,1260unsigned int rate,1261unsigned int channels,1262snd_pcm_format_t format,1263snd_pcm_subformat_t subformat,1264snd_spcm_latency_t latency,1265snd_pcm_access_t _access,1266snd_spcm_xrun_type_t xrun_type);12671268int snd_spcm_init_duplex(snd_pcm_t *playback_pcm,1269snd_pcm_t *capture_pcm,1270unsigned int rate,1271unsigned int channels,1272snd_pcm_format_t format,1273snd_pcm_subformat_t subformat,1274snd_spcm_latency_t latency,1275snd_pcm_access_t _access,1276snd_spcm_xrun_type_t xrun_type,1277snd_spcm_duplex_type_t duplex_type);12781279int snd_spcm_init_get_params(snd_pcm_t *pcm,1280unsigned int *rate,1281snd_pcm_uframes_t *buffer_size,1282snd_pcm_uframes_t *period_size);12831284/** \} */12851286/**1287* \defgroup PCM_Deprecated Deprecated Functions1288* \ingroup PCM1289* See the \ref pcm page for more details.1290* \{1291*/12921293/* Deprecated functions, for compatibility */1294const char *snd_pcm_start_mode_name(snd_pcm_start_t mode) __attribute__((deprecated));1295const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode) __attribute__((deprecated));1296int snd_pcm_sw_params_set_start_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_start_t val) __attribute__((deprecated));1297snd_pcm_start_t snd_pcm_sw_params_get_start_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));1298int snd_pcm_sw_params_set_xrun_mode(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_xrun_t val) __attribute__((deprecated));1299snd_pcm_xrun_t snd_pcm_sw_params_get_xrun_mode(const snd_pcm_sw_params_t *params) __attribute__((deprecated));1300#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_SW_PARAMS_API)1301int snd_pcm_sw_params_set_xfer_align(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val) __attribute__((deprecated));1302int snd_pcm_sw_params_get_xfer_align(const snd_pcm_sw_params_t *params, snd_pcm_uframes_t *val) __attribute__((deprecated));1303int snd_pcm_sw_params_set_sleep_min(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, unsigned int val) __attribute__((deprecated));1304int snd_pcm_sw_params_get_sleep_min(const snd_pcm_sw_params_t *params, unsigned int *val) __attribute__((deprecated));1305#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_SW_PARAMS_API */1306#if !defined(ALSA_LIBRARY_BUILD) && !defined(ALSA_PCM_OLD_HW_PARAMS_API)1307int snd_pcm_hw_params_get_tick_time(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1308int snd_pcm_hw_params_get_tick_time_min(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1309int snd_pcm_hw_params_get_tick_time_max(const snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1310int snd_pcm_hw_params_test_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));1311int snd_pcm_hw_params_set_tick_time(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int val, int dir) __attribute__((deprecated));1312int snd_pcm_hw_params_set_tick_time_min(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1313int snd_pcm_hw_params_set_tick_time_max(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1314int 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) __attribute__((deprecated));1315int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1316int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1317int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, unsigned int *val, int *dir) __attribute__((deprecated));1318#endif /* !ALSA_LIBRARY_BUILD && !ALSA_PCM_OLD_HW_PARAMS_API */13191320/** \} */13211322#ifdef __cplusplus1323}1324#endif13251326#endif /* __ALSA_PCM_H */132713281329