Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
syn.h
Go to the documentation of this file.
1#ifndef RVL_SDK_HBMSYN_H
2#define RVL_SDK_HBMSYN_H
3
4#include <revolution/types.h>
5
6#define HBMSYN_NUM_MIDI_CHANNELS 16
7#define HBMSYN_NUM_MIDI_NOTES 128
8
9// Modifiable; to what extent is unknown
10#define HBMSYN_INPUT_BUFFER_SIZE 256
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16// context declarations
17typedef struct HBMSYNVOICE HBMSYNVOICE; // see synprivate.h
18
19// forward declarations
20typedef struct HBMSYNSYNTH HBMSYNSYNTH;
21
22typedef struct WTADPCM {
23 u16 a[8][2]; // size 0x10, offset 0x00
24 u16 gain; // size 0x02, offset 0x20
25 u16 pred_scale; // size 0x02, offset 0x22
26 u16 yn1; // size 0x02, offset 0x24
27 u16 yn2; // size 0x02, offset 0x26
28 u16 loop_pred_scale; // size 0x02, offset 0x28
29 u16 loop_yn1; // size 0x02, offset 0x2a
30 u16 loop_yn2; // size 0x02, offset 0x2c
31} WTADPCM; // size 0x2e
32
33typedef struct WTART {
34 s32 lfoFreq; // size 0x04, offset 0x00
35 s32 lfoDelay; // size 0x04, offset 0x04
36 s32 lfoAtten; // size 0x04, offset 0x08
37 s32 lfoPitch; // size 0x04, offset 0x0c
38 s32 lfoMod2Atten; // size 0x04, offset 0x10
39 s32 lfoMod2Pitch; // size 0x04, offset 0x14
40 s32 eg1Attack; // size 0x04, offset 0x18
41 s32 eg1Decay; // size 0x04, offset 0x1c
42 s32 eg1Sustain; // size 0x04, offset 0x20
43 s32 eg1Release; // size 0x04, offset 0x24
44 s32 eg1Vel2Attack; // size 0x04, offset 0x28
45 s32 eg1Key2Decay; // size 0x04, offset 0x2c
46 s32 eg2Attack; // size 0x04, offset 0x30
47 s32 eg2Decay; // size 0x04, offset 0x34
48 s32 eg2Sustain; // size 0x04, offset 0x38
49 s32 eg2Release; // size 0x04, offset 0x3c
50 s32 eg2Vel2Attack; // size 0x04, offset 0x40
51 s32 eg2Key2Decay; // size 0x04, offset 0x44
52 s32 eg2Pitch; // size 0x04, offset 0x48
53 s32 pan; // size 0x04, offset 0x4c
54} WTART; // size 0x50
55
56typedef struct WTINST {
57 u16 keyRegion[HBMSYN_NUM_MIDI_NOTES];
58} WTINST; // size 0x100
59
60typedef struct WTREGION {
61 u8 unityNote; // size 0x01, offset 0x00
62 u8 keyGroup; // size 0x01, offset 0x01
63 s16 fineTune; // size 0x02, offset 0x02
64 s32 attn; // size 0x04, offset 0x04
65 u32 loopStart; // size 0x04, offset 0x08
66 u32 loopLength; // size 0x04, offset 0x0c
67 u32 articulationIndex; // size 0x04, offset 0x10
68 u32 sampleIndex; // size 0x04, offset 0x14
69} WTREGION; // size 0x18
70
71typedef struct WTSAMPLE {
72 u16 format; // size 0x02, offset 0x00
73 u16 sampleRate; // size 0x02, offset 0x02
74 u32 offset; // size 0x04, offset 0x04
75 u32 length; // size 0x04, offset 0x08
76 u16 adpcmIndex; // size 0x02, offset 0x0c
77 /* 2 bytes padding */
78} WTSAMPLE; // size 0x10
79
81 HBMSYNSYNTH* next; // size 0x0004, offset 0x0000
82 WTINST* percussiveInst; // size 0x0004, offset 0x0004
83 WTINST* melodicInst; // size 0x0004, offset 0x0008
84 WTREGION* region; // size 0x0004, offset 0x000c
85 WTART* art; // size 0x0004, offset 0x0010
86 WTSAMPLE* sample; // size 0x0004, offset 0x0014
87 WTADPCM* adpcm; // size 0x0004, offset 0x0018
88 u32 samplesBaseWord; // size 0x0004, offset 0x001c
89 u32 samplesBaseByte; // size 0x0004, offset 0x0020
90 u32 samplesBaseNibble; // size 0x0004, offset 0x0024
91 WTINST* inst[HBMSYN_NUM_MIDI_CHANNELS]; // size 0x0040, offset 0x0028
92 s32 masterVolume; // size 0x0004, offset 0x0068
93 s32 volAttn[HBMSYN_NUM_MIDI_CHANNELS]; // size 0x0040, offset 0x006c
94 s32 auxAAttn[HBMSYN_NUM_MIDI_CHANNELS]; // size 0x0040, offset 0x00ac
95 u8 pan[HBMSYN_NUM_MIDI_CHANNELS]; // size 0x0010, offset 0x00ec
96 u8 input[HBMSYN_INPUT_BUFFER_SIZE][3]; // size 0x0300, offset 0x00fc
97 u8* inputPosition; // size 0x0004, offset 0x03fc
98 u32 inputCounter; // size 0x0004, offset 0x0400
99 u32 notes; // size 0x0004, offset 0x0404
100 HBMSYNVOICE* voice[HBMSYN_NUM_MIDI_CHANNELS]
101 [HBMSYN_NUM_MIDI_NOTES]; // size 0x2000, offset 0x0408
102}; // size 0x2408
103
104void HBMSYNInit(void);
105void HBMSYNQuit(void);
106
107void HBMSYNRunAudioFrame(void);
108
109void HBMSYNInitSynth(HBMSYNSYNTH* synth, u8* wavetable, u8* samples, u8* zerobuffer);
110void HBMSYNQuitSynth(HBMSYNSYNTH* synth);
111
112void HBMSYNMidiInput(HBMSYNSYNTH* synth, u8* input);
113
114void HBMSYNSetMasterVolume(HBMSYNSYNTH* synth, s32 dB);
116
117#ifdef __cplusplus
118}
119#endif
120
121#endif // RVL_SDK_HBMSYN_H
struct WTART WTART
struct WTREGION WTREGION
struct WTINST WTINST
unsigned long u32
Definition types.h:12
signed short int s16
Definition types.h:9
unsigned short int u16
Definition types.h:10
signed long s32
Definition types.h:11
unsigned char u8
Definition types.h:8
struct WTSAMPLE WTSAMPLE
void HBMSYNQuit(void)
Definition syn.cpp:102
void HBMSYNInitSynth(HBMSYNSYNTH *synth, u8 *wavetable, u8 *samples, u8 *zerobuffer)
void HBMSYNQuitSynth(HBMSYNSYNTH *synth)
Definition syn.cpp:165
struct WTADPCM WTADPCM
void HBMSYNSetMasterVolume(HBMSYNSYNTH *synth, s32 dB)
Definition syn.cpp:212
s32 HBMSYNGetMasterVolume(HBMSYNSYNTH *synth)
Definition syn.cpp:219
void HBMSYNMidiInput(HBMSYNSYNTH *synth, u8 *input)
Definition syn.cpp:191
void HBMSYNRunAudioFrame(void)
Definition syn.cpp:108
void HBMSYNInit(void)
Definition syn.cpp:84
Definition syn.h:80
u32 notes
Definition syn.h:99
u32 samplesBaseWord
Definition syn.h:88
WTINST * inst[HBMSYN_NUM_MIDI_CHANNELS]
Definition syn.h:91
WTSAMPLE * sample
Definition syn.h:86
WTREGION * region
Definition syn.h:84
s32 volAttn[HBMSYN_NUM_MIDI_CHANNELS]
Definition syn.h:93
u8 * inputPosition
Definition syn.h:97
u32 samplesBaseNibble
Definition syn.h:90
u8 pan[HBMSYN_NUM_MIDI_CHANNELS]
Definition syn.h:95
s32 auxAAttn[HBMSYN_NUM_MIDI_CHANNELS]
Definition syn.h:94
WTADPCM * adpcm
Definition syn.h:87
u32 inputCounter
Definition syn.h:98
s32 masterVolume
Definition syn.h:92
HBMSYNSYNTH * next
Definition syn.h:81
HBMSYNVOICE * voice[HBMSYN_NUM_MIDI_CHANNELS][HBMSYN_NUM_MIDI_NOTES]
Definition syn.h:101
WTART * art
Definition syn.h:85
u8 input[HBMSYN_INPUT_BUFFER_SIZE][3]
Definition syn.h:96
WTINST * melodicInst
Definition syn.h:83
u32 samplesBaseByte
Definition syn.h:89
WTINST * percussiveInst
Definition syn.h:82
Definition synprivate.h:31
Definition syn.h:22
u16 yn2
Definition syn.h:27
u16 pred_scale
Definition syn.h:25
u16 loop_yn1
Definition syn.h:29
u16 yn1
Definition syn.h:26
u16 a[8][2]
Definition syn.h:23
u16 loop_pred_scale
Definition syn.h:28
u16 gain
Definition syn.h:24
u16 loop_yn2
Definition syn.h:30
Definition syn.h:33
s32 lfoMod2Pitch
Definition syn.h:39
s32 eg1Release
Definition syn.h:43
s32 eg2Decay
Definition syn.h:47
s32 lfoAtten
Definition syn.h:36
s32 eg1Vel2Attack
Definition syn.h:44
s32 lfoDelay
Definition syn.h:35
s32 eg2Release
Definition syn.h:49
s32 eg2Pitch
Definition syn.h:52
s32 pan
Definition syn.h:53
s32 eg1Sustain
Definition syn.h:42
s32 lfoMod2Atten
Definition syn.h:38
s32 eg2Vel2Attack
Definition syn.h:50
s32 eg2Sustain
Definition syn.h:48
s32 eg2Attack
Definition syn.h:46
s32 lfoPitch
Definition syn.h:37
s32 eg1Decay
Definition syn.h:41
s32 lfoFreq
Definition syn.h:34
s32 eg1Key2Decay
Definition syn.h:45
s32 eg2Key2Decay
Definition syn.h:51
s32 eg1Attack
Definition syn.h:40
Definition syn.h:56
u16 keyRegion[HBMSYN_NUM_MIDI_NOTES]
Definition syn.h:57
Definition syn.h:60
s16 fineTune
Definition syn.h:63
u32 sampleIndex
Definition syn.h:68
u8 keyGroup
Definition syn.h:62
s32 attn
Definition syn.h:64
u32 loopStart
Definition syn.h:65
u32 loopLength
Definition syn.h:66
u32 articulationIndex
Definition syn.h:67
u8 unityNote
Definition syn.h:61
Definition syn.h:71
u16 sampleRate
Definition syn.h:73
u32 length
Definition syn.h:75
u16 format
Definition syn.h:72
u16 adpcmIndex
Definition syn.h:76
u32 offset
Definition syn.h:74