linux_audio/raw/
pcm.rs

1//! Low-level type definitions for the digital audio (PCM) interface.
2
3use linux_unsafe::{int, long, off_t, time_t, timespec, uchar, uint, ulong, void};
4
5#[allow(non_camel_case_types)]
6pub type snd_pcm_uframes_t = ulong;
7#[allow(non_camel_case_types)]
8pub type snd_pcm_sframes_t = long;
9
10/// Device class identifier for standard mono or stereo device.
11pub const SNDRV_PCM_CLASS_GENERIC: int = 0;
12/// Device class identifier for multichannel device.
13pub const SNDRV_PCM_CLASS_MULTI: int = 1;
14/// Device class identifier for software modems.
15pub const SNDRV_PCM_CLASS_MODEM: int = 2;
16/// Device class identifier for digitizers.
17pub const SNDRV_PCM_CLASS_DIGITIZER: int = 3;
18pub const SNDRV_PCM_CLASS_LAST: int = SNDRV_PCM_CLASS_DIGITIZER;
19
20/// Mono or stereo subdevices are mixed together.
21pub const SNDRV_PCM_SUBCLASS_GENERIC_MIX: int = 0;
22/// multichannel subdevices are mixed together.
23pub const SNDRV_PCM_SUBCLASS_MULTI_MIX: int = 1;
24pub const SNDRV_PCM_SUBCLASS_LAST: int = SNDRV_PCM_SUBCLASS_MULTI_MIX;
25
26/// [`snd_pcm_info::stream`] value for the "playback" direction.
27pub const SNDRV_PCM_STREAM_PLAYBACK: int = 0;
28/// [`snd_pcm_info::stream`] value for the "capture" direction.
29pub const SNDRV_PCM_STREAM_CAPTURE: int = 1;
30pub const SNDRV_PCM_STREAM_LAST: int = SNDRV_PCM_STREAM_CAPTURE;
31
32#[allow(non_camel_case_types)]
33pub type snd_pcm_access_t = int;
34pub const SNDRV_PCM_ACCESS_MMAP_INTERLEAVED: snd_pcm_access_t = 0;
35pub const SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED: snd_pcm_access_t = 1;
36pub const SNDRV_PCM_ACCESS_MMAP_COMPLEX: snd_pcm_access_t = 2;
37pub const SNDRV_PCM_ACCESS_RW_INTERLEAVED: snd_pcm_access_t = 3;
38pub const SNDRV_PCM_ACCESS_RW_NONINTERLEAVED: snd_pcm_access_t = 4;
39
40#[allow(non_camel_case_types)]
41pub type snd_pcm_format_t = int;
42pub const SNDRV_PCM_FORMAT_S8: snd_pcm_format_t = 0;
43pub const SNDRV_PCM_FORMAT_U8: snd_pcm_format_t = 1;
44pub const SNDRV_PCM_FORMAT_S16_LE: snd_pcm_format_t = 2;
45pub const SNDRV_PCM_FORMAT_S16_BE: snd_pcm_format_t = 3;
46pub const SNDRV_PCM_FORMAT_U16_LE: snd_pcm_format_t = 4;
47pub const SNDRV_PCM_FORMAT_U16_BE: snd_pcm_format_t = 5;
48pub const SNDRV_PCM_FORMAT_S24_LE: snd_pcm_format_t = 6;
49pub const SNDRV_PCM_FORMAT_S24_BE: snd_pcm_format_t = 7;
50pub const SNDRV_PCM_FORMAT_U24_LE: snd_pcm_format_t = 8;
51pub const SNDRV_PCM_FORMAT_U24_BE: snd_pcm_format_t = 9;
52pub const SNDRV_PCM_FORMAT_S32_LE: snd_pcm_format_t = 10;
53pub const SNDRV_PCM_FORMAT_S32_BE: snd_pcm_format_t = 11;
54pub const SNDRV_PCM_FORMAT_U32_LE: snd_pcm_format_t = 12;
55pub const SNDRV_PCM_FORMAT_U32_BE: snd_pcm_format_t = 13;
56pub const SNDRV_PCM_FORMAT_FLOAT_LE: snd_pcm_format_t = 14;
57pub const SNDRV_PCM_FORMAT_FLOAT_BE: snd_pcm_format_t = 15;
58pub const SNDRV_PCM_FORMAT_FLOAT64_LE: snd_pcm_format_t = 16;
59pub const SNDRV_PCM_FORMAT_FLOAT64_BE: snd_pcm_format_t = 17;
60pub const SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE: snd_pcm_format_t = 18;
61pub const SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE: snd_pcm_format_t = 19;
62pub const SNDRV_PCM_FORMAT_MU_LAW: snd_pcm_format_t = 20;
63pub const SNDRV_PCM_FORMAT_A_LAW: snd_pcm_format_t = 21;
64pub const SNDRV_PCM_FORMAT_IMA_ADPCM: snd_pcm_format_t = 22;
65pub const SNDRV_PCM_FORMAT_MPEG: snd_pcm_format_t = 23;
66pub const SNDRV_PCM_FORMAT_GSM: snd_pcm_format_t = 24;
67pub const SNDRV_PCM_FORMAT_S20_LE: snd_pcm_format_t = 25;
68pub const SNDRV_PCM_FORMAT_S20_BE: snd_pcm_format_t = 26;
69pub const SNDRV_PCM_FORMAT_U20_LE: snd_pcm_format_t = 27;
70pub const SNDRV_PCM_FORMAT_U20_BE: snd_pcm_format_t = 28;
71pub const SNDRV_PCM_FORMAT_SPECIAL: snd_pcm_format_t = 31;
72pub const SNDRV_PCM_FORMAT_S24_3LE: snd_pcm_format_t = 32;
73pub const SNDRV_PCM_FORMAT_S24_3BE: snd_pcm_format_t = 33;
74pub const SNDRV_PCM_FORMAT_U24_3LE: snd_pcm_format_t = 34;
75pub const SNDRV_PCM_FORMAT_U24_3BE: snd_pcm_format_t = 35;
76pub const SNDRV_PCM_FORMAT_S20_3LE: snd_pcm_format_t = 36;
77pub const SNDRV_PCM_FORMAT_S20_3BE: snd_pcm_format_t = 37;
78pub const SNDRV_PCM_FORMAT_U20_3LE: snd_pcm_format_t = 38;
79pub const SNDRV_PCM_FORMAT_U20_3BE: snd_pcm_format_t = 39;
80pub const SNDRV_PCM_FORMAT_S18_3LE: snd_pcm_format_t = 40;
81pub const SNDRV_PCM_FORMAT_S18_3BE: snd_pcm_format_t = 41;
82pub const SNDRV_PCM_FORMAT_U18_3LE: snd_pcm_format_t = 42;
83pub const SNDRV_PCM_FORMAT_U18_3BE: snd_pcm_format_t = 43;
84pub const SNDRV_PCM_FORMAT_G723_24: snd_pcm_format_t = 44;
85pub const SNDRV_PCM_FORMAT_G723_24_1B: snd_pcm_format_t = 45;
86pub const SNDRV_PCM_FORMAT_G723_40: snd_pcm_format_t = 46;
87pub const SNDRV_PCM_FORMAT_G723_40_1B: snd_pcm_format_t = 47;
88pub const SNDRV_PCM_FORMAT_DSD_U8: snd_pcm_format_t = 48;
89pub const SNDRV_PCM_FORMAT_DSD_U16_LE: snd_pcm_format_t = 49;
90pub const SNDRV_PCM_FORMAT_DSD_U32_LE: snd_pcm_format_t = 50;
91pub const SNDRV_PCM_FORMAT_DSD_U16_BE: snd_pcm_format_t = 51;
92pub const SNDRV_PCM_FORMAT_DSD_U32_BE: snd_pcm_format_t = 52;
93
94#[allow(non_camel_case_types)]
95pub type snd_pcm_subformat_t = int;
96pub const SNDRV_PCM_SUBFORMAT_STD: snd_pcm_subformat_t = 0;
97pub const SNDRV_PCM_SUBFORMAT_MSBITS_MAX: snd_pcm_subformat_t = 1;
98pub const SNDRV_PCM_SUBFORMAT_MSBITS_20: snd_pcm_subformat_t = 2;
99pub const SNDRV_PCM_SUBFORMAT_MSBITS_24: snd_pcm_subformat_t = 3;
100
101pub const SNDRV_PCM_INFO_MMAP: uint = 0x00000001; /* hardware supports mmap */
102pub const SNDRV_PCM_INFO_MMAP_VALID: uint = 0x00000002; /* period data are valid during transfer */
103pub const SNDRV_PCM_INFO_DOUBLE: uint = 0x00000004; /* Double buffering needed for PCM start/stop */
104pub const SNDRV_PCM_INFO_BATCH: uint = 0x00000010; /* double buffering */
105pub const SNDRV_PCM_INFO_SYNC_APPLPTR: uint = 0x00000020; /* need the explicit sync of appl_ptr update */
106pub const SNDRV_PCM_INFO_PERFECT_DRAIN: uint = 0x00000040; /* silencing at the end of stream is not required */
107pub const SNDRV_PCM_INFO_INTERLEAVED: uint = 0x00000100; /* channels are interleaved */
108pub const SNDRV_PCM_INFO_NONINTERLEAVED: uint = 0x00000200; /* channels are not interleaved */
109pub const SNDRV_PCM_INFO_COMPLEX: uint = 0x00000400; /* complex frame organization (mmap only) */
110pub const SNDRV_PCM_INFO_BLOCK_TRANSFER: uint = 0x00010000; /* hardware transfer block of samples */
111pub const SNDRV_PCM_INFO_OVERRANGE: uint = 0x00020000; /* hardware supports ADC (capture) overrange detection */
112pub const SNDRV_PCM_INFO_RESUME: uint = 0x00040000; /* hardware supports stream resume after suspend */
113pub const SNDRV_PCM_INFO_PAUSE: uint = 0x00080000; /* pause ioctl is supported */
114pub const SNDRV_PCM_INFO_HALF_DUPLEX: uint = 0x00100000; /* only half duplex */
115pub const SNDRV_PCM_INFO_JOINT_DUPLEX: uint = 0x00200000; /* playback and capture stream are somewhat correlated */
116pub const SNDRV_PCM_INFO_SYNC_START: uint = 0x00400000; /* pcm support some kind of sync go */
117pub const SNDRV_PCM_INFO_NO_PERIOD_WAKEUP: uint = 0x00800000; /* period wakeup can be disabled */
118pub const SNDRV_PCM_INFO_HAS_WALL_CLOCK: uint = 0x01000000; /* (Deprecated)has audio wall clock for audio/system time sync */
119pub const SNDRV_PCM_INFO_HAS_LINK_ATIME: uint = 0x01000000; /* report hardware link audio time, reset on startup */
120pub const SNDRV_PCM_INFO_HAS_LINK_ABSOLUTE_ATIME: uint = 0x02000000; /* report absolute hardware link audio time, not reset on startup */
121pub const SNDRV_PCM_INFO_HAS_LINK_ESTIMATED_ATIME: uint = 0x04000000; /* report estimated link audio time */
122pub const SNDRV_PCM_INFO_HAS_LINK_SYNCHRONIZED_ATIME: uint = 0x08000000; /* report synchronized audio/system time */
123pub const SNDRV_PCM_INFO_EXPLICIT_SYNC: uint = 0x10000000; /* needs explicit sync of pointers and data */
124pub const SNDRV_PCM_INFO_NO_REWINDS: uint = 0x20000000; /* hardware can only support monotonic changes of appl_ptr */
125pub const SNDRV_PCM_INFO_DRAIN_TRIGGER: uint = 0x40000000; /* internal kernel flag - trigger in drain */
126pub const SNDRV_PCM_INFO_FIFO_IN_FRAMES: uint = 0x80000000; /* internal kernel flag - FIFO size is in frames */
127
128#[allow(non_camel_case_types)]
129pub type snd_pcm_state_t = int;
130pub const SNDRV_PCM_STATE_OPEN: snd_pcm_state_t = 0; /* stream is open */
131pub const SNDRV_PCM_STATE_SETUP: snd_pcm_state_t = 1; /* stream has a setup */
132pub const SNDRV_PCM_STATE_PREPARED: snd_pcm_state_t = 2; /* stream is ready to start */
133pub const SNDRV_PCM_STATE_RUNNING: snd_pcm_state_t = 3; /* stream is running */
134pub const SNDRV_PCM_STATE_XRUN: snd_pcm_state_t = 4; /* stream reached an xrun */
135pub const SNDRV_PCM_STATE_DRAINING: snd_pcm_state_t = 5; /* stream is draining */
136pub const SNDRV_PCM_STATE_PAUSED: snd_pcm_state_t = 6; /* stream is paused */
137pub const SNDRV_PCM_STATE_SUSPENDED: snd_pcm_state_t = 7; /* hardware is suspended */
138pub const SNDRV_PCM_STATE_DISCONNECTED: snd_pcm_state_t = 8; /* hardware is disconnected */
139
140pub const SNDRV_PCM_MMAP_OFFSET_DATA: usize = 0x00000000;
141#[cfg(target_pointer_width = "32")]
142pub const SNDRV_PCM_MMAP_OFFSET_STATUS: usize = 0x80000000;
143#[cfg(target_pointer_width = "64")]
144pub const SNDRV_PCM_MMAP_OFFSET_STATUS: usize = 0x82000000;
145#[cfg(target_pointer_width = "32")]
146pub const SNDRV_PCM_MMAP_OFFSET_CONTROL: usize = 0x81000000;
147#[cfg(target_pointer_width = "64")]
148pub const SNDRV_PCM_MMAP_OFFSET_CONTROL: usize = 0x83000000;
149
150#[repr(C)]
151#[allow(non_camel_case_types)]
152#[derive(Debug, Clone, Copy)]
153pub struct snd_pcm_info {
154    /// Device number. Usually read only, but writable for control.
155    pub device: uint,
156    /// Subdevice number. Usually read only, but writable for control.
157    pub subdevice: uint,
158    /// Stream direction. Usually read only, but writable for control.
159    pub stream: int,
160    /// Card number. Read-only.
161    pub card: int,
162    /// User-selectable ID.
163    pub id: [uchar; 64],
164    /// Name of this device.
165    pub name: [uchar; 80],
166    /// Subdevice name.
167    pub subname: [uchar; 32],
168    /// Device class, using `SNDRV_PCM_CLASS_*` constants.
169    pub dev_class: int,
170    /// Device subclass, using `SNDRV_PCM_SUBCLASS_*` constants.
171    pub dev_subclass: int,
172    pub subdevices_count: uint,
173    pub subdevices_avail: uint,
174    /// Formerly the hardware synchronization id, but no longer used.
175    pub pad1: [uchar; 16],
176    pub reserved: [uchar; 64],
177}
178
179#[allow(non_camel_case_types)]
180pub type snd_pcm_hw_param_t = int;
181pub const SNDRV_PCM_HW_PARAM_ACCESS: snd_pcm_hw_param_t = 0; /* Access type */
182pub const SNDRV_PCM_HW_PARAM_FORMAT: snd_pcm_hw_param_t = 1; /* Format */
183pub const SNDRV_PCM_HW_PARAM_SUBFORMAT: snd_pcm_hw_param_t = 2; /* Subformat */
184pub const SNDRV_PCM_HW_PARAM_FIRST_MASK: usize = SNDRV_PCM_HW_PARAM_ACCESS as usize;
185pub const SNDRV_PCM_HW_PARAM_LAST_MASK: usize = SNDRV_PCM_HW_PARAM_SUBFORMAT as usize;
186pub const SNDRV_PCM_HW_PARAM_SAMPLE_BITS: snd_pcm_hw_param_t = 8; /* Bits per sample */
187pub const SNDRV_PCM_HW_PARAM_FRAME_BITS: snd_pcm_hw_param_t = 9; /* Bits per frame */
188pub const SNDRV_PCM_HW_PARAM_CHANNELS: snd_pcm_hw_param_t = 10; /* Channels */
189pub const SNDRV_PCM_HW_PARAM_RATE: snd_pcm_hw_param_t = 11; /* Approx rate */
190pub const SNDRV_PCM_HW_PARAM_PERIOD_TIME: snd_pcm_hw_param_t = 12; /* Approx distance between interrupts in us */
191pub const SNDRV_PCM_HW_PARAM_PERIOD_SIZE: snd_pcm_hw_param_t = 13; /* Approx frames between interrupts			 */
192pub const SNDRV_PCM_HW_PARAM_PERIOD_BYTES: snd_pcm_hw_param_t = 14; /* Approx bytes between interrupts */
193pub const SNDRV_PCM_HW_PARAM_PERIODS: snd_pcm_hw_param_t = 15; /* Approx interrupts per buffer */
194pub const SNDRV_PCM_HW_PARAM_BUFFER_TIME: snd_pcm_hw_param_t = 16; /* Approx duration of buffer  in us */
195pub const SNDRV_PCM_HW_PARAM_BUFFER_SIZE: snd_pcm_hw_param_t = 17; /* Size of buffer in frames */
196pub const SNDRV_PCM_HW_PARAM_BUFFER_BYTES: snd_pcm_hw_param_t = 18; /* Size of buffer in bytes */
197pub const SNDRV_PCM_HW_PARAM_TICK_TIME: snd_pcm_hw_param_t = 19; /* Approx tick duration in us */
198pub const SNDRV_PCM_HW_PARAM_FIRST_INTERVAL: usize = SNDRV_PCM_HW_PARAM_SAMPLE_BITS as usize;
199pub const SNDRV_PCM_HW_PARAM_LAST_INTERVAL: usize = SNDRV_PCM_HW_PARAM_TICK_TIME as usize;
200
201pub const SNDRV_PCM_HW_PARAMS_NORESAMPLE: int = 1 << 0; /* avoid rate resampling */
202pub const SNDRV_PCM_HW_PARAMS_EXPORT_BUFFER: int = 1 << 1; /* export buffer */
203pub const SNDRV_PCM_HW_PARAMS_NO_PERIOD_WAKEUP: int = 1 << 2; /* disable period wakeups */
204pub const SNDRV_PCM_HW_PARAMS_NO_DRAIN_SILENCE: int = 1 << 3; /* suppress drain with the filling of the silence samples */
205
206#[repr(C)]
207#[allow(non_camel_case_types)]
208#[derive(Debug, Clone, Copy)]
209pub struct snd_interval {
210    pub min: uint,
211    pub max: uint,
212    /// Bitmask:
213    ///
214    /// - bit 0: openmin
215    /// - bit 1: openmax
216    /// - bit 2: integer
217    /// - bit 3: empty
218    pub flags: uint,
219}
220
221pub const SNDRV_MASK_MAX: usize = 256;
222
223#[repr(C)]
224#[allow(non_camel_case_types)]
225#[derive(Debug, Clone, Copy)]
226pub struct snd_mask {
227    pub bits: [u32; (SNDRV_MASK_MAX + 31) / 32],
228}
229
230#[repr(C)]
231#[allow(non_camel_case_types)]
232#[derive(Debug, Clone, Copy)]
233pub struct snd_pcm_hw_params {
234    pub flags: uint,
235    pub masks: [snd_mask; SNDRV_PCM_HW_PARAM_LAST_MASK - SNDRV_PCM_HW_PARAM_FIRST_MASK + 1],
236    pub mres: [snd_mask; 5], /* reserved masks */
237    pub intervals:
238        [snd_interval; SNDRV_PCM_HW_PARAM_LAST_INTERVAL - SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1],
239    pub ires: [snd_interval; 9],      /* reserved intervals */
240    pub rmask: uint,                  /* W: requested masks */
241    pub cmask: uint,                  /* R: changed masks */
242    pub info: uint,                   /* R: Info flags for returned setup */
243    pub msbits: uint,                 /* R: used most significant bits (in sample bit-width) */
244    pub rate_num: uint,               /* R: rate numerator */
245    pub rate_den: uint,               /* R: rate denominator */
246    pub fifo_size: snd_pcm_uframes_t, /* R: chip FIFO size in frames */
247    pub sync: [uchar; 16],            /* R: synchronization ID (perfect sync - one clock source) */
248    pub reserved: [uchar; 48],        /* reserved for future */
249}
250
251pub const SNDRV_PCM_TSTAMP_NONE: int = 0;
252pub const SNDRV_PCM_TSTAMP_ENABLE: int = 1;
253
254#[repr(C)]
255#[allow(non_camel_case_types)]
256#[derive(Debug, Clone, Copy)]
257pub struct snd_pcm_sw_params {
258    pub tstamp_mode: int, /* timestamp mode */
259    pub period_step: uint,
260    pub sleep_min: uint,                      /* min ticks to sleep */
261    pub avail_min: snd_pcm_uframes_t,         /* min avail frames for wakeup */
262    pub xfer_align: snd_pcm_uframes_t,        /* obsolete: xfer size need to be a multiple */
263    pub start_threshold: snd_pcm_uframes_t,   /* min hw_avail frames for automatic start */
264    pub stop_threshold: snd_pcm_uframes_t,    /* - stop playback */
265    pub silence_threshold: snd_pcm_uframes_t, /* - pre-fill buffer with silence */
266    pub silence_size: snd_pcm_uframes_t, /* max size of silence pre-fill; when >= boundary, fill played area with silence immediately */
267    pub boundary: snd_pcm_uframes_t,     /* pointers wrap point */
268    pub proto: uint,                     /* protocol version */
269    pub tstamp_type: uint,               /* timestamp type (req. proto >= 2.0.12) */
270    pub reserved: [uchar; 56],           /* reserved for future */
271}
272
273#[repr(C)]
274#[allow(non_camel_case_types)]
275#[derive(Debug, Clone, Copy)]
276pub struct snd_pcm_channel_info {
277    pub channel: uint,
278    pub offset: off_t, /* mmap offset */
279    pub first: uint,   /* offset to first sample in bits */
280    pub step: uint,    /* samples distance in bits */
281}
282
283#[repr(C)]
284#[allow(non_camel_case_types)]
285#[derive(Debug, Clone, Copy)]
286pub struct snd_pcm_status {
287    pub state: snd_pcm_state_t, /* stream state */
288    pub pad1: [u8; core::mem::size_of::<time_t>() - core::mem::size_of::<int>()], /* align to timespec */
289    pub trigger_tstamp: timespec, /* time when stream was started/stopped/paused */
290    pub tstamp: timespec,         /* reference timestamp */
291    pub appl_ptr: snd_pcm_uframes_t, /* appl ptr */
292    pub hw_ptr: snd_pcm_uframes_t, /* hw ptr */
293    pub delay: snd_pcm_uframes_t, /* current delay in frames */
294    pub avail: snd_pcm_uframes_t, /* number of frames available */
295    pub avail_max: snd_pcm_uframes_t, /* max frames available on hw since last status */
296    pub overrange: snd_pcm_uframes_t, /* count of ADC (capture) overrange detections from last status */
297    pub suspended_state: snd_pcm_state_t, /* suspended stream state */
298    pub audio_tstamp_data: u32, /* needed for 64-bit alignment, used for configs/report to/from userspace */
299    pub audio_tstamp: timespec, /* sample counter, wall clock, PHC or on-demand sync'ed */
300    pub driver_tstamp: timespec, /* useful in case reference system tstamp is reported with delay */
301    pub audio_tstamp_accuracy: u32, /* in ns units, only valid if indicated in audio_tstamp_data */
302    pub reserved: [uchar; 52 - 2 * core::mem::size_of::<timespec>()], /* must be filled with zero */
303}
304
305// TODO: Finish this
306// https://github.com/torvalds/linux/blob/186f3edfdd41f2ae87fc40a9ccba52a3bf930994/include/uapi/sound/asound.h#L549C1-L559C3
307/*
308#[repr(C)]
309#[allow(non_camel_case_types)]
310#[derive(Clone, Copy)]
311pub union __snd_pcm_sync_ptr_s {
312    status: __snd_pcm_mmap_status,
313    reserved: [uchar; 64],
314}
315
316#[repr(C)]
317#[allow(non_camel_case_types)]
318#[derive(Clone, Copy)]
319pub union __snd_pcm_sync_ptr_c {
320    status: __snd_pcm_mmap_control,
321    reserved: [uchar; 64],
322}
323
324#[repr(C)]
325#[allow(non_camel_case_types)]
326#[derive(Clone, Copy)]
327struct __snd_pcm_sync_ptr {
328    pub flags :uint,
329    pub s: __snd_pcm_sync_ptr_s,
330    pub c: __snd_pcm_sync_ptr_c,
331};
332*/
333
334#[repr(C)]
335#[allow(non_camel_case_types)]
336#[derive(Debug, Clone, Copy)]
337pub struct snd_xferi {
338    pub result: snd_pcm_sframes_t,
339    pub buf: *mut void,
340    pub frames: snd_pcm_uframes_t,
341}
342
343#[repr(C)]
344#[allow(non_camel_case_types)]
345#[derive(Debug, Clone, Copy)]
346pub struct snd_xfern {
347    pub result: snd_pcm_sframes_t,
348    pub bufs: *mut *mut void,
349    pub frames: snd_pcm_uframes_t,
350}
351
352pub const SNDRV_CHMAP_UNKNOWN: uint = 0;
353pub const SNDRV_CHMAP_NA: uint = 1; /* N/A, silent */
354pub const SNDRV_CHMAP_MONO: uint = 2; /* mono stream */
355pub const SNDRV_CHMAP_FL: uint = 3; /* front left */
356pub const SNDRV_CHMAP_FR: uint = 4; /* front right */
357pub const SNDRV_CHMAP_RL: uint = 5; /* rear left */
358pub const SNDRV_CHMAP_RR: uint = 6; /* rear right */
359pub const SNDRV_CHMAP_FC: uint = 7; /* front center */
360pub const SNDRV_CHMAP_LFE: uint = 8; /* LFE */
361pub const SNDRV_CHMAP_SL: uint = 9; /* side left */
362pub const SNDRV_CHMAP_SR: uint = 10; /* side right */
363pub const SNDRV_CHMAP_RC: uint = 11; /* rear center */
364pub const SNDRV_CHMAP_FLC: uint = 12; /* front left center */
365pub const SNDRV_CHMAP_FRC: uint = 13; /* front right center */
366pub const SNDRV_CHMAP_RLC: uint = 14; /* rear left center */
367pub const SNDRV_CHMAP_RRC: uint = 15; /* rear right center */
368pub const SNDRV_CHMAP_FLW: uint = 16; /* front left wide */
369pub const SNDRV_CHMAP_FRW: uint = 17; /* front right wide */
370pub const SNDRV_CHMAP_FLH: uint = 18; /* front left high */
371pub const SNDRV_CHMAP_FCH: uint = 19; /* front center high */
372pub const SNDRV_CHMAP_FRH: uint = 20; /* front right high */
373pub const SNDRV_CHMAP_TC: uint = 21; /* top center */
374pub const SNDRV_CHMAP_TFL: uint = 22; /* top front left */
375pub const SNDRV_CHMAP_TFR: uint = 23; /* top front right */
376pub const SNDRV_CHMAP_TFC: uint = 24; /* top front center */
377pub const SNDRV_CHMAP_TRL: uint = 25; /* top rear left */
378pub const SNDRV_CHMAP_TRR: uint = 26; /* top rear right */
379pub const SNDRV_CHMAP_TRC: uint = 27; /* top rear center */
380pub const SNDRV_CHMAP_TFLC: uint = 28; /* top front left center */
381pub const SNDRV_CHMAP_TFRC: uint = 29; /* top front right center */
382pub const SNDRV_CHMAP_TSL: uint = 30; /* top side left */
383pub const SNDRV_CHMAP_TSR: uint = 31; /* top side right */
384pub const SNDRV_CHMAP_LLFE: uint = 32; /* left LFE */
385pub const SNDRV_CHMAP_RLFE: uint = 33; /* right LFE */
386pub const SNDRV_CHMAP_BC: uint = 34; /* bottom center */
387pub const SNDRV_CHMAP_BLC: uint = 35; /* bottom left center */
388pub const SNDRV_CHMAP_BRC: uint = 36; /* bottom right center */
389pub const SNDRV_CHMAP_POSITION_MASK: uint = 0xffff;
390pub const SNDRV_CHMAP_PHASE_INVERSE: uint = 0x01 << 16;
391pub const SNDRV_CHMAP_DRIVER_SPEC: uint = 0x02 << 16;