NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_WaveFile.h
1
#ifndef NW4R_SND_WAVE_FILE_H
2
#define NW4R_SND_WAVE_FILE_H
3
4
/*******************************************************************************
5
* headers
6
*/
7
8
#include <types.h>
9
10
#include "nw4r/snd/snd_Channel.h"
11
#include "nw4r/snd/snd_global.h"
// SampleFormat
12
#include "nw4r/snd/snd_adpcm.h"
13
#include "nw4r/types_nw4r.h"
14
15
#include "nw4r/ut/ut_binaryFileFormat.h"
16
17
/*******************************************************************************
18
* types
19
*/
20
21
namespace
nw4r {
namespace
snd {
namespace
detail
22
{
23
struct
WaveFile
24
{
25
/* Header */
26
27
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2ab1
28
struct
FileHeader
29
{
30
ut::BinaryFileHeader
fileHeader;
// size 0x10, offset 0x00
31
ulong infoChunkOffset;
// size 0x04, offset 0x10
32
ulong infoChunkSize;
// size 0x04, offset 0x14
33
ulong dataChunkOffset;
// size 0x04, offset 0x18
34
ulong dataChunkSize;
// size 0x04, offset 0x1c
35
};
// size 0x20
36
37
/* InfoBlock */
38
39
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2185
40
struct
WaveInfo
41
{
42
u8 format;
// size 0x01, offset 0x00
43
u8 loopFlag;
// size 0x01, offset 0x01
44
u8 numChannels;
// size 0x01, offset 0x02
45
u8 sampleRate24;
// size 0x01, offset 0x03
46
u16 sampleRate;
// size 0x02, offset 0x04
47
u8 dataLocationType;
// size 0x01, offset 0x06
48
u8 padding;
49
ulong loopStart;
// size 0x04, offset 0x08
50
ulong loopEnd;
// size 0x04, offset 0x0c
51
ulong channelInfoTableOffset;
// size 0x04, offset 0x10
52
ulong dataLocation;
// size 0x04, offset 0x14
53
ulong reserved;
54
};
// size 0x1c
55
56
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2c9d
57
struct
WaveChannelInfo
58
{
59
ulong channelDataOffset;
// size 0x04, offset 0x00
60
ulong adpcmOffset;
// size 0x04, offset 0x04
61
ulong volumeFrontLeft;
// size 0x04, offset 0x08
62
ulong volumeFrontRight;
// size 0x04, offset 0x0c
63
ulong volumeRearLeft;
// size 0x04, offset 0x10
64
ulong volumeRearRight;
// size 0x04, offset 0x14
65
ulong reserved;
66
};
// size 0x1c
67
68
static
ulong
const
SIGNATURE_INFO_BLOCK =
69
NW4R_FOUR_BYTE(
'I'
,
'N'
,
'F'
,
'O'
);
70
71
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x3087c5
72
struct
InfoBlock
73
{
74
ut::BinaryBlockHeader
blockHeader;
// size 0x08, offset 0x00
75
WaveInfo
waveInfo;
// size 0x1c, offset 0x08
76
};
// size 0x24
77
78
/* Other */
79
80
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x308a10
81
struct
AdpcmParamSet
82
{
83
AdpcmParam
adpcmParam;
// size 0x28, offset 0x00
84
AdpcmLoopParam
adpcmLoopParam;
// size 0x06, offset 0x28
85
};
// size 0x2e
86
87
/* WaveFile */
88
89
static
ulong
const
SIGNATURE_FILE =
90
NW4R_FOUR_BYTE(
'R'
,
'W'
,
'A'
,
'V'
);
91
static
int
const
FILE_VERSION;
// does it even have one?
92
};
// "namespace" WaveFile
93
94
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x29336
95
struct
ChannelParam
96
{
97
void
*dataAddr;
// size 0x04, offset 0x00
98
AdpcmParam
adpcmParam;
// size 0x28, offset 0x04
99
AdpcmLoopParam
adpcmLoopParam;
// size 0x06, offset 0x2c
100
/* 2 bytes padding */
101
};
// size 0x34
102
103
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x29401
104
struct
WaveInfo
105
{
106
SampleFormat sampleFormat;
// size 0x04, offset 0x00
107
bool
loopFlag;
// size 0x01, offset 0x04
108
/* 3 bytes padding */
109
int
numChannels;
// size 0x04, offset 0x08
110
int
sampleRate;
// size 0x04, offset 0x0c
111
ulong loopStart;
// size 0x04, offset 0x10
112
ulong loopEnd;
// size 0x04, offset 0x14
113
ChannelParam
channelParam[Channel::CHANNEL_MAX];
// size 0x68, offset 0x18
114
};
// size 0x80
115
116
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2e58c
117
struct
WaveSoundInfo
118
{
119
f32 pitch;
// size 0x04, offset 0x00
120
u8 pan;
// size 0x01, offset 0x04
121
u8 surroundPan;
// size 0x01, offset 0x05
122
u8 fxSendA;
// size 0x01, offset 0x06
123
u8 fxSendB;
// size 0x01, offset 0x07
124
u8 fxSendC;
// size 0x01, offset 0x08
125
u8 mainSend;
// size 0x01, offset 0x09
126
/* 2 bytes padding */
127
};
// size 0x0c
128
129
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2e6c2
130
struct
WaveSoundNoteInfo
131
{
132
s32 waveIndex;
// size 0x04, offset 0x00
133
u8 attack;
// size 0x01, offset 0x04
134
u8 hold;
// size 0x01, offset 0x05
135
u8 decay;
// size 0x01, offset 0x06
136
u8 sustain;
// size 0x01, offset 0x07
137
u8 release;
// size 0x01, offset 0x08
138
u8 originalKey;
// size 0x01, offset 0x09
139
u8 pan;
// size 0x01, offset 0x0a
140
u8 surroundPan;
// size 0x01, offset 0x0b
141
u8 volume;
// size 0x01, offset 0x0c
142
/* 3 bytes padding */
143
f32 pitch;
// size 0x04, offset 0x10
144
};
// size 0x14
145
}}}
// namespace nw4r::snd::detail
146
147
/*******************************************************************************
148
* classes and functions
149
*/
150
151
namespace
nw4r {
namespace
snd {
namespace
detail
152
{
153
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2b2e05
154
class
WaveFileReader
155
{
156
// methods
157
public
:
158
// cdtors
159
WaveFileReader(
WaveFile::FileHeader
const
*waveFileHeader);
160
WaveFileReader(
WaveFile::WaveInfo
const
*waveInfo);
161
162
// methods
163
bool
ReadWaveInfo(
WaveInfo
*waveData)
const
164
{
165
return
ReadWaveInfo(waveData,
nullptr
);
166
}
167
168
bool
ReadWaveInfo(
WaveInfo
*waveData,
169
void
const
*waveDataOffsetOrigin)
const
;
170
171
void
const
*GetWaveDataAddress(
172
WaveFile::WaveChannelInfo
const
*waveChannelInfo,
173
void
const
*waveDataOffsetOrigin)
const
;
174
175
static
SampleFormat GetSampleFormatFromWaveFileFormat(u8 format);
176
177
// members
178
private
:
179
WaveFile::WaveInfo
const
*mWaveInfo;
// size 0x04, offset 0x00
180
};
// size 0x04
181
182
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2954b
183
class
WaveDataLocationCallback
184
{
185
// methods
186
public
:
187
// virtual function ordering
188
// vtable WaveDataLocationCallback
189
virtual
WaveInfo
*at_0x08();
190
virtual
void
at_0x0c(
WaveInfo
const
*);
191
192
// members
193
private
:
194
/* vtable */
// size 0x04, offset 0x00
195
};
// size 0x04
196
}}}
// namespace nw4r::snd::detail
197
198
#endif
// NW4R_SND_WAVE_FILE_H
nw4r::snd::detail::WaveDataLocationCallback
Definition
snd_WaveFile.h:184
nw4r::snd::AdpcmParam
Definition
snd_adpcm.h:22
nw4r::snd::detail::AdpcmLoopParam
Definition
snd_adpcm.h:33
nw4r::snd::detail::ChannelParam
Definition
snd_WaveFile.h:96
nw4r::snd::detail::WaveFile::AdpcmParamSet
Definition
snd_WaveFile.h:82
nw4r::snd::detail::WaveFile::FileHeader
Definition
snd_WaveFile.h:29
nw4r::snd::detail::WaveFile::InfoBlock
Definition
snd_WaveFile.h:73
nw4r::snd::detail::WaveFile::WaveChannelInfo
Definition
snd_WaveFile.h:58
nw4r::snd::detail::WaveFile::WaveInfo
Definition
snd_WaveFile.h:41
nw4r::snd::detail::WaveFile
Definition
snd_WaveFile.h:24
nw4r::snd::detail::WaveInfo
Definition
snd_WaveFile.h:105
nw4r::snd::detail::WaveSoundInfo
Definition
snd_WaveFile.h:118
nw4r::snd::detail::WaveSoundNoteInfo
Definition
snd_WaveFile.h:131
nw4r::ut::BinaryBlockHeader
Definition
ut_binaryFileFormat.h:8
nw4r::ut::BinaryFileHeader
Definition
ut_binaryFileFormat.h:13
include
lib
nw4r
snd
snd_WaveFile.h
Made with ❤️ by
CLF78
and
RootCubed
. Logos by
Chasical
and
B1
. Website generated by
Doxygen
1.13.2