SSBM Decomp
Loading...
Searching...
No Matches
syn.h
Go to the documentation of this file.
1#ifndef _DOLPHIN_SYN_H_
2#define _DOLPHIN_SYN_H_
3
4#include <dolphin/ax.h>
5
6#define SYN_INPUT_BUFFER_SIZE 0x100
7
8struct WTINST {
9 /* 0x00 */ u16 keyRegion[128];
10};
11
12struct WTREGION {
13 /* 0x00 */ u8 unityNote;
14 /* 0x01 */ u8 keyGroup;
15 /* 0x02 */ s16 fineTune;
16 /* 0x04 */ long attn;
17 /* 0x08 */ u32 loopStart;
18 /* 0x0C */ u32 loopLength;
20 /* 0x14 */ u32 sampleIndex;
21};
22
23struct WTART {
24 /* 0x00 */ long lfoFreq;
25 /* 0x04 */ long lfoDelay;
26 /* 0x08 */ long lfoAtten;
27 /* 0x0C */ long lfoPitch;
28 /* 0x10 */ long lfoMod2Atten;
29 /* 0x14 */ long lfoMod2Pitch;
30 /* 0x18 */ long eg1Attack;
31 /* 0x1C */ long eg1Decay;
32 /* 0x20 */ long eg1Sustain;
33 /* 0x24 */ long eg1Release;
34 /* 0x28 */ long eg1Vel2Attack;
35 /* 0x2C */ long eg1Key2Decay;
36 /* 0x30 */ long eg2Attack;
37 /* 0x34 */ long eg2Decay;
38 /* 0x38 */ long eg2Sustain;
39 /* 0x3C */ long eg2Release;
40 /* 0x40 */ long eg2Vel2Attack;
41 /* 0x44 */ long eg2Key2Decay;
42 /* 0x48 */ long eg2Pitch;
43 /* 0x4C */ long pan;
44};
45
46struct WTSAMPLE {
47 /* 0x00 */ u16 format;
48 /* 0x02 */ u16 sampleRate;
49 /* 0x04 */ u32 offset;
50 /* 0x08 */ u32 length;
51 /* 0x0C */ u16 adpcmIndex;
52};
53
54struct WTADPCM {
55 /* 0x00 */ u16 a[8][2];
56 /* 0x20 */ u16 gain;
57 /* 0x22 */ u16 pred_scale;
58 /* 0x24 */ u16 yn1;
59 /* 0x26 */ u16 yn2;
60 /* 0x28 */ u16 loop_pred_scale;
61 /* 0x2A */ u16 loop_yn1;
62 /* 0x2C */ u16 loop_yn2;
63};
64
65struct SYNSYNTH {
66 /* 0x0000 */ void * next;
67 /* 0x0004 */ struct WTINST * percussiveInst;
68 /* 0x0008 */ struct WTINST * melodicInst;
69 /* 0x000C */ struct WTREGION * region;
70 /* 0x0010 */ struct WTART * art;
71 /* 0x0014 */ struct WTSAMPLE * sample;
72 /* 0x0018 */ struct WTADPCM * adpcm;
73 /* 0x001C */ u32 aramBaseWord;
74 /* 0x0020 */ u32 aramBaseByte;
75 /* 0x0024 */ u32 aramBaseNibble;
76 /* 0x0028 */ u32 priorityVoiceAlloc;
77 /* 0x002C */ u32 priorityNoteOn;
79 /* 0x0034 */ struct WTINST * inst[16];
80 /* 0x0074 */ long masterVolume;
81 /* 0x0078 */ u8 controller[16][128];
82 /* 0x0878 */ u8 rpn[16];
83 /* 0x0888 */ s16 dataEntry[16];
84 /* 0x08A8 */ long pwMaxCents[16];
85 /* 0x08E8 */ long pwCents[16];
86 /* 0x0928 */ long volAttn[16];
87 /* 0x0968 */ long expAttn[16];
88 /* 0x09A8 */ long auxAAttn[16];
89 /* 0x09E8 */ long auxBAttn[16];
90 /* 0x0A28 */ u8 input[SYN_INPUT_BUFFER_SIZE][3];
91 /* 0x0D28 */ u8 * inputPosition;
92 /* 0x0D2C */ u32 inputCounter;
93 /* 0x0D30 */ u32 notes;
94 /* 0x0D34 */ void * keyGroup[16][16];
95 /* 0x1134 */ void * voice[16][128];
96};
97
98struct SYNVOICE {
99 /* 0x00 */ void * next;
100 /* 0x04 */ AXVPB * axvpb;
101 /* 0x08 */ struct SYNSYNTH * synth;
102 /* 0x0C */ u8 midiChannel;
103 /* 0x0D */ u8 keyNum;
104 /* 0x0E */ u8 keyVel;
105 /* 0x0F */ u8 pan;
106 /* 0x10 */ u8 keyGroup;
107 /* 0x14 */ struct WTREGION * region;
108 /* 0x18 */ struct WTART * art;
109 /* 0x1C */ struct WTSAMPLE * sample;
110 /* 0x20 */ struct WTADPCM * adpcm;
111 /* 0x24 */ u32 hold;
112 /* 0x28 */ u32 type;
113 /* 0x2C */ f32 srcRatio;
114 /* 0x30 */ long cents;
115 /* 0x34 */ long attn;
116 /* 0x38 */ long lfoState;
117 /* 0x3C */ long lfoAttn;
118 /* 0x40 */ long lfoCents;
119 /* 0x44 */ long lfoFreq;
120 /* 0x48 */ long lfoDelay;
121 /* 0x4C */ long lfoAttn_;
122 /* 0x50 */ long lfoCents_;
123 /* 0x54 */ long lfoModAttn;
124 /* 0x58 */ long lfoModCents;
125 /* 0x5C */ u32 veState;
126 /* 0x60 */ long veAttn;
127 /* 0x64 */ long veAttack;
128 /* 0x68 */ long veAttackDelta;
129 /* 0x6C */ long veDecay;
130 /* 0x70 */ long veSustain;
131 /* 0x74 */ long veRelease;
132 /* 0x78 */ u32 peState;
133 /* 0x7C */ long peCents;
134 /* 0x80 */ long peAttack;
135 /* 0x84 */ long peDecay;
136 /* 0x88 */ long peSustain;
137 /* 0x8C */ long peRelease;
138 /* 0x90 */ long pePitch;
139};
140
141// sample formats
142#define SYN_SAMPLE_FORMAT_ADPCM 0
143#define SYN_SAMPLE_FORMAT_PCM16 1
144#define SYN_SAMPLE_FORMAT_PCM8 2
145
146// syn.c
147void SYNInit();
148void SYNQuit();
150void SYNInitSynth(struct SYNSYNTH * synth, void * wavetable, u32 aramBase, u32 priorityVoiceAlloc, u32 priorityNoteOn, u32 priorityNoteRelease);
151void SYNQuitSynth(struct SYNSYNTH * synth);
152void SYNMidiInput(struct SYNSYNTH * synth, u8 * input);
153void SYNSetMasterVolume(struct SYNSYNTH * synth, long dB);
154long SYNGetMasterVolume(struct SYNSYNTH * synth);
156
157// synctrl.c
158u8 SYNGetMidiController(struct SYNSYNTH * synth, u8 midiChannel, u8 function);
159
160#endif // _DOLPHIN_SYN_H_
unsigned long u32
Definition types.h:9
signed short int s16
Definition types.h:6
float f32
Definition types.h:13
unsigned short int u16
Definition types.h:7
unsigned char u8
Definition hsd_3B2B.h:2
Definition ax.h:122
Definition syn.h:65
long auxAAttn[16]
Definition syn.h:88
long pwMaxCents[16]
Definition syn.h:84
long pwCents[16]
Definition syn.h:85
long masterVolume
Definition syn.h:80
u32 inputCounter
Definition syn.h:92
struct WTSAMPLE * sample
Definition syn.h:71
u32 aramBaseNibble
Definition syn.h:75
struct WTINST * percussiveInst
Definition syn.h:67
long auxBAttn[16]
Definition syn.h:89
u32 priorityVoiceAlloc
Definition syn.h:76
u32 aramBaseByte
Definition syn.h:74
u8 input[SYN_INPUT_BUFFER_SIZE][3]
Definition syn.h:90
struct WTINST * melodicInst
Definition syn.h:68
struct WTREGION * region
Definition syn.h:69
u8 controller[16][128]
Definition syn.h:81
u8 * inputPosition
Definition syn.h:91
u32 priorityNoteOn
Definition syn.h:77
u32 notes
Definition syn.h:93
struct WTADPCM * adpcm
Definition syn.h:72
s16 dataEntry[16]
Definition syn.h:83
long expAttn[16]
Definition syn.h:87
u32 priorityNoteRelease
Definition syn.h:78
struct WTART * art
Definition syn.h:70
long volAttn[16]
Definition syn.h:86
u8 rpn[16]
Definition syn.h:82
void * keyGroup[16][16]
Definition syn.h:94
void * next
Definition syn.h:66
void * voice[16][128]
Definition syn.h:95
struct WTINST * inst[16]
Definition syn.h:79
u32 aramBaseWord
Definition syn.h:73
Definition syn.h:98
f32 srcRatio
Definition syn.h:113
u32 type
Definition syn.h:112
long lfoFreq
Definition syn.h:119
AXVPB * axvpb
Definition syn.h:100
long cents
Definition syn.h:114
long lfoDelay
Definition syn.h:120
long attn
Definition syn.h:115
u8 keyGroup
Definition syn.h:106
struct WTART * art
Definition syn.h:108
long lfoAttn
Definition syn.h:117
long peCents
Definition syn.h:133
long pePitch
Definition syn.h:138
u8 midiChannel
Definition syn.h:102
void * next
Definition syn.h:99
long veSustain
Definition syn.h:130
long lfoAttn_
Definition syn.h:121
long veRelease
Definition syn.h:131
long veAttack
Definition syn.h:127
long lfoState
Definition syn.h:116
long lfoModCents
Definition syn.h:124
long veDecay
Definition syn.h:129
long lfoModAttn
Definition syn.h:123
struct WTADPCM * adpcm
Definition syn.h:110
long veAttn
Definition syn.h:126
long lfoCents
Definition syn.h:118
long veAttackDelta
Definition syn.h:128
long peSustain
Definition syn.h:136
long peDecay
Definition syn.h:135
u8 keyVel
Definition syn.h:104
u32 peState
Definition syn.h:132
long peAttack
Definition syn.h:134
struct SYNSYNTH * synth
Definition syn.h:101
u32 hold
Definition syn.h:111
long peRelease
Definition syn.h:137
u8 keyNum
Definition syn.h:103
long lfoCents_
Definition syn.h:122
u8 pan
Definition syn.h:105
struct WTSAMPLE * sample
Definition syn.h:109
u32 veState
Definition syn.h:125
struct WTREGION * region
Definition syn.h:107
Definition syn.h:54
u16 yn2
Definition syn.h:59
u16 pred_scale
Definition syn.h:57
u16 loop_yn1
Definition syn.h:61
u16 yn1
Definition syn.h:58
u16 loop_pred_scale
Definition syn.h:60
u16 gain
Definition syn.h:56
u16 loop_yn2
Definition syn.h:62
u16 a[8][2]
Definition syn.h:55
Definition syn.h:23
long lfoDelay
Definition syn.h:25
long eg1Decay
Definition syn.h:31
long eg1Release
Definition syn.h:33
long eg2Sustain
Definition syn.h:38
long eg2Key2Decay
Definition syn.h:41
long eg1Sustain
Definition syn.h:32
long lfoFreq
Definition syn.h:24
long eg1Attack
Definition syn.h:30
long lfoAtten
Definition syn.h:26
long eg1Key2Decay
Definition syn.h:35
long eg2Release
Definition syn.h:39
long eg2Decay
Definition syn.h:37
long eg1Vel2Attack
Definition syn.h:34
long lfoMod2Pitch
Definition syn.h:29
long eg2Pitch
Definition syn.h:42
long lfoMod2Atten
Definition syn.h:28
long eg2Vel2Attack
Definition syn.h:40
long eg2Attack
Definition syn.h:36
long lfoPitch
Definition syn.h:27
long pan
Definition syn.h:43
Definition syn.h:8
u16 keyRegion[128]
Definition syn.h:9
Definition syn.h:12
s16 fineTune
Definition syn.h:15
u32 sampleIndex
Definition syn.h:20
u8 keyGroup
Definition syn.h:14
long attn
Definition syn.h:16
u32 loopStart
Definition syn.h:17
u32 loopLength
Definition syn.h:18
u32 articulationIndex
Definition syn.h:19
u8 unityNote
Definition syn.h:13
Definition syn.h:46
u16 sampleRate
Definition syn.h:48
u32 length
Definition syn.h:50
u16 format
Definition syn.h:47
u16 adpcmIndex
Definition syn.h:51
u32 offset
Definition syn.h:49
u32 SYNGetActiveNotes(struct SYNSYNTH *synth)
void SYNSetMasterVolume(struct SYNSYNTH *synth, long dB)
void SYNInit()
#define SYN_INPUT_BUFFER_SIZE
Definition syn.h:6
void SYNQuit()
long SYNGetMasterVolume(struct SYNSYNTH *synth)
void SYNRunAudioFrame()
void SYNQuitSynth(struct SYNSYNTH *synth)
void SYNMidiInput(struct SYNSYNTH *synth, u8 *input)
void SYNInitSynth(struct SYNSYNTH *synth, void *wavetable, u32 aramBase, u32 priorityVoiceAlloc, u32 priorityNoteOn, u32 priorityNoteRelease)
u8 SYNGetMidiController(struct SYNSYNTH *synth, u8 midiChannel, u8 function)