xref: /haiku/src/add-ons/media/plugins/au_reader/au.h (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1 /*
2  * Copyright (c) 2003-2004, Marcus Overhagen
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  *  * Redistributions of source code must retain the above copyright notice,
9  *    this list of conditions and the following disclaimer.
10  *  * Redistributions in binary form must reproduce the above copyright notice,
11  *    this list of conditions and the following disclaimer in the documentation
12  *    and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
18  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
22  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
23  * OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 #ifndef _AU_H
26 #define _AU_H
27 
28 struct snd_header {
29 	uint32 magic;			// magic number '.snd'
30 	uint32 data_start;		// offset to the data
31 	uint32 data_size;		// number of bytes of data
32 	uint32 data_format;		// data format code
33 	uint32 sampling_rate;	// sampling rate
34 	uint32 channel_count;	// number of channels
35 	char info[4];			// optional text information, NULL termintated, at least 4 bytes
36 };
37 
38 enum {
39 	SND_FORMAT_UNSPECIFIED = 0,	// unspecified format
40 	SND_FORMAT_MULAW_8 = 1,		// 8-bit mu-law samples
41 	SND_FORMAT_LINEAR_8 = 2,	// 8-bit linear samples
42 	SND_FORMAT_LINEAR_16 = 3,	// 16-bit linear samples
43 	SND_FORMAT_LINEAR_24 = 4,	// 24-bit linear samples
44 	SND_FORMAT_LINEAR_32 = 5,	// 32-bit linear samples
45 	SND_FORMAT_FLOAT = 6,		// 32-bit IEEE floating-point samples
46 	SND_FORMAT_DOUBLE = 7,		// 64-bit IEEE floating-point samples
47 	SND_FORMAT_INDIRECT = 8,	// fragmented sampled data
48 	SND_FORMAT_NESTED = 9,
49 	SND_FORMAT_DSP_CORE = 10,	// DSP program
50 	SND_FORMAT_DSP_DATA_8 = 11,	// 8-bit fixed-point samples
51 	SND_FORMAT_DSP_DATA_16 = 12,// 16-bit fixed-point samples
52 	SND_FORMAT_DSP_DATA_24 = 13,// 24-bit fixed-point samples
53 	SND_FORMAT_DSP_DATA_32 = 14,// 32-bit fixed-point samples
54 	SND_FORMAT_15 = 15,
55 	SND_FORMAT_DISPLAY = 16,	// non-audio display data
56 	SND_FORMAT_MULAW_SQUELCH = 17,
57 	SND_FORMAT_EMPHASIZED = 18,	// 16-bit linear with emphasis
58 	SND_FORMAT_COMPRESSED = 19,	// 16-bit linear with compression
59 	SND_FORMAT_COMPRESSED_EMPHASIZED = 20, // A combination of the two above
60 	SND_FORMAT_DSP_COMMANDS = 21,// Music Kit DSP commands
61 	SND_FORMAT_DSP_COMMANDS_SAMPLES = 22,
62 	SND_FORMAT_ADPCM_G721 = 23,
63 	SND_FORMAT_ADPCM_G722 = 24,
64 	SND_FORMAT_ADPCM_G723_3 = 25,
65 	SND_FORMAT_ADPCM_G723_5 = 26,
66 	SND_FORMAT_ALAW_8 = 27,
67 };
68 
69 #define SND_RATE_8012	8012.821	// CODEC input
70 #define SND_RATE_22050	22050.0		// low sampling rate output
71 #define SND_RATE_44100	44100.0		// high sampling rate output
72 
73 #define SND_MAGIC 0x2e736e64		// '.snd'
74 
75 #endif
76