source: contrib/API/include/unidef.h@ 655

Last change on this file since 655 was 578, checked in by David Azarewicz, 11 years ago

API updates

File size: 32.0 KB
Line 
1/*
2 * This file is part of uniaud.dll.
3 *
4 * Copyright (c) 2010 Mensys BV
5 * Copyright (c) 2007 Vlad Stelmahovsky aka Vladest
6 *
7 * This library is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation, either version 3 of
10 * the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License and the GNU General Public License along with this library.
19 * If not, see <http://www.gnu.org/licenses/>.
20 */
21#ifndef __UNIDEF__
22#define __UNIDEF__
23
24#include <sys/time.h>
25#include <sys/types.h>
26#include <limits.h>
27#include "errno.h"
28
29#define TARGET_OS2
30
31#pragma pack (4)
32
33#ifndef __GNUC__
34#define __attribute__(x) /*NOTHING*/
35#endif
36
37#define __BYTE_ORDER __LITTLE_ENDIAN
38#define SNDRV_LITTLE_ENDIAN
39
40/*
41 * errors definitions
42 */
43
44#define UNIAUD_NO_ERROR 0
45#define UNIAUD_ALSA32OPEN_ERROR 10001
46#define UNIAUD_INVALID_PARAMETER 10002
47#define UNIAUD_ERROR_IN_DRIVER 10003
48#define UNIAUD_MEMORY_ERROR 10004
49#define UNIAUD_INVALID_CARD 10005
50#define UNIAUD_ERROR_INVALID_PCM_PARAMS 10006
51#define UNIAUD_PCM_OPEN_ERROR 10007
52#define UNIAUD_PCM_WRITE_ERROR 10008
53#define UNIAUD_NOT_FOUND 10009
54#define UNIAUD_MIXER_ERROR 10010
55#define UNIAUD_ERROR_RESAMPLE_INIT 10011
56
57#define SIZE_DEVICE_NAME 32
58
59#define MAX_CARDS 8
60
61#define MAX_CHANNELS 8
62
63#define PCM_TYPE_WRITE 0
64#define PCM_TYPE_READ 1
65
66typedef struct sndrv_ctl_card_info {
67 int card; /* card number */
68 int pad; /* reserved for future (was type) */
69 unsigned char id[16]; /* ID of card (user selectable) */
70 unsigned char driver[16]; /* Driver name */
71 unsigned char name[32]; /* Short name of soundcard */
72 unsigned char longname[80]; /* name + info text about soundcard */
73 unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
74 unsigned char mixername[80]; /* visual mixer identification */
75 unsigned char components[80]; /* card components / fine identification, delimited with one space (AC97 etc..) */
76 unsigned char reserved[48]; /* reserved for future */
77} UniaudCardInfo;
78
79enum sndrv_ctl_elem_iface {
80 SNDRV_CTL_ELEM_IFACE_CARD = 0, /* global control */
81 SNDRV_CTL_ELEM_IFACE_HWDEP, /* hardware dependent device */
82 SNDRV_CTL_ELEM_IFACE_MIXER, /* virtual mixer device */
83 SNDRV_CTL_ELEM_IFACE_PCM, /* PCM device */
84 SNDRV_CTL_ELEM_IFACE_RAWMIDI, /* RawMidi device */
85 SNDRV_CTL_ELEM_IFACE_TIMER, /* timer device */
86 SNDRV_CTL_ELEM_IFACE_SEQUENCER, /* sequencer client */
87 SNDRV_CTL_ELEM_IFACE_LAST = SNDRV_CTL_ELEM_IFACE_SEQUENCER,
88};
89
90typedef struct sndrv_ctl_elem_id {
91 unsigned int numid; /* numeric identifier, zero = invalid */
92 enum sndrv_ctl_elem_iface iface; /* interface identifier */
93 unsigned int device; /* device/client number */
94 unsigned int subdevice; /* subdevice (substream) number */
95 unsigned char name[44]; /* ASCII name of item */
96 unsigned int index; /* index of item */
97} UniaudControl;
98
99enum sndrv_ctl_elem_type {
100 SNDRV_CTL_ELEM_TYPE_NONE = 0, /* invalid */
101 SNDRV_CTL_ELEM_TYPE_BOOLEAN, /* boolean type */
102 SNDRV_CTL_ELEM_TYPE_INTEGER, /* integer type */
103 SNDRV_CTL_ELEM_TYPE_ENUMERATED, /* enumerated type */
104 SNDRV_CTL_ELEM_TYPE_BYTES, /* byte array */
105 SNDRV_CTL_ELEM_TYPE_IEC958, /* IEC958 (S/PDIF) setup */
106 SNDRV_CTL_ELEM_TYPE_INTEGER64, /* 64-bit integer type */
107 SNDRV_CTL_ELEM_TYPE_LAST = SNDRV_CTL_ELEM_TYPE_INTEGER64,
108};
109
110typedef struct sndrv_ctl_elem_info {
111 UniaudControl id; /* W: element ID */
112 enum sndrv_ctl_elem_type type; /* R: value type - SNDRV_CTL_ELEM_TYPE_* */
113 unsigned int access; /* R: value access (bitmask) - SNDRV_CTL_ELEM_ACCESS_* */
114 unsigned int count; /* count of values */
115 int owner; /* owner's PID of this control */
116 union {
117 struct {
118 long min; /* R: minimum value */
119 long max; /* R: maximum value */
120 long step; /* R: step (0 variable) */
121 } integer;
122 struct {
123 long long min; /* R: minimum value */
124 long long max; /* R: maximum value */
125 long long step; /* R: step (0 variable) */
126 } integer64;
127 struct {
128 unsigned int items; /* R: number of items */
129 unsigned int item; /* W: item number */
130 char name[64]; /* R: value name */
131 } enumerated;
132 unsigned char reserved[128];
133 } value;
134 union {
135 unsigned short d[4]; /* dimensions */
136 unsigned short *d_ptr; /* indirect */
137 } dimen;
138 unsigned char reserved[64-4*sizeof(unsigned short)];
139} UniaudControlInfo;
140
141struct sndrv_aes_iec958 {
142 unsigned char status[24]; /* AES/IEC958 channel status bits */
143 unsigned char subcode[147]; /* AES/IEC958 subcode bits */
144 unsigned char pad; /* nothing */
145 unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */
146};
147
148struct timespec {
149 long tv_sec; /* seconds */
150 long tv_usec; /* and microseconds */
151};
152
153typedef struct sndrv_ctl_elem_value {
154 UniaudControl id; /* W: element ID */
155 unsigned int indirect: 1; /* W: use indirect pointer (xxx_ptr member) */
156 union {
157 union {
158 long value[128];
159 long *value_ptr;
160 } integer;
161 union {
162 long long value[64];
163 long long *value_ptr;
164 } integer64;
165 union {
166 unsigned int item[128];
167 unsigned int *item_ptr;
168 } enumerated;
169 union {
170 unsigned char data[512];
171 unsigned char *data_ptr;
172 } bytes;
173 struct sndrv_aes_iec958 iec958;
174 } value; /* RO */
175 struct timespec tstamp;
176 unsigned char reserved[128-sizeof(struct timespec)];
177} UniaudControlValue;
178
179
180typedef struct {
181 ULONG nrStreams; //nr of activate wave streams supported
182 ULONG ulMinChannels; //min nr of channels
183 ULONG ulMaxChannels; //max nr of channels
184 ULONG ulChanFlags; //channel flags
185 ULONG ulMinRate; //min sample rate
186 ULONG ulMaxRate; //max sample rate
187 ULONG ulRateFlags; //sample rate flags
188 ULONG ulDataFormats; //supported wave formats
189} WAVE_CAPS, *PWAVE_CAPS, FAR *LPWAVE_CAPS;
190
191typedef struct {
192 ULONG nrDevices; //total nr of audio devices
193 ULONG ulCaps; //device caps
194 char szDeviceName[SIZE_DEVICE_NAME];
195 char szMixerName[SIZE_DEVICE_NAME];
196 WAVE_CAPS waveOutCaps;
197 WAVE_CAPS waveInCaps;
198} OSS32_DEVCAPS, *POSS32_DEVCAPS, FAR *LPOSS32_DEVCAPS;
199
200
201typedef struct sndrv_pcm_hw_params snd_pcm_hw_params_t;
202typedef struct sndrv_pcm_sw_params snd_pcm_sw_params_t;
203//typedef enum sndrv_pcm_hw_param snd_pcm_hw_param_t;
204typedef struct sndrv_mask snd_mask_t;
205typedef struct sndrv_interval snd_interval_t;
206/** Unsigned frames quantity */
207typedef unsigned long snd_pcm_uframes_t;
208typedef long snd_pcm_sframes_t;
209typedef struct sndrv_pcm_status snd_pcm_status_t;
210
211
212enum sndrv_pcm_stream {
213 SNDRV_PCM_STREAM_PLAYBACK = 0,
214 SNDRV_PCM_STREAM_CAPTURE,
215 SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
216};
217
218enum sndrv_pcm_access {
219 SNDRV_PCM_ACCESS_MMAP_INTERLEAVED = 0, /* interleaved mmap */
220 SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED, /* noninterleaved mmap */
221 SNDRV_PCM_ACCESS_MMAP_COMPLEX, /* complex mmap */
222 SNDRV_PCM_ACCESS_RW_INTERLEAVED, /* readi/writei */
223 SNDRV_PCM_ACCESS_RW_NONINTERLEAVED, /* readn/writen */
224 SNDRV_PCM_ACCESS_LAST = SNDRV_PCM_ACCESS_RW_NONINTERLEAVED,
225};
226
227enum sndrv_pcm_format {
228 SNDRV_PCM_FORMAT_S8 = 0,
229 SNDRV_PCM_FORMAT_U8,
230 SNDRV_PCM_FORMAT_S16_LE,
231 SNDRV_PCM_FORMAT_S16_BE,
232 SNDRV_PCM_FORMAT_U16_LE,
233 SNDRV_PCM_FORMAT_U16_BE,
234 SNDRV_PCM_FORMAT_S24_LE, /* low three bytes */
235 SNDRV_PCM_FORMAT_S24_BE, /* low three bytes */
236 SNDRV_PCM_FORMAT_U24_LE, /* low three bytes */
237 SNDRV_PCM_FORMAT_U24_BE, /* low three bytes */
238 SNDRV_PCM_FORMAT_S32_LE,
239 SNDRV_PCM_FORMAT_S32_BE,
240 SNDRV_PCM_FORMAT_U32_LE,
241 SNDRV_PCM_FORMAT_U32_BE,
242 SNDRV_PCM_FORMAT_FLOAT_LE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
243 SNDRV_PCM_FORMAT_FLOAT_BE, /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
244 SNDRV_PCM_FORMAT_FLOAT64_LE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
245 SNDRV_PCM_FORMAT_FLOAT64_BE, /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
246 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE, /* IEC-958 subframe, Little Endian */
247 SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE, /* IEC-958 subframe, Big Endian */
248 SNDRV_PCM_FORMAT_MU_LAW,
249 SNDRV_PCM_FORMAT_A_LAW,
250 SNDRV_PCM_FORMAT_IMA_ADPCM,
251 SNDRV_PCM_FORMAT_MPEG,
252 SNDRV_PCM_FORMAT_GSM,
253 SNDRV_PCM_FORMAT_SPECIAL = 31,
254 SNDRV_PCM_FORMAT_S24_3LE = 32, /* in three bytes */
255 SNDRV_PCM_FORMAT_S24_3BE, /* in three bytes */
256 SNDRV_PCM_FORMAT_U24_3LE, /* in three bytes */
257 SNDRV_PCM_FORMAT_U24_3BE, /* in three bytes */
258 SNDRV_PCM_FORMAT_S20_3LE, /* in three bytes */
259 SNDRV_PCM_FORMAT_S20_3BE, /* in three bytes */
260 SNDRV_PCM_FORMAT_U20_3LE, /* in three bytes */
261 SNDRV_PCM_FORMAT_U20_3BE, /* in three bytes */
262 SNDRV_PCM_FORMAT_S18_3LE, /* in three bytes */
263 SNDRV_PCM_FORMAT_S18_3BE, /* in three bytes */
264 SNDRV_PCM_FORMAT_U18_3LE, /* in three bytes */
265 SNDRV_PCM_FORMAT_U18_3BE, /* in three bytes */
266 SNDRV_PCM_FORMAT_LAST = SNDRV_PCM_FORMAT_U18_3BE,
267
268#ifdef SNDRV_LITTLE_ENDIAN
269 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_LE,
270 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_LE,
271 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_LE,
272 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_LE,
273 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_LE,
274 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_LE,
275 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_LE,
276 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_LE,
277 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE,
278#endif
279#ifdef SNDRV_BIG_ENDIAN
280 SNDRV_PCM_FORMAT_S16 = SNDRV_PCM_FORMAT_S16_BE,
281 SNDRV_PCM_FORMAT_U16 = SNDRV_PCM_FORMAT_U16_BE,
282 SNDRV_PCM_FORMAT_S24 = SNDRV_PCM_FORMAT_S24_BE,
283 SNDRV_PCM_FORMAT_U24 = SNDRV_PCM_FORMAT_U24_BE,
284 SNDRV_PCM_FORMAT_S32 = SNDRV_PCM_FORMAT_S32_BE,
285 SNDRV_PCM_FORMAT_U32 = SNDRV_PCM_FORMAT_U32_BE,
286 SNDRV_PCM_FORMAT_FLOAT = SNDRV_PCM_FORMAT_FLOAT_BE,
287 SNDRV_PCM_FORMAT_FLOAT64 = SNDRV_PCM_FORMAT_FLOAT64_BE,
288 SNDRV_PCM_FORMAT_IEC958_SUBFRAME = SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE,
289#endif
290};
291
292enum sndrv_pcm_subformat {
293 SNDRV_PCM_SUBFORMAT_STD = 0,
294 SNDRV_PCM_SUBFORMAT_LAST = SNDRV_PCM_SUBFORMAT_STD,
295};
296
297#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
298#define SNDRV_PCM_INFO_MMAP_VALID 0x00000002 /* period data are valid during transfer */
299#define SNDRV_PCM_INFO_DOUBLE 0x00000004 /* Double buffering needed for PCM start/stop */
300#define SNDRV_PCM_INFO_BATCH 0x00000010 /* double buffering */
301#define SNDRV_PCM_INFO_INTERLEAVED 0x00000100 /* channels are interleaved */
302#define SNDRV_PCM_INFO_NONINTERLEAVED 0x00000200 /* channels are not interleaved */
303#define SNDRV_PCM_INFO_COMPLEX 0x00000400 /* complex frame organization (mmap only) */
304#define SNDRV_PCM_INFO_BLOCK_TRANSFER 0x00010000 /* hardware transfer block of samples */
305#define SNDRV_PCM_INFO_OVERRANGE 0x00020000 /* hardware supports ADC (capture) overrange detection */
306#define SNDRV_PCM_INFO_RESUME 0x00040000 /* hardware supports stream resume after suspend */
307#define SNDRV_PCM_INFO_PAUSE 0x00080000 /* pause ioctl is supported */
308#define SNDRV_PCM_INFO_HALF_DUPLEX 0x00100000 /* only half duplex */
309#define SNDRV_PCM_INFO_JOINT_DUPLEX 0x00200000 /* playback and capture stream are somewhat correlated */
310#define SNDRV_PCM_INFO_SYNC_START 0x00400000 /* pcm support some kind of sync go */
311#define SNDRV_PCM_INFO_NONATOMIC_OPS 0x00800000 /* non-atomic prepare callback */
312
313enum sndrv_pcm_state {
314 SNDRV_PCM_STATE_OPEN = 0, /* stream is open */
315 SNDRV_PCM_STATE_SETUP, /* stream has a setup */
316 SNDRV_PCM_STATE_PREPARED, /* stream is ready to start */
317 SNDRV_PCM_STATE_RUNNING, /* stream is running */
318 SNDRV_PCM_STATE_XRUN, /* stream reached an xrun */
319 SNDRV_PCM_STATE_DRAINING, /* stream is draining */
320 SNDRV_PCM_STATE_PAUSED, /* stream is paused */
321 SNDRV_PCM_STATE_SUSPENDED, /* hardware is suspended */
322 SNDRV_PCM_STATE_DISCONNECTED, /* hardware is disconnected */
323 SNDRV_PCM_STATE_LAST = SNDRV_PCM_STATE_DISCONNECTED,
324};
325
326/* for further details see the ACPI and PCI power management specification */
327#define SNDRV_CTL_POWER_D0 0x0000 /* full On */
328#define SNDRV_CTL_POWER_D1 0x0100 /* partial On */
329#define SNDRV_CTL_POWER_D2 0x0200 /* partial On */
330#define SNDRV_CTL_POWER_D3 0x0300 /* Off */
331#define SNDRV_CTL_POWER_D3hot (SNDRV_CTL_POWER_D3|0x0000) /* Off,with power */
332#define SNDRV_CTL_POWER_D3cold (SNDRV_CTL_POWER_D3|0x0001) /* Off,without power */
333
334#define SNDRV_MASK_BITS 64 /* we use so far 64bits only */
335#define SNDRV_MASK_SIZE (SNDRV_MASK_BITS / 32)
336#define SND_MASK_MAX 64
337
338#define MASK_INLINE static inline
339
340#define MASK_MAX SND_MASK_MAX
341#define MASK_SIZE (MASK_MAX / 32)
342
343#define INTERVAL_INLINE static inline
344
345#define MASK_OFS(i) ((i) >> 5)
346#define MASK_BIT(i) (1U << ((i) & 31))
347
348#define SND_PCM_HW_PARAM_ACCESS SNDRV_PCM_HW_PARAM_ACCESS
349#define SND_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_FIRST_MASK
350#define SND_PCM_HW_PARAM_FORMAT SNDRV_PCM_HW_PARAM_FORMAT
351#define SND_PCM_HW_PARAM_SUBFORMAT SNDRV_PCM_HW_PARAM_SUBFORMAT
352#define SND_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_LAST_MASK
353#define SND_PCM_HW_PARAM_SAMPLE_BITS SNDRV_PCM_HW_PARAM_SAMPLE_BITS
354#define SND_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_FIRST_INTERVAL
355#define SND_PCM_HW_PARAM_FRAME_BITS SNDRV_PCM_HW_PARAM_FRAME_BITS
356#define SND_PCM_HW_PARAM_CHANNELS SNDRV_PCM_HW_PARAM_CHANNELS
357#define SND_PCM_HW_PARAM_RATE SNDRV_PCM_HW_PARAM_RATE
358#define SND_PCM_HW_PARAM_PERIOD_TIME SNDRV_PCM_HW_PARAM_PERIOD_TIME
359#define SND_PCM_HW_PARAM_PERIOD_SIZE SNDRV_PCM_HW_PARAM_PERIOD_SIZE
360#define SND_PCM_HW_PARAM_PERIOD_BYTES SNDRV_PCM_HW_PARAM_PERIOD_BYTES
361#define SND_PCM_HW_PARAM_PERIODS SNDRV_PCM_HW_PARAM_PERIODS
362#define SND_PCM_HW_PARAM_BUFFER_TIME SNDRV_PCM_HW_PARAM_BUFFER_TIME
363#define SND_PCM_HW_PARAM_BUFFER_SIZE SNDRV_PCM_HW_PARAM_BUFFER_SIZE
364#define SND_PCM_HW_PARAM_BUFFER_BYTES SNDRV_PCM_HW_PARAM_BUFFER_BYTES
365#define SND_PCM_HW_PARAM_TICK_TIME SNDRV_PCM_HW_PARAM_TICK_TIME
366#define SND_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_LAST_INTERVAL
367#define SND_PCM_HW_PARAMS_RUNTIME SNDRV_PCM_HW_PARAMS_RUNTIME
368#define SND_PCM_HW_PARAM_LAST_MASK SNDRV_PCM_HW_PARAM_LAST_MASK
369#define SND_PCM_HW_PARAM_FIRST_MASK SNDRV_PCM_HW_PARAM_FIRST_MASK
370#define SND_PCM_HW_PARAM_LAST_INTERVAL SNDRV_PCM_HW_PARAM_LAST_INTERVAL
371#define SND_PCM_HW_PARAM_FIRST_INTERVAL SNDRV_PCM_HW_PARAM_FIRST_INTERVAL
372
373typedef unsigned long sndrv_pcm_uframes_t;
374typedef long sndrv_pcm_sframes_t;
375
376/** PCM sample format */
377typedef enum _snd_pcm_format {
378 /** Unknown */
379 SND_PCM_FORMAT_UNKNOWN = -1,
380 /** Signed 8 bit */
381 SND_PCM_FORMAT_S8 = 0,
382 /** Unsigned 8 bit */
383 SND_PCM_FORMAT_U8,
384 /** Signed 16 bit Little Endian */
385 SND_PCM_FORMAT_S16_LE,
386 /** Signed 16 bit Big Endian */
387 SND_PCM_FORMAT_S16_BE,
388 /** Unsigned 16 bit Little Endian */
389 SND_PCM_FORMAT_U16_LE,
390 /** Unsigned 16 bit Big Endian */
391 SND_PCM_FORMAT_U16_BE,
392 /** Signed 24 bit Little Endian */
393 SND_PCM_FORMAT_S24_LE,
394 /** Signed 24 bit Big Endian */
395 SND_PCM_FORMAT_S24_BE,
396 /** Unsigned 24 bit Little Endian */
397 SND_PCM_FORMAT_U24_LE,
398 /** Unsigned 24 bit Big Endian */
399 SND_PCM_FORMAT_U24_BE,
400 /** Signed 32 bit Little Endian */
401 SND_PCM_FORMAT_S32_LE,
402 /** Signed 32 bit Big Endian */
403 SND_PCM_FORMAT_S32_BE,
404 /** Unsigned 32 bit Little Endian */
405 SND_PCM_FORMAT_U32_LE,
406 /** Unsigned 32 bit Big Endian */
407 SND_PCM_FORMAT_U32_BE,
408 /** Float 32 bit Little Endian, Range -1.0 to 1.0 */
409 SND_PCM_FORMAT_FLOAT_LE,
410 /** Float 32 bit Big Endian, Range -1.0 to 1.0 */
411 SND_PCM_FORMAT_FLOAT_BE,
412 /** Float 64 bit Little Endian, Range -1.0 to 1.0 */
413 SND_PCM_FORMAT_FLOAT64_LE,
414 /** Float 64 bit Big Endian, Range -1.0 to 1.0 */
415 SND_PCM_FORMAT_FLOAT64_BE,
416 /** IEC-958 Little Endian */
417 SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
418 /** IEC-958 Big Endian */
419 SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
420 /** Mu-Law */
421 SND_PCM_FORMAT_MU_LAW,
422 /** A-Law */
423 SND_PCM_FORMAT_A_LAW,
424 /** Ima-ADPCM */
425 SND_PCM_FORMAT_IMA_ADPCM,
426 /** MPEG */
427 SND_PCM_FORMAT_MPEG,
428 /** GSM */
429 SND_PCM_FORMAT_GSM,
430 /** Special */
431 SND_PCM_FORMAT_SPECIAL = 31,
432 /** Signed 24bit Little Endian in 3bytes format */
433 SND_PCM_FORMAT_S24_3LE = 32,
434 /** Signed 24bit Big Endian in 3bytes format */
435 SND_PCM_FORMAT_S24_3BE,
436 /** Unsigned 24bit Little Endian in 3bytes format */
437 SND_PCM_FORMAT_U24_3LE,
438 /** Unsigned 24bit Big Endian in 3bytes format */
439 SND_PCM_FORMAT_U24_3BE,
440 /** Signed 20bit Little Endian in 3bytes format */
441 SND_PCM_FORMAT_S20_3LE,
442 /** Signed 20bit Big Endian in 3bytes format */
443 SND_PCM_FORMAT_S20_3BE,
444 /** Unsigned 20bit Little Endian in 3bytes format */
445 SND_PCM_FORMAT_U20_3LE,
446 /** Unsigned 20bit Big Endian in 3bytes format */
447 SND_PCM_FORMAT_U20_3BE,
448 /** Signed 18bit Little Endian in 3bytes format */
449 SND_PCM_FORMAT_S18_3LE,
450 /** Signed 18bit Big Endian in 3bytes format */
451 SND_PCM_FORMAT_S18_3BE,
452 /** Unsigned 18bit Little Endian in 3bytes format */
453 SND_PCM_FORMAT_U18_3LE,
454 /** Unsigned 18bit Big Endian in 3bytes format */
455 SND_PCM_FORMAT_U18_3BE,
456 SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_U18_3BE,
457
458#if __BYTE_ORDER == __LITTLE_ENDIAN
459 /** Signed 16 bit CPU endian */
460 SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_LE,
461 /** Unsigned 16 bit CPU endian */
462 SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_LE,
463 /** Signed 24 bit CPU endian */
464 SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_LE,
465 /** Unsigned 24 bit CPU endian */
466 SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_LE,
467 /** Signed 32 bit CPU endian */
468 SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_LE,
469 /** Unsigned 32 bit CPU endian */
470 SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_LE,
471 /** Float 32 bit CPU endian */
472 SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_LE,
473 /** Float 64 bit CPU endian */
474 SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_LE,
475 /** IEC-958 CPU Endian */
476 SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_LE
477#elif __BYTE_ORDER == __BIG_ENDIAN
478 /** Signed 16 bit CPU endian */
479 SND_PCM_FORMAT_S16 = SND_PCM_FORMAT_S16_BE,
480 /** Unsigned 16 bit CPU endian */
481 SND_PCM_FORMAT_U16 = SND_PCM_FORMAT_U16_BE,
482 /** Signed 24 bit CPU endian */
483 SND_PCM_FORMAT_S24 = SND_PCM_FORMAT_S24_BE,
484 /** Unsigned 24 bit CPU endian */
485 SND_PCM_FORMAT_U24 = SND_PCM_FORMAT_U24_BE,
486 /** Signed 32 bit CPU endian */
487 SND_PCM_FORMAT_S32 = SND_PCM_FORMAT_S32_BE,
488 /** Unsigned 32 bit CPU endian */
489 SND_PCM_FORMAT_U32 = SND_PCM_FORMAT_U32_BE,
490 /** Float 32 bit CPU endian */
491 SND_PCM_FORMAT_FLOAT = SND_PCM_FORMAT_FLOAT_BE,
492 /** Float 64 bit CPU endian */
493 SND_PCM_FORMAT_FLOAT64 = SND_PCM_FORMAT_FLOAT64_BE,
494 /** IEC-958 CPU Endian */
495 SND_PCM_FORMAT_IEC958_SUBFRAME = SND_PCM_FORMAT_IEC958_SUBFRAME_BE
496#else
497#error "Unknown endian"
498#endif
499} snd_pcm_format_t;
500
501/** PCM state */
502typedef enum _snd_pcm_state {
503 /** Open */
504 SND_PCM_STATE_OPEN = 0,
505 /** Setup installed */
506 SND_PCM_STATE_SETUP,
507 /** Ready to start */
508 SND_PCM_STATE_PREPARED,
509 /** Running */
510 SND_PCM_STATE_RUNNING,
511 /** Stopped: underrun (playback) or overrun (capture) detected */
512 SND_PCM_STATE_XRUN,
513 /** Draining: running (playback) or stopped (capture) */
514 SND_PCM_STATE_DRAINING,
515 /** Paused */
516 SND_PCM_STATE_PAUSED,
517 /** Hardware is suspended */
518 SND_PCM_STATE_SUSPENDED,
519 /** Hardware is disconnected */
520 SND_PCM_STATE_DISCONNECTED,
521 SND_PCM_STATE_LAST = SND_PCM_STATE_DISCONNECTED
522} snd_pcm_state_t;
523
524typedef enum sndrv_pcm_hw_param {
525 SNDRV_PCM_HW_PARAM_ACCESS = 0, /* Access type */
526 SNDRV_PCM_HW_PARAM_FIRST_MASK = SNDRV_PCM_HW_PARAM_ACCESS,
527#ifdef TARGET_OS2
528 SNDRV_PCM_HW_PARAM_RATE_MASK,
529#endif
530 SNDRV_PCM_HW_PARAM_FORMAT, /* Format */
531 SNDRV_PCM_HW_PARAM_SUBFORMAT, /* Subformat */
532 SNDRV_PCM_HW_PARAM_LAST_MASK = SNDRV_PCM_HW_PARAM_SUBFORMAT,
533
534 SNDRV_PCM_HW_PARAM_SAMPLE_BITS = 8, /* Bits per sample */
535 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL = SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
536 SNDRV_PCM_HW_PARAM_FRAME_BITS, /* Bits per frame */
537 SNDRV_PCM_HW_PARAM_CHANNELS, /* Channels */
538 SNDRV_PCM_HW_PARAM_RATE, /* Approx rate */
539 SNDRV_PCM_HW_PARAM_PERIOD_TIME, /* Approx distance between interrupts in us */
540 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, /* Approx frames between interrupts */
541 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, /* Approx bytes between interrupts */
542 SNDRV_PCM_HW_PARAM_PERIODS, /* Approx interrupts per buffer */
543 SNDRV_PCM_HW_PARAM_BUFFER_TIME, /* Approx duration of buffer in us */
544 SNDRV_PCM_HW_PARAM_BUFFER_SIZE, /* Size of buffer in frames */
545 SNDRV_PCM_HW_PARAM_BUFFER_BYTES, /* Size of buffer in bytes */
546 SNDRV_PCM_HW_PARAM_TICK_TIME, /* Approx tick duration in us */
547 SNDRV_PCM_HW_PARAM_LAST_INTERVAL = SNDRV_PCM_HW_PARAM_TICK_TIME
548} snd_pcm_hw_param_t;
549
550#define SNDRV_PCM_HW_PARAMS_RUNTIME (1<<0)
551
552struct sndrv_interval {
553 unsigned int min, max;
554 unsigned int openmin:1,
555 openmax:1,
556 integer:1,
557 empty:1;
558};
559
560#define SNDRV_MASK_MAX 256
561
562struct sndrv_mask {
563 uint32_t bits[(SNDRV_MASK_MAX+31)/32];
564};
565
566struct sndrv_pcm_hw_params {
567 unsigned int flags;
568 struct sndrv_mask masks[SNDRV_PCM_HW_PARAM_LAST_MASK -
569 SNDRV_PCM_HW_PARAM_FIRST_MASK + 1];
570 struct sndrv_mask mres[5]; /* reserved masks */
571 struct sndrv_interval intervals[SNDRV_PCM_HW_PARAM_LAST_INTERVAL -
572 SNDRV_PCM_HW_PARAM_FIRST_INTERVAL + 1];
573 struct sndrv_interval ires[9]; /* reserved intervals */
574 unsigned int rmask; /* W: requested masks */
575 unsigned int cmask; /* R: changed masks */
576 unsigned int info; /* R: Info flags for returned setup */
577 unsigned int msbits; /* R: used most significant bits */
578 unsigned int rate_num; /* R: rate numerator */
579 unsigned int rate_den; /* R: rate denominator */
580 sndrv_pcm_uframes_t fifo_size; /* R: chip FIFO size in frames */
581 unsigned char reserved[64]; /* reserved for future */
582};
583
584enum sndrv_pcm_tstamp {
585 SNDRV_PCM_TSTAMP_NONE = 0,
586 SNDRV_PCM_TSTAMP_MMAP,
587 SNDRV_PCM_TSTAMP_LAST = SNDRV_PCM_TSTAMP_MMAP,
588};
589
590struct sndrv_pcm_sw_params {
591 enum sndrv_pcm_tstamp tstamp_mode; /* timestamp mode */
592 unsigned int period_step;
593 unsigned int sleep_min; /* min ticks to sleep */
594 sndrv_pcm_uframes_t avail_min; /* min avail frames for wakeup */
595 sndrv_pcm_uframes_t xfer_align; /* xfer size need to be a multiple */
596 sndrv_pcm_uframes_t start_threshold; /* min hw_avail frames for automatic start */
597 sndrv_pcm_uframes_t stop_threshold; /* min avail frames for automatic stop */
598 sndrv_pcm_uframes_t silence_threshold; /* min distance from noise for silence filling */
599 sndrv_pcm_uframes_t silence_size; /* silence block size */
600 sndrv_pcm_uframes_t boundary; /* pointers wrap point */
601 unsigned char reserved[64]; /* reserved for future */
602};
603
604struct sndrv_pcm_status {
605 enum sndrv_pcm_state state; /* stream state */
606 struct timespec trigger_tstamp; /* time when stream was started/stopped/paused */
607 struct timespec tstamp; /* reference timestamp */
608 sndrv_pcm_uframes_t appl_ptr; /* appl ptr */
609 sndrv_pcm_uframes_t hw_ptr; /* hw ptr */
610 sndrv_pcm_sframes_t delay; /* current delay in frames */
611 sndrv_pcm_uframes_t avail; /* number of frames available */
612 sndrv_pcm_uframes_t avail_max; /* max frames available on hw since last status */
613 sndrv_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */
614 enum sndrv_pcm_state suspended_state; /* suspended stream state */
615 unsigned char reserved[60]; /* must be filled with zero */
616};
617
618enum sndrv_pcm_class {
619 SNDRV_PCM_CLASS_GENERIC = 0, /* standard mono or stereo device */
620 SNDRV_PCM_CLASS_MULTI, /* multichannel device */
621 SNDRV_PCM_CLASS_MODEM, /* software modem class */
622 SNDRV_PCM_CLASS_DIGITIZER, /* digitizer class */
623 /* Don't forget to change the following: */
624 SNDRV_PCM_CLASS_LAST = SNDRV_PCM_CLASS_DIGITIZER,
625};
626
627enum sndrv_pcm_subclass {
628 SNDRV_PCM_SUBCLASS_GENERIC_MIX = 0, /* mono or stereo subdevices are mixed together */
629 SNDRV_PCM_SUBCLASS_MULTI_MIX, /* multichannel subdevices are mixed together */
630 /* Don't forget to change the following: */
631 SNDRV_PCM_SUBCLASS_LAST = SNDRV_PCM_SUBCLASS_MULTI_MIX,
632};
633
634union sndrv_pcm_sync_id {
635 unsigned char id[16];
636 unsigned short id16[8];
637 unsigned int id32[4];
638};
639
640
641struct sndrv_pcm_info {
642 unsigned int device; /* RO/WR (control): device number */
643 unsigned int subdevice; /* RO/WR (control): subdevice number */
644 enum sndrv_pcm_stream stream; /* RO/WR (control): stream number */
645 int card; /* R: card number */
646 unsigned char id[64]; /* ID (user selectable) */
647 unsigned char name[80]; /* name of this device */
648 unsigned char subname[32]; /* subdevice name */
649 enum sndrv_pcm_class dev_class; /* SNDRV_PCM_CLASS_* */
650 enum sndrv_pcm_subclass dev_subclass; /* SNDRV_PCM_SUBCLASS_* */
651 unsigned int subdevices_count;
652 unsigned int subdevices_avail;
653 union sndrv_pcm_sync_id sync; /* hardware synchronization ID */
654 unsigned char reserved[64]; /* reserved for future... */
655};
656
657/****************************************************************************
658 * *
659 * Digital audio interface *
660 * *
661 ****************************************************************************/
662
663/* AES/IEC958 channel status bits */
664#define IEC958_AES0_PROFESSIONAL (1<<0) /* 0 = consumer, 1 = professional */
665#define IEC958_AES0_NONAUDIO (1<<1) /* 0 = audio, 1 = non-audio */
666#define IEC958_AES0_PRO_EMPHASIS (7<<2) /* mask - emphasis */
667#define IEC958_AES0_PRO_EMPHASIS_NOTID (0<<2) /* emphasis not indicated */
668#define IEC958_AES0_PRO_EMPHASIS_NONE (1<<2) /* none emphasis */
669#define IEC958_AES0_PRO_EMPHASIS_5015 (3<<2) /* 50/15us emphasis */
670#define IEC958_AES0_PRO_EMPHASIS_CCITT (7<<2) /* CCITT J.17 emphasis */
671#define IEC958_AES0_PRO_FREQ_UNLOCKED (1<<5) /* source sample frequency: 0 = locked, 1 = unlocked */
672#define IEC958_AES0_PRO_FS (3<<6) /* mask - sample frequency */
673#define IEC958_AES0_PRO_FS_NOTID (0<<6) /* fs not indicated */
674#define IEC958_AES0_PRO_FS_44100 (1<<6) /* 44.1kHz */
675#define IEC958_AES0_PRO_FS_48000 (2<<6) /* 48kHz */
676#define IEC958_AES0_PRO_FS_32000 (3<<6) /* 32kHz */
677#define IEC958_AES0_CON_NOT_COPYRIGHT (1<<2) /* 0 = copyright, 1 = not copyright */
678#define IEC958_AES0_CON_EMPHASIS (7<<3) /* mask - emphasis */
679#define IEC958_AES0_CON_EMPHASIS_NONE (0<<3) /* none emphasis */
680#define IEC958_AES0_CON_EMPHASIS_5015 (1<<3) /* 50/15us emphasis */
681#define IEC958_AES0_CON_MODE (3<<6) /* mask - mode */
682#define IEC958_AES1_PRO_MODE (15<<0) /* mask - channel mode */
683#define IEC958_AES1_PRO_MODE_NOTID (0<<0) /* not indicated */
684#define IEC958_AES1_PRO_MODE_STEREOPHONIC (2<<0) /* stereophonic - ch A is left */
685#define IEC958_AES1_PRO_MODE_SINGLE (4<<0) /* single channel */
686#define IEC958_AES1_PRO_MODE_TWO (8<<0) /* two channels */
687#define IEC958_AES1_PRO_MODE_PRIMARY (12<<0) /* primary/secondary */
688#define IEC958_AES1_PRO_MODE_BYTE3 (15<<0) /* vector to byte 3 */
689#define IEC958_AES1_PRO_USERBITS (15<<4) /* mask - user bits */
690#define IEC958_AES1_PRO_USERBITS_NOTID (0<<4) /* not indicated */
691#define IEC958_AES1_PRO_USERBITS_192 (8<<4) /* 192-bit structure */
692#define IEC958_AES1_PRO_USERBITS_UDEF (12<<4) /* user defined application */
693#define IEC958_AES1_CON_CATEGORY 0x7f
694#define IEC958_AES1_CON_GENERAL 0x00
695#define IEC958_AES1_CON_EXPERIMENTAL 0x40
696#define IEC958_AES1_CON_SOLIDMEM_MASK 0x0f
697#define IEC958_AES1_CON_SOLIDMEM_ID 0x08
698#define IEC958_AES1_CON_BROADCAST1_MASK 0x07
699#define IEC958_AES1_CON_BROADCAST1_ID 0x04
700#define IEC958_AES1_CON_DIGDIGCONV_MASK 0x07
701#define IEC958_AES1_CON_DIGDIGCONV_ID 0x02
702#define IEC958_AES1_CON_ADC_COPYRIGHT_MASK 0x1f
703#define IEC958_AES1_CON_ADC_COPYRIGHT_ID 0x06
704#define IEC958_AES1_CON_ADC_MASK 0x1f
705#define IEC958_AES1_CON_ADC_ID 0x16
706#define IEC958_AES1_CON_BROADCAST2_MASK 0x0f
707#define IEC958_AES1_CON_BROADCAST2_ID 0x0e
708#define IEC958_AES1_CON_LASEROPT_MASK 0x07
709#define IEC958_AES1_CON_LASEROPT_ID 0x01
710#define IEC958_AES1_CON_MUSICAL_MASK 0x07
711#define IEC958_AES1_CON_MUSICAL_ID 0x05
712#define IEC958_AES1_CON_MAGNETIC_MASK 0x07
713#define IEC958_AES1_CON_MAGNETIC_ID 0x03
714#define IEC958_AES1_CON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x00)
715#define IEC958_AES1_CON_NON_IEC908_CD (IEC958_AES1_CON_LASEROPT_ID|0x08)
716#define IEC958_AES1_CON_PCM_CODER (IEC958_AES1_CON_DIGDIGCONV_ID|0x00)
717#define IEC958_AES1_CON_SAMPLER (IEC958_AES1_CON_DIGDIGCONV_ID|0x20)
718#define IEC958_AES1_CON_MIXER (IEC958_AES1_CON_DIGDIGCONV_ID|0x10)
719#define IEC958_AES1_CON_RATE_CONVERTER (IEC958_AES1_CON_DIGDIGCONV_ID|0x18)
720#define IEC958_AES1_CON_SYNTHESIZER (IEC958_AES1_CON_MUSICAL_ID|0x00)
721#define IEC958_AES1_CON_MICROPHONE (IEC958_AES1_CON_MUSICAL_ID|0x08)
722#define IEC958_AES1_CON_DAT (IEC958_AES1_CON_MAGNETIC_ID|0x00)
723#define IEC958_AES1_CON_VCR (IEC958_AES1_CON_MAGNETIC_ID|0x08)
724#define IEC958_AES1_CON_ORIGINAL (1<<7) /* this bits depends on the category code */
725#define IEC958_AES2_PRO_SBITS (7<<0) /* mask - sample bits */
726#define IEC958_AES2_PRO_SBITS_20 (2<<0) /* 20-bit - coordination */
727#define IEC958_AES2_PRO_SBITS_24 (4<<0) /* 24-bit - main audio */
728#define IEC958_AES2_PRO_SBITS_UDEF (6<<0) /* user defined application */
729#define IEC958_AES2_PRO_WORDLEN (7<<3) /* mask - source word length */
730#define IEC958_AES2_PRO_WORDLEN_NOTID (0<<3) /* not indicated */
731#define IEC958_AES2_PRO_WORDLEN_22_18 (2<<3) /* 22-bit or 18-bit */
732#define IEC958_AES2_PRO_WORDLEN_23_19 (4<<3) /* 23-bit or 19-bit */
733#define IEC958_AES2_PRO_WORDLEN_24_20 (5<<3) /* 24-bit or 20-bit */
734#define IEC958_AES2_PRO_WORDLEN_20_16 (6<<3) /* 20-bit or 16-bit */
735#define IEC958_AES2_CON_SOURCE (15<<0) /* mask - source number */
736#define IEC958_AES2_CON_SOURCE_UNSPEC (0<<0) /* unspecified */
737#define IEC958_AES2_CON_CHANNEL (15<<4) /* mask - channel number */
738#define IEC958_AES2_CON_CHANNEL_UNSPEC (0<<4) /* unspecified */
739#define IEC958_AES3_CON_FS (15<<0) /* mask - sample frequency */
740#define IEC958_AES3_CON_FS_44100 (0<<0) /* 44.1kHz */
741#define IEC958_AES3_CON_FS_48000 (2<<0) /* 48kHz */
742#define IEC958_AES3_CON_FS_32000 (3<<0) /* 32kHz */
743#define IEC958_AES3_CON_CLOCK (3<<4) /* mask - clock accuracy */
744#define IEC958_AES3_CON_CLOCK_1000PPM (0<<4) /* 1000 ppm */
745#define IEC958_AES3_CON_CLOCK_50PPM (1<<4) /* 50 ppm */
746#define IEC958_AES3_CON_CLOCK_VARIABLE (2<<4) /* variable pitch */
747
748/*
749 * stupid hardware vendors !!!
750 * regarding to Dolby docs:
751 *
752 * 0 1 2 3 4 5
753 * LEFT RIGHT CENTER LFE LEFT SURR RIGHT SURR
754 *
755 * for other stupid morons we need to use conversion table
756 * actually, I wonna to talk with their drug dealers
757 *
758 */
759
760typedef struct chan_convert_table_t {
761 int src[MAX_CHANNELS];
762 int dst[MAX_CHANNELS];
763} chan_convert_table_t;
764
765typedef enum card_type_ids {
766 UNIAUD_TYPE_ID_UNKNOWN = 0,
767 UNIAUD_TYPE_ID_EMU10K1,
768 UNIAUD_TYPE_ID_AUDIGY,
769 UNIAUD_TYPE_ID_AUDIGY2,
770 UNIAUD_TYPE_ID_CMI8738,
771 UNIAUD_TYPE_ID_CMI8338,
772 UNIAUD_TYPE_ID_CMI,
773 UNIAUD_TYPE_ID_YMF724,
774 UNIAUD_TYPE_ID_YMF724F,
775 UNIAUD_TYPE_ID_YMF740,
776 UNIAUD_TYPE_ID_YMF740C,
777 UNIAUD_TYPE_ID_YMF744,
778 UNIAUD_TYPE_ID_YMF754,
779 UNIAUD_TYPE_ID_AUDIGYLS,
780 UNIAUD_TYPE_ID_FM801,
781 UNIAUD_TYPE_ID_NFORCE,
782 UNIAUD_TYPE_ID_ICH,
783 UNIAUD_TYPE_ID_ICH4,
784 UNIAUD_TYPE_ID_ICH5,
785 UNIAUD_TYPE_ID_VIA8233A,
786 UNIAUD_TYPE_ID_VIA8237,
787 UNIAUD_TYPE_ID_VIA8233
788} card_type_ids;
789
790#pragma pack ()
791
792#endif
Note: See TracBrowser for help on using the repository browser.