1 //       _________ __                 __
2 //      /   _____//  |_____________ _/  |______     ____  __ __  ______
3 //      \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
4 //      /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ |
5 //     /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
6 //             \/                  \/          \//_____/            \/
7 //  ______________________                           ______________________
8 //                        T H E   W A R   B E G I N S
9 //         Stratagus - A free fantasy real time strategy game engine
10 //
11 /**@name wav.h - The wav file format header file. */
12 //
13 //      (c) Copyright 1998-2001 by Lutz Sammer
14 //
15 //      This program is free software; you can redistribute it and/or modify
16 //      it under the terms of the GNU General Public License as published by
17 //      the Free Software Foundation; only version 2 of the License.
18 //
19 //      This program is distributed in the hope that it will be useful,
20 //      but WITHOUT ANY WARRANTY; without even the implied warranty of
21 //      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 //      GNU General Public License for more details.
23 //
24 //      You should have received a copy of the GNU General Public License
25 //      along with this program; if not, write to the Free Software
26 //      Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 //      02111-1307, USA.
28 //
29 
30 #ifndef __WAV_H__
31 #define __WAV_H__
32 
33 //@{
34 
35 /*----------------------------------------------------------------------------
36 --  Wav
37 ----------------------------------------------------------------------------*/
38 
39 //
40 //  Define values for WAV format
41 //
42 
43 #define RIFF 0x46464952 /// "RIFF" chunk names.
44 #define WAVE 0x45564157 /// "WAVE" chunk names.
45 #define FMT  0x20746D66 /// "fmt " chunk names.
46 #define DATA 0x61746164 /// "data" chunk names.
47 
48 /*
49 **  Wav types
50 */
51 #define WAV_UNKNOWN 0
52 #define WAV_PCM_CODE 1
53 #define WAV_ADPCM 2
54 #define WAV_ALAW 6
55 #define WAV_MULAW 7
56 #define WAV_OKI_ADPCM 16
57 #define WAV_DIGISTD 21
58 #define WAV_DIGIFIX 22
59 
60 #define IBM_MULAW 0x0101
61 #define IBM_ALAW 0x0102
62 #define IBM_ADPCM 0x0103
63 
64 #define WAV_MONO 1
65 #define WAV_STEREO 2
66 
67 /**
68 **  General chunk found in the WAV file
69 */
70 struct WavHeader {
71 	unsigned int MagicRiff;
72 	unsigned int Length;
73 	unsigned int MagicWave;
74 };
75 
76 /**
77 **  Wav format
78 */
79 struct WavFMT {
80 	unsigned short Encoding;       /// 1 = PCM
81 	unsigned short Channels;       /// 1 = mono, 2 = stereo
82 	unsigned int   Frequency;      /// One of 11025, 22050, or 44100 Hz
83 	unsigned int   ByteRate;       /// Average bytes per second
84 	unsigned short SampleSize;     /// Bytes per sample block
85 	unsigned short BitsPerSample;  /// One of 8, 12, 16
86 };
87 
88 /**
89 **  General chunk found in the WAV file
90 */
91 struct WavChunk {
92 	unsigned int Magic;
93 	unsigned int Length;
94 };
95 //@}
96 
97 #endif // !__WAV_H__
98