Skylicht Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
Decoder
WavHeader.h
1
#ifndef _WAVEHEADER_
2
#define _WAVEHEADER_
3
4
namespace
Skylicht
5
{
6
namespace
Audio
7
{
8
enum
ECompressionCode
9
{
10
CompressUnknown = 0x0000,
11
CompressPCM = 0x0001,
12
CompressMSADPCM = 0x0002,
13
CompressITUG_711_A_LAW = 0x0006,
14
CompressITUG_711_AMU_LAW = 0x0007,
15
CompressIMAADPCM = 0x0011,
16
CompressITUG_723_ADPCM = 0x0016,
17
CompressGSM_6_10 = 0x0031,
18
CompressITUG_721_ADPCM = 0x0040,
19
CompressMPEG = 0x0050
20
};
21
22
enum
EChunkSize
23
{
24
ChunkHeaderSize = 8,
25
RiffChunkSize = 12,
26
FmtChunkSize = 24,
27
FactChunkSize = 12
28
};
29
30
struct
SRiffHeader
31
{
32
char
ChunkId[4];
// "RIFF"
33
unsigned
int
Filesize;
// total file size -8 bytes for this header
34
char
RiffType[4];
// usually "WAVE"
35
};
36
37
struct
SFormatHeader
38
{
39
char
ChunkId[4];
// "fmt "
40
unsigned
int
ChunkDataSize;
// size of this header: 16 + extra format bytes
41
unsigned
short
CompressionCode;
// 0x0001 = PCM, 0x0011 = IMA ADPCM
42
unsigned
short
NumChannels;
43
unsigned
int
SampleRate;
44
unsigned
int
AvgBytesPerSample;
45
unsigned
short
BlockAlign;
46
unsigned
short
SignificantBitsPerSample;
47
};
48
49
struct
SFactHeader
50
{
51
char
ChunkId[4];
// "fact"
52
unsigned
int
ChunkDataSize;
// for IMA ADPCM this is the # of samples
53
unsigned
int
FactData;
54
};
55
56
struct
SDataHeader
57
{
58
char
ChunkId[4];
// "data"
59
unsigned
int
ChunkSize;
// data size including any padding
60
};
61
62
struct
SChunkHeader
63
{
64
char
ChunkId[4];
65
unsigned
int
ChunkSize;
66
};
67
68
struct
SDataNode
69
{
70
SDataNode():
71
FileOffset(0),
72
ByteSize(0),
73
Next(0)
74
{
75
76
}
77
78
SDataNode(
int
fileOffset,
int
byteSize):
79
FileOffset(fileOffset),
80
ByteSize(byteSize),
81
Next(0)
82
{
83
}
84
85
int
FileOffset;
86
int
ByteSize;
87
SDataNode* Next;
88
89
void
AddNode(
int
fileOffset,
int
byteSize)
90
{
91
if
(Next)
92
Next->AddNode( fileOffset, byteSize);
93
else
94
Next =
new
SDataNode(fileOffset, byteSize);
95
}
96
97
void
DropNodes()
98
{
99
if
(Next)
100
{
101
Next->DropNodes();
102
delete
Next;
103
}
104
Next = NULL;
105
}
106
};
107
108
struct
SWaveChunk
109
{
110
SWaveChunk():
111
DataNodes(0)
112
{
113
}
114
115
~SWaveChunk()
116
{
117
if
(DataNodes)
118
{
119
DataNodes->DropNodes();
120
delete
DataNodes;
121
}
122
DataNodes = NULL;
123
}
124
125
SRiffHeader
RiffHeader;
126
SFormatHeader
FormatHeader;
127
SDataHeader
DataHeader;
128
SFactHeader
FactHeader;
129
SDataNode
* DataNodes;
130
};
131
}
132
}
133
134
#endif
Skylicht::Audio
Handles all core audio functionality.
Definition
AudioDebugLog.h:31
Skylicht
Everything in the Skylicht Engine. You can start by looking at the topics.
Definition
AudioDebugLog.h:29
Skylicht::Audio::SChunkHeader
Definition
WavHeader.h:63
Skylicht::Audio::SDataHeader
Definition
WavHeader.h:57
Skylicht::Audio::SDataNode
Definition
WavHeader.h:69
Skylicht::Audio::SFactHeader
Definition
WavHeader.h:50
Skylicht::Audio::SFormatHeader
Definition
WavHeader.h:38
Skylicht::Audio::SRiffHeader
Definition
WavHeader.h:31
Generated by
1.17.0