-
Notifications
You must be signed in to change notification settings - Fork 25
/
Soundfont.h
229 lines (203 loc) · 5.18 KB
/
Soundfont.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
/*
* Soundfont.h
*
* Created on: 27 feb 2016
* author: Sebastien CAPOU ([email protected])
* Source : https://github.com/neskweek/LightSaberOS
* Description: Soundfont Config file for LightSaberOS
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/.
*/
#include <LinkedList.h>
#if not defined SOUNDFONT_H_
#define SOUNDFONT_H_
class SoundFont {
#define SOUNDFONT_QUANTITY 1
public:
SoundFont() {
boot = LinkedList<uint16_t>();
powerOn = LinkedList<uint16_t>();
powerOff = LinkedList<uint16_t>();
hum = LinkedList<uint16_t>();
swing = LinkedList<uint16_t>();
spin = LinkedList<uint16_t>();
clash = LinkedList<uint16_t>();
lockup = LinkedList<uint16_t>();
blaster = LinkedList<uint16_t>();
wrist = LinkedList<uint16_t>();
force = LinkedList<uint16_t>();
ID=0;
powerOnTime =500;
powerOffTime = 500;
}
;
~SoundFont() {
/*
delete ID;
delete boot;
delete powerOn;
delete powerOff;
delete hum;
delete swing;
delete clash;
delete lockup;
delete blaster;
*/
}
;
void setID(uint16_t id) {
uint16_t boot[2];
uint16_t powerOn[2];
uint16_t powerOff[2];
uint16_t hum[2];
uint16_t swing[2];
uint16_t spin[2];
uint16_t clash[2];
uint16_t lockup[2];
uint16_t blaster[2];
uint16_t wrist[2];
uint16_t force[2];
this->ID = id;
switch (id) {
/*
case EXAMPLE:
// soundFont directory XX :
boot[0] = 1; // first boot sound file
boot[1] = 1; // last boot sound file
powerOn[0] = 2; // first powerOn sound file
powerOn[1] = 2; // last powerOn sound file
powerOff[0] = 3; // first powerOff sound file
powerOff[1] = 3; // last powerOff sound file
hum[0] = 4; // first hum sound file
hum[1] = 4; // last hum sound file
swing[0] = 6; // first swing sound file
swing[1] = 17; // last swing sound file
clash[0] = 18; // first clash sound file
clash[1] = 30; // last clash sound file
lockup[0] = 5; // first lockup sound file
lockup[1] = 5; // last lockup sound file
blaster[0] = 0; // first blaster sound file
blaster[1] = 0; // last blaster sound file
break;
*/
case 1:
// soundFont directory 01 is reserved for config menu sounds
break;
default:
// If you specify a ID number not defined here you will end up
// on the first defined soundfont
case 2:
// soundFont directory 02 :
this->powerOnTime = 400;
this->powerOffTime = 400;
boot[0] = 20;
boot[1] = 20;
powerOn[0] = 21;
powerOn[1] = 21;
powerOff[0] = 22;
powerOff[1] = 22;
hum[0] = 23;
hum[1] = 23;
swing[0] = 24;
swing[1] = 31;
spin[0] = 24;
spin[1] = 24;
clash[0] = 32;
clash[1] = 34;
lockup[0] = 38;
lockup[1] = 38;
blaster[0] = 35;
blaster[1] = 37;
wrist[0] = 39;
wrist[1] = 39;
force[0] = 0;
force[1] = 0;
break;
}
this->boot.clear();
this->powerOn.clear();
this->powerOff.clear();
this->hum.clear();
this->swing.clear();
this->clash.clear();
this->lockup.clear();
this->blaster.clear();
this->wrist.clear();
this->force.clear();
fill(&this->boot, boot);
fill(&this->powerOn, powerOn);
fill(&this->powerOff, powerOff);
fill(&this->hum, hum);
fill(&this->swing, swing);
fill(&this->spin, spin);
fill(&this->clash, clash);
fill(&this->lockup, lockup);
fill(&this->blaster, blaster);
fill(&this->wrist, wrist);
fill(&this->force, force);
}
uint16_t getID() const {
return this->ID;
}
const uint16_t getBlaster() {
return this->blaster.get(random(0, this->blaster.size()));
}
const uint16_t getBoot() {
return this->boot.get(random(0, this->boot.size()));
}
const uint16_t getClash() {
return this->clash.get(random(0, this->clash.size()));
}
const uint16_t getHum() {
return this->hum.get(random(0, this->hum.size()));
}
const uint16_t getLockup() {
return this->lockup.get(random(0, this->lockup.size()));
}
const uint16_t getPowerOff() {
return this->powerOff.get(random(0, this->powerOff.size()));
}
const uint16_t getPowerOn() {
return this->powerOn.get(random(0, this->powerOn.size()));
}
const uint16_t getSwing() {
return this->swing.get(random(0, this->swing.size()));
}
const uint16_t getSpin() {
return this->spin.get(random(0, this->spin.size()));
}
const uint16_t getForce() {
return this->force.get(random(0, this->force.size()));
}
const uint16_t getWrist() {
return this->wrist.get(random(0, this->wrist.size()));
}
uint16_t getPowerOffTime() const {
return powerOffTime;
}
uint16_t getPowerOnTime() const {
return powerOnTime;
}
private:
uint16_t ID;
LinkedList<uint16_t> boot;
LinkedList<uint16_t> powerOn;
uint16_t powerOnTime;
LinkedList<uint16_t> powerOff;
uint16_t powerOffTime;
LinkedList<uint16_t> hum;
LinkedList<uint16_t> swing;
LinkedList<uint16_t> spin;
LinkedList<uint16_t> clash;
LinkedList<uint16_t> lockup;
LinkedList<uint16_t> blaster;
LinkedList<uint16_t> wrist;
LinkedList<uint16_t> force;
void fill(LinkedList<uint16_t>* list, uint16_t array[]) {
for (uint16_t i = array[0]; i <= array[1]; i++) {
list->add(i);
}
}
};
#endif /* SOUNDFONT_H_ */