NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
AXPB.h
1#ifndef RVL_SDK_AX_PB_H
2#define RVL_SDK_AX_PB_H
3#include <types.h>
4#ifdef __cplusplus
5extern "C" {
6#endif
7
8/**
9 * One frame contains eight bytes:
10 * - One for the header
11 * - Seven for the audio samples
12 */
13#define AX_ADPCM_FRAME_SIZE 8
14#define AX_ADPCM_SAMPLE_BYTES_PER_FRAME (AX_ADPCM_FRAME_SIZE - 1)
15
16// Two audio samples per byte (each nibble)
17#define AX_ADPCM_SAMPLES_PER_BYTE 2
18
19// Amount of audio samples in a frame
20#define AX_ADPCM_SAMPLES_PER_FRAME \
21 (AX_ADPCM_SAMPLE_BYTES_PER_FRAME * AX_ADPCM_SAMPLES_PER_BYTE)
22
23// Amount of nibbles in a frame
24#define AX_ADPCM_NIBBLES_PER_FRAME (AX_ADPCM_FRAME_SIZE * 2)
25
26typedef enum { AX_VOICE_NORMAL, AX_VOICE_STREAM } AXVOICETYPE;
27
28typedef enum { AX_VOICE_STOP, AX_VOICE_RUN } AXVOICESTATE;
29
30typedef enum {
31 AX_SAMPLE_FORMAT_DSP_ADPCM = 0,
32 AX_SAMPLE_FORMAT_PCM_S16 = 10,
33 AX_SAMPLE_FORMAT_PCM_S8 = 25,
34} AXSAMPLETYPE;
35
36// For rmtIIR union I think? From NW4R asserts, but fits well in __AXSyncPBs
37typedef enum {
38 AX_PB_LPF_ON = 1,
39 AX_PB_BIQUAD_ON,
40};
41
42typedef enum {
43 AX_SRC_TYPE_NONE,
44 AX_SRC_TYPE_LINEAR,
45 AX_SRC_TYPE_4TAP_8K,
46 AX_SRC_TYPE_4TAP_12K,
47 AX_SRC_TYPE_4TAP_16K,
48 AX_SRC_TYPE_4TAP_AUTO
49} AXPBSRCTYPE;
50
51typedef enum {
52 AX_MIXER_CTRL_L = (1 << 0),
53 AX_MIXER_CTRL_R = (1 << 1),
54 AX_MIXER_CTRL_DELTA = (1 << 2),
55 AX_MIXER_CTRL_S = (1 << 3),
56 AX_MIXER_CTRL_DELTA_S = (1 << 4),
57
58 AX_MIXER_CTRL_AL = (1 << 16),
59 AX_MIXER_CTRL_AR = (1 << 17),
60 AX_MIXER_CTRL_DELTA_A = (1 << 18),
61 AX_MIXER_CTRL_AS = (1 << 19),
62 AX_MIXER_CTRL_DELTA_AS = (1 << 20),
63
64 AX_MIXER_CTRL_BL = (1 << 21),
65 AX_MIXER_CTRL_BR = (1 << 22),
66 AX_MIXER_CTRL_DELTA_B = (1 << 23),
67 AX_MIXER_CTRL_BS = (1 << 24),
68 AX_MIXER_CTRL_DELTA_BS = (1 << 25),
69
70 AX_MIXER_CTRL_CL = (1 << 26),
71 AX_MIXER_CTRL_CR = (1 << 27),
72 AX_MIXER_CTRL_DELTA_C = (1 << 28),
73 AX_MIXER_CTRL_CS = (1 << 29),
74 AX_MIXER_CTRL_DELTA_CS = (1 << 30)
75};
76
77typedef enum {
78 AX_MIXER_CTRL_RMT_M0 = (1 << 0),
79 AX_MIXER_CTRL_RMT_DELTA_M0 = (1 << 1),
80 AX_MIXER_CTRL_RMT_A0 = (1 << 2),
81 AX_MIXER_CTRL_RMT_DELTA_A0 = (1 << 3),
82
83 AX_MIXER_CTRL_RMT_M1 = (1 << 4),
84 AX_MIXER_CTRL_RMT_DELTA_M1 = (1 << 5),
85 AX_MIXER_CTRL_RMT_A1 = (1 << 6),
86 AX_MIXER_CTRL_RMT_DELTA_A1 = (1 << 7),
87
88 AX_MIXER_CTRL_RMT_M2 = (1 << 8),
89 AX_MIXER_CTRL_RMT_DELTA_M2 = (1 << 9),
90 AX_MIXER_CTRL_RMT_A2 = (1 << 10),
91 AX_MIXER_CTRL_RMT_DELTA_A2 = (1 << 11),
92
93 AX_MIXER_CTRL_RMT_M3 = (1 << 12),
94 AX_MIXER_CTRL_RMT_DELTA_M3 = (1 << 13),
95 AX_MIXER_CTRL_RMT_A3 = (1 << 14),
96 AX_MIXER_CTRL_RMT_DELTA_A3 = (1 << 15)
97};
98
99typedef struct _AXPBMIX {
100 u16 vL; // at 0x0
101 u16 vDeltaL; // at 0x2
102 u16 vR; // at 0x4
103 u16 vDeltaR; // at 0x6
104 u16 vAuxAL; // at 0x8
105 u16 vDeltaAuxAL; // at 0xA
106 u16 vAuxAR; // at 0xC
107 u16 vDeltaAuxAR; // at 0xE
108 u16 vAuxBL; // at 0x10
109 u16 vDeltaAuxBL; // at 0x12
110 u16 vAuxBR; // at 0x14
111 u16 vDeltaAuxBR; // at 0x16
112 u16 vAuxCL; // at 0x18
113 u16 vDeltaAuxCL; // at 0x1A
114 u16 vAuxCR; // at 0x1C
115 u16 vDeltaAuxCR; // at 0x1E
116 u16 vS; // at 0x20
117 u16 vDeltaS; // at 0x22
118 u16 vAuxAS; // at 0x24
119 u16 vDeltaAuxAS; // at 0x26
120 u16 vAuxBS; // at 0x28
121 u16 vDeltaAuxBS; // at 0x2A
122 u16 vAuxCS; // at 0x2C
123 u16 vDeltaAuxCS; // at 0x2E
124} AXPBMIX;
125
126typedef struct _AXPBITD {
127 u16 flag; // at 0x0
128 u16 bufferHi; // at 0x2
129 u16 bufferLo; // at 0x4
130 u16 shiftL; // at 0x6
131 u16 shiftR; // at 0x8
132 u16 targetShiftL; // at 0xA
133 u16 targetShiftR; // at 0xC
134} AXPBITD;
135
136typedef struct _AXPBDPOP {
137 s16 aL; // at 0x0
138 s16 aAuxAL; // at 0x2
139 s16 aAuxBL; // at 0x4
140 s16 aAuxCL; // at 0x6
141 s16 aR; // at 0x8
142 s16 aAuxAR; // at 0xA
143 s16 aAuxBR; // at 0xC
144 s16 aAuxCR; // at 0xE
145 s16 aS; // at 0x10
146 s16 aAuxAS; // at 0x12
147 s16 aAuxBS; // at 0x14
148 s16 aAuxCS; // at 0x16
149} AXPBDPOP;
150
151typedef struct _AXPBVE {
152 u16 currentVolume; // at 0x0
153 s16 currentDelta; // at 0x2
154} AXPBVE;
155
156typedef struct _AXPBADDR {
157 u16 loopFlag; // at 0x0
158 u16 format; // at 0x2
159 u16 loopAddressHi; // at 0x4
160 u16 loopAddressLo; // at 0x6
161 u16 endAddressHi; // at 0x8
162 u16 endAddressLo; // at 0xA
163 u16 currentAddressHi; // at 0xC
164 u16 currentAddressLo; // at 0xE
165} AXPBADDR;
166
167typedef struct _AXPBADPCM {
168 u16 a[8][2]; // at 0x0
169 u16 gain; // at 0x20
170 u16 pred_scale; // at 0x22
171 u16 yn1; // at 0x24
172 u16 yn2; // at 0x26
173} AXPBADPCM;
174
175typedef struct _AXPBSRC {
176 u16 ratioHi; // at 0x0
177 u16 ratioLo; // at 0x2
178 u16 currentAddressFrac; // at 0x4
179 u16 last_samples[4]; // at 0x6
180} AXPBSRC;
181
182typedef struct _AXPBADPCMLOOP {
183 u16 loop_pred_scale; // at 0x0
184 u16 loop_yn1; // at 0x2
185 u16 loop_yn2; // at 0x4
186} AXPBADPCMLOOP;
187
188typedef struct _AXPBLPF {
189 u16 on; // at 0x0
190 u16 yn1; // at 0x2
191 u16 a0; // at 0x4
192 u16 b0; // at 0x6
193} AXPBLPF;
194
195typedef struct _AXPBBIQUAD {
196 u16 on; // at 0x0
197 u16 xn1; // at 0x2
198 u16 xn2; // at 0x4
199 u16 yn1; // at 0x6
200 u16 yn2; // at 0x8
201 u16 b0; // at 0xA
202 u16 b1; // at 0xC
203 u16 b2; // at 0xE
204 u16 a1; // at 0x10
205 u16 a2; // at 0x12
206} AXPBBIQUAD;
207
208typedef struct _AXPBRMTMIX {
209 u16 vMain0; // at 0x0
210 u16 vDeltaMain0; // at 0x2
211 u16 vAux0; // at 0x4
212 u16 vDeltaAux0; // at 0x6
213 u16 vMain1; // at 0x8
214 u16 vDeltaMain1; // at 0xA
215 u16 vAux1; // at 0xC
216 u16 vDeltaAux1; // at 0xE
217 u16 vMain2; // at 0x10
218 u16 vDeltaMain2; // at 0x12
219 u16 vAux2; // at 0x14
220 u16 vDeltaAux2; // at 0x16
221 u16 vMain3; // at 0x18
222 u16 vDeltaMain3; // at 0x1A
223 u16 vAux3; // at 0x1C
224 u16 vDeltaAux3; // at 0x1E
225} AXPBRMTMIX;
226
227typedef struct _AXPBRMTDPOP {
228 s16 aMain0; // at 0x0
229 s16 aMain1; // at 0x2
230 s16 aMain2; // at 0x4
231 s16 aMain3; // at 0x6
232 s16 aAux0; // at 0x8
233 s16 aAux1; // at 0xA
234 s16 aAux2; // at 0xC
235 s16 aAux3; // at 0xE
236} AXPBRMTDPOP;
237
238typedef struct _AXPBRMTSRC {
239 u16 currentAddressFrac; // at 0x0
240 u16 last_samples[4]; // at 0x2
241} AXPBRMTSRC;
242
243typedef union __AXPBRMTIIR {
244 AXPBLPF lpf;
245 AXPBBIQUAD biquad;
246} AXPBRMTIIR;
247
248typedef struct _AXPB {
249 u16 nextHi; // at 0x0
250 u16 nextLo; // at 0x2
251 u16 currHi; // at 0x4
252 u16 currLo; // at 0x6
253 u16 srcSelect; // at 0x8
254 u16 coefSelect; // at 0xA
255 u32 mixerCtrl; // at 0xC
256 u16 state; // at 0x10
257 u16 type; // at 0x12
258 AXPBMIX mix; // at 0x14
259 AXPBITD itd; // at 0x44
260 AXPBDPOP dpop; // at 0x52
261 AXPBVE ve; // at 0x6A
262 AXPBADDR addr; // at 0x6E
263 AXPBADPCM adpcm; // at 0x7E
264 AXPBSRC src; // at 0xA6
265 AXPBADPCMLOOP adpcmLoop; // at 0xB4
266 AXPBLPF lpf; // at 0xBA
267 AXPBBIQUAD biquad; // at 0xC2
268 u16 remote; // at 0xD6
269 u16 rmtMixerCtrl; // at 0xD8
270 AXPBRMTMIX rmtMix; // at 0xDA
271 AXPBRMTDPOP rmtDpop; // at 0xFA
272 AXPBRMTSRC rmtSrc; // at 0x10A
273 AXPBRMTIIR rmtIIR; // at 0x114
274 u8 padding[0x140 - 0x128]; // at 0x128
275} AXPB;
276
277#ifdef __cplusplus
278}
279#endif
280#endif
Definition AXPB.h:248