bloops 0.5

Sign up to get free protection for your applications and to get access to all the features.
data/c/notation.c ADDED
@@ -0,0 +1,1656 @@
1
+ #line 1 "c/notation.rl"
2
+ //
3
+ // notation.rl
4
+ // the musical notation parser
5
+ //
6
+ // (c) 2009 why the lucky stiff
7
+ // See COPYING for the license
8
+ //
9
+ #include <stdio.h>
10
+ #include <stdlib.h>
11
+ #include <string.h>
12
+ #include <math.h>
13
+ #include <sys/stat.h>
14
+ #include "bloopsaphone.h"
15
+
16
+ #define ATOI(X,N) ({ \
17
+ char *Ap = X; \
18
+ int Ai = 0; \
19
+ size_t Al = N; \
20
+ while (Al--) { \
21
+ if ((*Ap >= '0') && (*Ap <= '9')) { \
22
+ Ai = (Ai * 10) + (*Ap - '0'); \
23
+ Ap++; \
24
+ } \
25
+ else break; \
26
+ } \
27
+ Ai; \
28
+ })
29
+
30
+ #define NOTE S->notes[S->nlen]
31
+
32
+ #define NEXT() \
33
+ NOTE.duration = len; \
34
+ NOTE.octave = oct; \
35
+ mod = 0; \
36
+ tone = 0; \
37
+ len = 4; \
38
+ fxval = 0; \
39
+ fxmod = 0; \
40
+ S->nlen++
41
+
42
+
43
+ #line 44 "c/notation.c"
44
+ static const char _bloopnotes_actions[] = {
45
+ 0, 1, 1, 1, 3, 1, 4, 1,
46
+ 6, 1, 8, 1, 9, 1, 10, 1,
47
+ 11, 1, 12, 1, 13, 1, 14, 1,
48
+ 15, 1, 16, 1, 17, 1, 18, 1,
49
+ 19, 1, 20, 1, 21, 1, 22, 1,
50
+ 23, 1, 24, 1, 25, 1, 26, 1,
51
+ 27, 1, 28, 1, 29, 1, 30, 1,
52
+ 31, 1, 32, 1, 33, 1, 34, 1,
53
+ 35, 1, 36, 1, 41, 2, 0, 37,
54
+ 2, 0, 39, 2, 0, 40, 2, 28,
55
+ 39, 2, 29, 40, 2, 35, 0, 2,
56
+ 35, 5, 2, 35, 30, 2, 35, 32,
57
+ 3, 1, 2, 38, 3, 3, 2, 38,
58
+ 3, 30, 2, 38, 3, 32, 2, 38,
59
+ 3, 35, 4, 5, 3, 35, 5, 7,
60
+ 4, 35, 4, 5, 7
61
+ };
62
+
63
+ static const short _bloopnotes_key_offsets[] = {
64
+ 0, 0, 8, 11, 12, 20, 27, 31,
65
+ 37, 39, 43, 45, 48, 52, 54, 57,
66
+ 60, 66, 70, 71, 72, 73, 74, 82,
67
+ 83, 84, 85, 86, 94, 95, 96, 97,
68
+ 98, 106, 108, 109, 117, 118, 119, 120,
69
+ 121, 129, 131, 132, 140, 141, 142, 143,
70
+ 144, 152, 155, 156, 157, 158, 166, 167,
71
+ 168, 169, 170, 178, 179, 180, 181, 189,
72
+ 190, 192, 193, 194, 195, 203, 204, 205,
73
+ 206, 207, 208, 209, 217, 220, 221, 222,
74
+ 223, 224, 232, 233, 234, 235, 236, 237,
75
+ 245, 246, 247, 248, 256, 260, 261, 262,
76
+ 263, 264, 272, 273, 274, 282, 283, 284,
77
+ 285, 286, 294, 295, 296, 297, 298, 306,
78
+ 317, 319, 322, 323, 323, 325, 328, 329,
79
+ 329, 336, 341, 345, 350, 353, 354
80
+ };
81
+
82
+ static const char _bloopnotes_trans_keys[] = {
83
+ 97, 100, 104, 108, 112, 114, 115, 118,
84
+ 114, 115, 116, 112, 32, 43, 45, 58,
85
+ 9, 13, 48, 57, 32, 43, 45, 9,
86
+ 13, 48, 57, 32, 58, 9, 13, 32,
87
+ 45, 9, 13, 48, 57, 48, 57, 46,
88
+ 93, 48, 57, 48, 57, 93, 48, 57,
89
+ 46, 93, 48, 57, 48, 57, 93, 48,
90
+ 57, 45, 48, 57, 32, 58, 9, 13,
91
+ 48, 57, 43, 45, 48, 57, 112, 101,
92
+ 101, 100, 32, 43, 45, 58, 9, 13,
93
+ 48, 57, 116, 97, 99, 107, 32, 43,
94
+ 45, 58, 9, 13, 48, 57, 101, 99,
95
+ 97, 121, 32, 43, 45, 58, 9, 13,
96
+ 48, 57, 112, 115, 102, 32, 43, 45,
97
+ 58, 9, 13, 48, 57, 119, 101, 101,
98
+ 112, 32, 43, 45, 58, 9, 13, 48,
99
+ 57, 112, 115, 102, 32, 43, 45, 58,
100
+ 9, 13, 48, 57, 119, 101, 101, 112,
101
+ 32, 43, 45, 58, 9, 13, 48, 57,
102
+ 104, 115, 117, 97, 115, 101, 32, 43,
103
+ 45, 58, 9, 13, 48, 57, 119, 101,
104
+ 101, 112, 32, 43, 45, 58, 9, 13,
105
+ 48, 57, 110, 99, 104, 32, 43, 45,
106
+ 58, 9, 13, 48, 57, 101, 112, 115,
107
+ 101, 97, 116, 32, 43, 45, 58, 9,
108
+ 13, 48, 57, 111, 110, 97, 110, 99,
109
+ 101, 32, 43, 45, 58, 9, 13, 48,
110
+ 57, 113, 117, 119, 117, 97, 114, 101,
111
+ 32, 43, 45, 58, 9, 13, 48, 57,
112
+ 115, 116, 97, 105, 110, 32, 43, 45,
113
+ 58, 9, 13, 48, 57, 101, 101, 112,
114
+ 32, 43, 45, 58, 9, 13, 48, 57,
115
+ 100, 105, 111, 115, 101, 108, 97, 121,
116
+ 32, 43, 45, 58, 9, 13, 48, 57,
117
+ 98, 101, 32, 43, 45, 58, 9, 13,
118
+ 48, 57, 108, 117, 109, 101, 32, 43,
119
+ 45, 58, 9, 13, 48, 57, 112, 101,
120
+ 101, 100, 32, 43, 45, 58, 9, 13,
121
+ 48, 57, 32, 43, 45, 9, 13, 49,
122
+ 57, 65, 71, 97, 103, 49, 57, 58,
123
+ 48, 57, 58, 49, 57, 58, 48, 57,
124
+ 58, 58, 48, 57, 65, 71, 97, 103,
125
+ 58, 65, 71, 97, 103, 65, 71, 97,
126
+ 103, 35, 91, 98, 49, 56, 91, 49,
127
+ 56, 91, 91, 0
128
+ };
129
+
130
+ static const char _bloopnotes_single_lengths[] = {
131
+ 0, 8, 3, 1, 4, 3, 2, 2,
132
+ 0, 2, 0, 1, 2, 0, 1, 1,
133
+ 2, 2, 1, 1, 1, 1, 4, 1,
134
+ 1, 1, 1, 4, 1, 1, 1, 1,
135
+ 4, 2, 1, 4, 1, 1, 1, 1,
136
+ 4, 2, 1, 4, 1, 1, 1, 1,
137
+ 4, 3, 1, 1, 1, 4, 1, 1,
138
+ 1, 1, 4, 1, 1, 1, 4, 1,
139
+ 2, 1, 1, 1, 4, 1, 1, 1,
140
+ 1, 1, 1, 4, 3, 1, 1, 1,
141
+ 1, 4, 1, 1, 1, 1, 1, 4,
142
+ 1, 1, 1, 4, 4, 1, 1, 1,
143
+ 1, 4, 1, 1, 4, 1, 1, 1,
144
+ 1, 4, 1, 1, 1, 1, 4, 3,
145
+ 0, 1, 1, 0, 0, 1, 1, 0,
146
+ 1, 1, 0, 3, 1, 1, 1
147
+ };
148
+
149
+ static const char _bloopnotes_range_lengths[] = {
150
+ 0, 0, 0, 0, 2, 2, 1, 2,
151
+ 1, 1, 1, 1, 1, 1, 1, 1,
152
+ 2, 1, 0, 0, 0, 0, 2, 0,
153
+ 0, 0, 0, 2, 0, 0, 0, 0,
154
+ 2, 0, 0, 2, 0, 0, 0, 0,
155
+ 2, 0, 0, 2, 0, 0, 0, 0,
156
+ 2, 0, 0, 0, 0, 2, 0, 0,
157
+ 0, 0, 2, 0, 0, 0, 2, 0,
158
+ 0, 0, 0, 0, 2, 0, 0, 0,
159
+ 0, 0, 0, 2, 0, 0, 0, 0,
160
+ 0, 2, 0, 0, 0, 0, 0, 2,
161
+ 0, 0, 0, 2, 0, 0, 0, 0,
162
+ 0, 2, 0, 0, 2, 0, 0, 0,
163
+ 0, 2, 0, 0, 0, 0, 2, 4,
164
+ 1, 1, 0, 0, 1, 1, 0, 0,
165
+ 3, 2, 2, 1, 1, 0, 0
166
+ };
167
+
168
+ static const short _bloopnotes_index_offsets[] = {
169
+ 0, 0, 9, 13, 15, 22, 28, 32,
170
+ 37, 39, 43, 45, 48, 52, 54, 57,
171
+ 60, 65, 69, 71, 73, 75, 77, 84,
172
+ 86, 88, 90, 92, 99, 101, 103, 105,
173
+ 107, 114, 117, 119, 126, 128, 130, 132,
174
+ 134, 141, 144, 146, 153, 155, 157, 159,
175
+ 161, 168, 172, 174, 176, 178, 185, 187,
176
+ 189, 191, 193, 200, 202, 204, 206, 213,
177
+ 215, 218, 220, 222, 224, 231, 233, 235,
178
+ 237, 239, 241, 243, 250, 254, 256, 258,
179
+ 260, 262, 269, 271, 273, 275, 277, 279,
180
+ 286, 288, 290, 292, 299, 304, 306, 308,
181
+ 310, 312, 319, 321, 323, 330, 332, 334,
182
+ 336, 338, 345, 347, 349, 351, 353, 360,
183
+ 368, 370, 373, 375, 376, 378, 381, 383,
184
+ 384, 389, 393, 396, 401, 404, 406
185
+ };
186
+
187
+ static const char _bloopnotes_trans_targs[] = {
188
+ 2, 28, 33, 41, 49, 63, 76, 92,
189
+ 111, 3, 18, 23, 111, 4, 111, 5,
190
+ 6, 16, 17, 5, 12, 111, 5, 6,
191
+ 16, 5, 12, 111, 7, 15, 7, 111,
192
+ 7, 8, 7, 12, 111, 9, 111, 10,
193
+ 126, 9, 111, 11, 111, 126, 11, 111,
194
+ 13, 126, 12, 111, 14, 111, 126, 14,
195
+ 111, 8, 12, 111, 7, 15, 7, 9,
196
+ 111, 6, 16, 12, 111, 19, 111, 20,
197
+ 111, 21, 111, 22, 111, 5, 6, 16,
198
+ 17, 5, 12, 111, 24, 111, 25, 111,
199
+ 26, 111, 27, 111, 5, 6, 16, 17,
200
+ 5, 12, 111, 29, 111, 30, 111, 31,
201
+ 111, 32, 111, 5, 6, 16, 17, 5,
202
+ 12, 111, 34, 36, 111, 35, 111, 5,
203
+ 6, 16, 17, 5, 12, 111, 37, 111,
204
+ 38, 111, 39, 111, 40, 111, 5, 6,
205
+ 16, 17, 5, 12, 111, 42, 44, 111,
206
+ 43, 111, 5, 6, 16, 17, 5, 12,
207
+ 111, 45, 111, 46, 111, 47, 111, 48,
208
+ 111, 5, 6, 16, 17, 5, 12, 111,
209
+ 50, 54, 59, 111, 51, 111, 52, 111,
210
+ 53, 111, 5, 6, 16, 17, 5, 12,
211
+ 111, 55, 111, 56, 111, 57, 111, 58,
212
+ 111, 5, 6, 16, 17, 5, 12, 111,
213
+ 60, 111, 61, 111, 62, 111, 5, 6,
214
+ 16, 17, 5, 12, 111, 64, 111, 65,
215
+ 69, 111, 66, 111, 67, 111, 68, 111,
216
+ 5, 6, 16, 17, 5, 12, 111, 70,
217
+ 111, 71, 111, 72, 111, 73, 111, 74,
218
+ 111, 75, 111, 5, 6, 16, 17, 5,
219
+ 12, 111, 77, 82, 88, 111, 78, 111,
220
+ 79, 111, 80, 111, 81, 111, 5, 6,
221
+ 16, 17, 5, 12, 111, 83, 111, 84,
222
+ 111, 85, 111, 86, 111, 87, 111, 5,
223
+ 6, 16, 17, 5, 12, 111, 89, 111,
224
+ 90, 111, 91, 111, 5, 6, 16, 17,
225
+ 5, 12, 111, 93, 98, 101, 106, 111,
226
+ 94, 111, 95, 111, 96, 111, 97, 111,
227
+ 5, 6, 16, 17, 5, 12, 111, 99,
228
+ 111, 100, 111, 5, 6, 16, 17, 5,
229
+ 12, 111, 102, 111, 103, 111, 104, 111,
230
+ 105, 111, 5, 6, 16, 17, 5, 12,
231
+ 111, 107, 111, 108, 111, 109, 111, 110,
232
+ 111, 5, 6, 16, 17, 5, 12, 111,
233
+ 111, 112, 116, 111, 120, 123, 123, 0,
234
+ 113, 111, 115, 114, 111, 115, 111, 111,
235
+ 117, 111, 119, 118, 111, 119, 111, 111,
236
+ 122, 121, 123, 123, 111, 122, 123, 123,
237
+ 111, 123, 123, 111, 124, 1, 124, 125,
238
+ 111, 1, 125, 111, 1, 111, 1, 111,
239
+ 111, 111, 111, 111, 111, 111, 111, 111,
240
+ 111, 111, 111, 111, 111, 111, 111, 111,
241
+ 111, 111, 111, 111, 111, 111, 111, 111,
242
+ 111, 111, 111, 111, 111, 111, 111, 111,
243
+ 111, 111, 111, 111, 111, 111, 111, 111,
244
+ 111, 111, 111, 111, 111, 111, 111, 111,
245
+ 111, 111, 111, 111, 111, 111, 111, 111,
246
+ 111, 111, 111, 111, 111, 111, 111, 111,
247
+ 111, 111, 111, 111, 111, 111, 111, 111,
248
+ 111, 111, 111, 111, 111, 111, 111, 111,
249
+ 111, 111, 111, 111, 111, 111, 111, 111,
250
+ 111, 111, 111, 111, 111, 111, 111, 111,
251
+ 111, 111, 111, 111, 111, 111, 111, 111,
252
+ 111, 111, 111, 111, 111, 111, 111, 111,
253
+ 111, 111, 111, 111, 111, 111, 111, 111,
254
+ 111, 111, 111, 111, 111, 0
255
+ };
256
+
257
+ static const char _bloopnotes_trans_actions[] = {
258
+ 0, 0, 0, 0, 0, 0, 0, 0,
259
+ 67, 0, 0, 0, 67, 0, 67, 39,
260
+ 39, 39, 39, 39, 39, 67, 0, 0,
261
+ 0, 0, 0, 67, 55, 55, 55, 67,
262
+ 0, 0, 0, 0, 67, 0, 67, 5,
263
+ 120, 0, 67, 7, 67, 116, 0, 67,
264
+ 5, 112, 0, 67, 7, 67, 87, 0,
265
+ 67, 0, 0, 67, 55, 55, 55, 0,
266
+ 67, 0, 0, 0, 67, 0, 67, 0,
267
+ 67, 0, 67, 0, 67, 41, 41, 41,
268
+ 41, 41, 41, 67, 0, 67, 0, 67,
269
+ 0, 67, 0, 67, 13, 13, 13, 13,
270
+ 13, 13, 67, 0, 67, 0, 67, 0,
271
+ 67, 0, 67, 17, 17, 17, 17, 17,
272
+ 17, 67, 0, 0, 67, 0, 67, 35,
273
+ 35, 35, 35, 35, 35, 67, 0, 67,
274
+ 0, 67, 0, 67, 0, 67, 37, 37,
275
+ 37, 37, 37, 37, 67, 0, 0, 67,
276
+ 0, 67, 29, 29, 29, 29, 29, 29,
277
+ 67, 0, 67, 0, 67, 0, 67, 0,
278
+ 67, 31, 31, 31, 31, 31, 31, 67,
279
+ 0, 0, 0, 67, 0, 67, 0, 67,
280
+ 0, 67, 43, 43, 43, 43, 43, 43,
281
+ 67, 0, 67, 0, 67, 0, 67, 0,
282
+ 67, 45, 45, 45, 45, 45, 45, 67,
283
+ 0, 67, 0, 67, 0, 67, 11, 11,
284
+ 11, 11, 11, 11, 67, 0, 67, 0,
285
+ 0, 67, 0, 67, 0, 67, 0, 67,
286
+ 47, 47, 47, 47, 47, 47, 67, 0,
287
+ 67, 0, 67, 0, 67, 0, 67, 0,
288
+ 67, 0, 67, 33, 33, 33, 33, 33,
289
+ 33, 67, 0, 0, 0, 67, 0, 67,
290
+ 0, 67, 0, 67, 0, 67, 19, 19,
291
+ 19, 19, 19, 19, 67, 0, 67, 0,
292
+ 67, 0, 67, 0, 67, 0, 67, 15,
293
+ 15, 15, 15, 15, 15, 67, 0, 67,
294
+ 0, 67, 0, 67, 21, 21, 21, 21,
295
+ 21, 21, 67, 0, 0, 0, 0, 67,
296
+ 0, 67, 0, 67, 0, 67, 0, 67,
297
+ 27, 27, 27, 27, 27, 27, 67, 0,
298
+ 67, 0, 67, 23, 23, 23, 23, 23,
299
+ 23, 67, 0, 67, 0, 67, 0, 67,
300
+ 0, 67, 9, 9, 9, 9, 9, 9,
301
+ 67, 0, 67, 0, 67, 0, 67, 0,
302
+ 67, 25, 25, 25, 25, 25, 25, 67,
303
+ 65, 0, 0, 65, 0, 63, 63, 0,
304
+ 49, 78, 0, 0, 72, 0, 72, 72,
305
+ 51, 81, 0, 0, 75, 0, 75, 75,
306
+ 0, 0, 84, 84, 69, 0, 84, 84,
307
+ 69, 84, 84, 69, 93, 57, 93, 93,
308
+ 108, 53, 90, 104, 1, 96, 3, 100,
309
+ 67, 67, 67, 67, 67, 67, 67, 67,
310
+ 67, 67, 67, 67, 67, 67, 67, 67,
311
+ 67, 67, 67, 67, 67, 67, 67, 67,
312
+ 67, 67, 67, 67, 67, 67, 67, 67,
313
+ 67, 67, 67, 67, 67, 67, 67, 67,
314
+ 67, 67, 67, 67, 67, 67, 67, 67,
315
+ 67, 67, 67, 67, 67, 67, 67, 67,
316
+ 67, 67, 67, 67, 67, 67, 67, 67,
317
+ 67, 67, 67, 67, 67, 67, 67, 67,
318
+ 67, 67, 67, 67, 67, 67, 67, 67,
319
+ 67, 67, 67, 67, 67, 67, 67, 67,
320
+ 67, 67, 67, 67, 67, 67, 67, 67,
321
+ 67, 67, 67, 67, 67, 67, 67, 67,
322
+ 67, 67, 67, 67, 67, 67, 78, 72,
323
+ 72, 72, 81, 75, 75, 75, 69, 69,
324
+ 69, 108, 104, 96, 100, 0
325
+ };
326
+
327
+ static const char _bloopnotes_to_state_actions[] = {
328
+ 0, 0, 0, 0, 0, 0, 0, 0,
329
+ 0, 0, 0, 0, 0, 0, 0, 0,
330
+ 0, 0, 0, 0, 0, 0, 0, 0,
331
+ 0, 0, 0, 0, 0, 0, 0, 0,
332
+ 0, 0, 0, 0, 0, 0, 0, 0,
333
+ 0, 0, 0, 0, 0, 0, 0, 0,
334
+ 0, 0, 0, 0, 0, 0, 0, 0,
335
+ 0, 0, 0, 0, 0, 0, 0, 0,
336
+ 0, 0, 0, 0, 0, 0, 0, 0,
337
+ 0, 0, 0, 0, 0, 0, 0, 0,
338
+ 0, 0, 0, 0, 0, 0, 0, 0,
339
+ 0, 0, 0, 0, 0, 0, 0, 0,
340
+ 0, 0, 0, 0, 0, 0, 0, 0,
341
+ 0, 0, 0, 0, 0, 0, 0, 59,
342
+ 0, 0, 0, 0, 0, 0, 0, 0,
343
+ 0, 0, 0, 0, 0, 0, 0
344
+ };
345
+
346
+ static const char _bloopnotes_from_state_actions[] = {
347
+ 0, 0, 0, 0, 0, 0, 0, 0,
348
+ 0, 0, 0, 0, 0, 0, 0, 0,
349
+ 0, 0, 0, 0, 0, 0, 0, 0,
350
+ 0, 0, 0, 0, 0, 0, 0, 0,
351
+ 0, 0, 0, 0, 0, 0, 0, 0,
352
+ 0, 0, 0, 0, 0, 0, 0, 0,
353
+ 0, 0, 0, 0, 0, 0, 0, 0,
354
+ 0, 0, 0, 0, 0, 0, 0, 0,
355
+ 0, 0, 0, 0, 0, 0, 0, 0,
356
+ 0, 0, 0, 0, 0, 0, 0, 0,
357
+ 0, 0, 0, 0, 0, 0, 0, 0,
358
+ 0, 0, 0, 0, 0, 0, 0, 0,
359
+ 0, 0, 0, 0, 0, 0, 0, 0,
360
+ 0, 0, 0, 0, 0, 0, 0, 61,
361
+ 0, 0, 0, 0, 0, 0, 0, 0,
362
+ 0, 0, 0, 0, 0, 0, 0
363
+ };
364
+
365
+ static const short _bloopnotes_eof_trans[] = {
366
+ 0, 518, 518, 518, 518, 518, 518, 518,
367
+ 518, 518, 518, 518, 518, 518, 518, 518,
368
+ 518, 518, 518, 518, 518, 518, 518, 518,
369
+ 518, 518, 518, 518, 518, 518, 518, 518,
370
+ 518, 518, 518, 518, 518, 518, 518, 518,
371
+ 518, 518, 518, 518, 518, 518, 518, 518,
372
+ 518, 518, 518, 518, 518, 518, 518, 518,
373
+ 518, 518, 518, 518, 518, 518, 518, 518,
374
+ 518, 518, 518, 518, 518, 518, 518, 518,
375
+ 518, 518, 518, 518, 518, 518, 518, 518,
376
+ 518, 518, 518, 518, 518, 518, 518, 518,
377
+ 518, 518, 518, 518, 518, 518, 518, 518,
378
+ 518, 518, 518, 518, 518, 518, 518, 518,
379
+ 518, 518, 518, 518, 518, 518, 518, 0,
380
+ 519, 522, 522, 522, 523, 526, 526, 526,
381
+ 529, 529, 529, 530, 531, 532, 533
382
+ };
383
+
384
+ static const int bloopnotes_start = 111;
385
+ static const int bloopnotes_error = 0;
386
+
387
+ static const int bloopnotes_en_main = 111;
388
+
389
+ #line 154 "c/notation.rl"
390
+
391
+
392
+ extern void _bloops_track_add(bloops *B, bloopsatrack *track);
393
+
394
+ bloopsatrack *
395
+ bloops_track(bloops *B, bloopsaphone *P, char *track, int tracklen)
396
+ {
397
+ int cs, act, oct = 4, len = 4;
398
+ bloopsatrack *S = (bloopsatrack *)malloc(sizeof(bloopsatrack));
399
+ char tone, mod, fxmod, *p, *pe, *pf, *ts, *te, *eof = 0;
400
+ bloopsafxcmd fxcmd = (bloopsafxcmd)0;
401
+ float fxval = 0;
402
+
403
+ S->refcount = 1;
404
+ S->nlen = 0;
405
+ S->capa = 1024;
406
+ S->notes = (bloopsanote *)calloc(sizeof(bloopsanote), 1024);
407
+
408
+ p = track;
409
+ pe = track + tracklen + 1;
410
+
411
+
412
+ #line 413 "c/notation.c"
413
+ {
414
+ cs = bloopnotes_start;
415
+ ts = 0;
416
+ te = 0;
417
+ act = 0;
418
+ }
419
+ #line 176 "c/notation.rl"
420
+
421
+ #line 422 "c/notation.c"
422
+ {
423
+ int _klen;
424
+ unsigned int _trans;
425
+ const char *_acts;
426
+ unsigned int _nacts;
427
+ const char *_keys;
428
+
429
+ if ( p == pe )
430
+ goto _test_eof;
431
+ if ( cs == 0 )
432
+ goto _out;
433
+ _resume:
434
+ _acts = _bloopnotes_actions + _bloopnotes_from_state_actions[cs];
435
+ _nacts = (unsigned int) *_acts++;
436
+ while ( _nacts-- > 0 ) {
437
+ switch ( *_acts++ ) {
438
+ case 34:
439
+ #line 1 "c/notation.rl"
440
+ {ts = p;}
441
+ break;
442
+ #line 443 "c/notation.c"
443
+ }
444
+ }
445
+
446
+ _keys = _bloopnotes_trans_keys + _bloopnotes_key_offsets[cs];
447
+ _trans = _bloopnotes_index_offsets[cs];
448
+
449
+ _klen = _bloopnotes_single_lengths[cs];
450
+ if ( _klen > 0 ) {
451
+ const char *_lower = _keys;
452
+ const char *_mid;
453
+ const char *_upper = _keys + _klen - 1;
454
+ while (1) {
455
+ if ( _upper < _lower )
456
+ break;
457
+
458
+ _mid = _lower + ((_upper-_lower) >> 1);
459
+ if ( (*p) < *_mid )
460
+ _upper = _mid - 1;
461
+ else if ( (*p) > *_mid )
462
+ _lower = _mid + 1;
463
+ else {
464
+ _trans += (_mid - _keys);
465
+ goto _match;
466
+ }
467
+ }
468
+ _keys += _klen;
469
+ _trans += _klen;
470
+ }
471
+
472
+ _klen = _bloopnotes_range_lengths[cs];
473
+ if ( _klen > 0 ) {
474
+ const char *_lower = _keys;
475
+ const char *_mid;
476
+ const char *_upper = _keys + (_klen<<1) - 2;
477
+ while (1) {
478
+ if ( _upper < _lower )
479
+ break;
480
+
481
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
482
+ if ( (*p) < _mid[0] )
483
+ _upper = _mid - 2;
484
+ else if ( (*p) > _mid[1] )
485
+ _lower = _mid + 2;
486
+ else {
487
+ _trans += ((_mid - _keys)>>1);
488
+ goto _match;
489
+ }
490
+ }
491
+ _trans += _klen;
492
+ }
493
+
494
+ _match:
495
+ _eof_trans:
496
+ cs = _bloopnotes_trans_targs[_trans];
497
+
498
+ if ( _bloopnotes_trans_actions[_trans] == 0 )
499
+ goto _again;
500
+
501
+ _acts = _bloopnotes_actions + _bloopnotes_trans_actions[_trans];
502
+ _nacts = (unsigned int) *_acts++;
503
+ while ( _nacts-- > 0 )
504
+ {
505
+ switch ( *_acts++ )
506
+ {
507
+ case 0:
508
+ #line 44 "c/notation.rl"
509
+ {
510
+ len = ATOI(ts, p - ts);
511
+ }
512
+ break;
513
+ case 1:
514
+ #line 48 "c/notation.rl"
515
+ {
516
+ oct = ATOI(p - 1, 1);
517
+ }
518
+ break;
519
+ case 2:
520
+ #line 52 "c/notation.rl"
521
+ {
522
+ switch (tone) {
523
+ case 'a': case 'A':
524
+ if (mod == 'b') NOTE.tone = 'a';
525
+ else if (mod == '#') NOTE.tone = 'b';
526
+ else NOTE.tone = 'A';
527
+ break;
528
+ case 'b': case 'B':
529
+ if (mod == 'b') NOTE.tone = 'b';
530
+ else if (mod == '#') NOTE.tone = 'C';
531
+ else NOTE.tone = 'B';
532
+ break;
533
+ case 'c': case 'C':
534
+ if (mod == 'b') NOTE.tone = 'B';
535
+ else if (mod == '#') NOTE.tone = 'd';
536
+ else NOTE.tone = 'C';
537
+ break;
538
+ case 'd': case 'D':
539
+ if (mod == 'b') NOTE.tone = 'd';
540
+ else if (mod == '#') NOTE.tone = 'e';
541
+ else NOTE.tone = 'D';
542
+ break;
543
+ case 'e': case 'E':
544
+ if (mod == 'b') NOTE.tone = 'e';
545
+ else if (mod == '#') NOTE.tone = 'F';
546
+ else NOTE.tone = 'E';
547
+ break;
548
+ case 'f': case 'F':
549
+ if (mod == 'b') NOTE.tone = 'E';
550
+ else if (mod == '#') NOTE.tone = 'g';
551
+ else NOTE.tone = 'F';
552
+ break;
553
+ case 'g': case 'G':
554
+ if (mod == 'b') NOTE.tone = 'g';
555
+ else if (mod == '#') NOTE.tone = 'a';
556
+ else NOTE.tone = 'G';
557
+ break;
558
+ }
559
+ }
560
+ break;
561
+ case 3:
562
+ #line 92 "c/notation.rl"
563
+ {
564
+ bloopsafx *fx = (bloopsafx *)malloc(sizeof(bloopsafx));
565
+ fx->next = NOTE.FX;
566
+ fx->cmd = fxcmd;
567
+ fx->val = fxval;
568
+ fx->mod = fxmod;
569
+ fxval = fxmod = 0;
570
+ NOTE.FX = fx;
571
+ }
572
+ break;
573
+ case 4:
574
+ #line 102 "c/notation.rl"
575
+ {
576
+ fxval = atoi(p-1) * 1.0f;
577
+ }
578
+ break;
579
+ case 5:
580
+ #line 106 "c/notation.rl"
581
+ {
582
+ fxval += ATOI(pf, p - pf) * pow(0.1f, p - pf);
583
+ }
584
+ break;
585
+ case 6:
586
+ #line 110 "c/notation.rl"
587
+ { pf = p; }
588
+ break;
589
+ case 7:
590
+ #line 111 "c/notation.rl"
591
+ { fxval *= -1.0f; }
592
+ break;
593
+ case 8:
594
+ #line 112 "c/notation.rl"
595
+ { fxcmd = BLOOPS_FX_VOLUME; }
596
+ break;
597
+ case 9:
598
+ #line 113 "c/notation.rl"
599
+ { fxcmd = BLOOPS_FX_PUNCH; }
600
+ break;
601
+ case 10:
602
+ #line 114 "c/notation.rl"
603
+ { fxcmd = BLOOPS_FX_ATTACK; }
604
+ break;
605
+ case 11:
606
+ #line 115 "c/notation.rl"
607
+ { fxcmd = BLOOPS_FX_SUSTAIN; }
608
+ break;
609
+ case 12:
610
+ #line 116 "c/notation.rl"
611
+ { fxcmd = BLOOPS_FX_DECAY; }
612
+ break;
613
+ case 13:
614
+ #line 117 "c/notation.rl"
615
+ { fxcmd = BLOOPS_FX_SQUARE; }
616
+ break;
617
+ case 14:
618
+ #line 118 "c/notation.rl"
619
+ { fxcmd = BLOOPS_FX_SWEEP; }
620
+ break;
621
+ case 15:
622
+ #line 119 "c/notation.rl"
623
+ { fxcmd = BLOOPS_FX_VIBE; }
624
+ break;
625
+ case 16:
626
+ #line 120 "c/notation.rl"
627
+ { fxcmd = BLOOPS_FX_VSPEED; }
628
+ break;
629
+ case 17:
630
+ #line 121 "c/notation.rl"
631
+ { fxcmd = BLOOPS_FX_VDELAY; }
632
+ break;
633
+ case 18:
634
+ #line 122 "c/notation.rl"
635
+ { fxcmd = BLOOPS_FX_LPF; }
636
+ break;
637
+ case 19:
638
+ #line 123 "c/notation.rl"
639
+ { fxcmd = BLOOPS_FX_LSWEEP; }
640
+ break;
641
+ case 20:
642
+ #line 124 "c/notation.rl"
643
+ { fxcmd = BLOOPS_FX_RESONANCE; }
644
+ break;
645
+ case 21:
646
+ #line 125 "c/notation.rl"
647
+ { fxcmd = BLOOPS_FX_HPF; }
648
+ break;
649
+ case 22:
650
+ #line 126 "c/notation.rl"
651
+ { fxcmd = BLOOPS_FX_HSWEEP; }
652
+ break;
653
+ case 23:
654
+ #line 127 "c/notation.rl"
655
+ { fxcmd = BLOOPS_FX_ARP; }
656
+ break;
657
+ case 24:
658
+ #line 128 "c/notation.rl"
659
+ { fxcmd = BLOOPS_FX_ASPEED; }
660
+ break;
661
+ case 25:
662
+ #line 129 "c/notation.rl"
663
+ { fxcmd = BLOOPS_FX_PHASE; }
664
+ break;
665
+ case 26:
666
+ #line 130 "c/notation.rl"
667
+ { fxcmd = BLOOPS_FX_PSWEEP; }
668
+ break;
669
+ case 27:
670
+ #line 131 "c/notation.rl"
671
+ { fxcmd = BLOOPS_FX_REPEAT; }
672
+ break;
673
+ case 28:
674
+ #line 134 "c/notation.rl"
675
+ { len = 1; }
676
+ break;
677
+ case 29:
678
+ #line 135 "c/notation.rl"
679
+ { len = 1; }
680
+ break;
681
+ case 30:
682
+ #line 136 "c/notation.rl"
683
+ { mod = p[-1]; }
684
+ break;
685
+ case 31:
686
+ #line 138 "c/notation.rl"
687
+ { fxmod = p[-1]; }
688
+ break;
689
+ case 32:
690
+ #line 140 "c/notation.rl"
691
+ { tone = p[-1]; }
692
+ break;
693
+ case 35:
694
+ #line 1 "c/notation.rl"
695
+ {te = p+1;}
696
+ break;
697
+ case 36:
698
+ #line 150 "c/notation.rl"
699
+ {te = p+1;}
700
+ break;
701
+ case 37:
702
+ #line 143 "c/notation.rl"
703
+ {te = p;p--;{
704
+ NOTE.tone = 0;
705
+ NEXT();
706
+ }}
707
+ break;
708
+ case 38:
709
+ #line 147 "c/notation.rl"
710
+ {te = p;p--;{ NEXT(); }}
711
+ break;
712
+ case 39:
713
+ #line 148 "c/notation.rl"
714
+ {te = p;p--;{ oct++; len = 4; }}
715
+ break;
716
+ case 40:
717
+ #line 149 "c/notation.rl"
718
+ {te = p;p--;{ oct--; len = 4; }}
719
+ break;
720
+ case 41:
721
+ #line 147 "c/notation.rl"
722
+ {{p = ((te))-1;}{ NEXT(); }}
723
+ break;
724
+ #line 725 "c/notation.c"
725
+ }
726
+ }
727
+
728
+ _again:
729
+ _acts = _bloopnotes_actions + _bloopnotes_to_state_actions[cs];
730
+ _nacts = (unsigned int) *_acts++;
731
+ while ( _nacts-- > 0 ) {
732
+ switch ( *_acts++ ) {
733
+ case 33:
734
+ #line 1 "c/notation.rl"
735
+ {ts = 0;}
736
+ break;
737
+ #line 738 "c/notation.c"
738
+ }
739
+ }
740
+
741
+ if ( cs == 0 )
742
+ goto _out;
743
+ if ( ++p != pe )
744
+ goto _resume;
745
+ _test_eof: {}
746
+ if ( p == eof )
747
+ {
748
+ if ( _bloopnotes_eof_trans[cs] > 0 ) {
749
+ _trans = _bloopnotes_eof_trans[cs] - 1;
750
+ goto _eof_trans;
751
+ }
752
+ }
753
+
754
+ _out: {}
755
+ }
756
+ #line 177 "c/notation.rl"
757
+
758
+ memcpy(&S->params, &P->params, sizeof(bloopsaparams));
759
+
760
+ _bloops_track_add(B, S);
761
+
762
+ return S;
763
+ }
764
+
765
+ bloopsatrack *
766
+ bloops_track2(bloops *B, bloopsaphone *P, char *track)
767
+ {
768
+ return bloops_track(B, P, track, strlen(track));
769
+ }
770
+
771
+ char *
772
+ bloops_track_str(bloopsatrack *track)
773
+ {
774
+ int bufsize = sizeof(char) * (track->nlen * 6 + 1024);
775
+ char *str = (char *)malloc(bufsize), *ptr = str;
776
+ int i, adv = 0;
777
+
778
+ for (i = 0; i < track->nlen; i++)
779
+ {
780
+ if (ptr - str + adv + sizeof(char) * 256 > bufsize) {
781
+ char *new_str;
782
+ bufsize += sizeof(char) * 1024;
783
+ new_str = realloc(str, bufsize);
784
+ if (new_str == NULL) {
785
+ free(str);
786
+ return NULL;
787
+ }
788
+ }
789
+
790
+ if (ptr > str)
791
+ strcat(ptr++, " ");
792
+
793
+ if (track->notes[i].duration != 4)
794
+ {
795
+ adv = sprintf(ptr, "%d:", (int)track->notes[i].duration);
796
+ ptr += adv;
797
+ }
798
+
799
+ if (track->notes[i].tone)
800
+ {
801
+ char tone[3] = "\0\0\0";
802
+ tone[0] = track->notes[i].tone;
803
+ switch (tone[0]) {
804
+ case 'a': tone[0] = 'A'; tone[1] = 'b'; break;
805
+ case 'b': tone[0] = 'B'; tone[1] = 'b'; break;
806
+ case 'd': tone[0] = 'C'; tone[1] = '#'; break;
807
+ case 'e': tone[0] = 'E'; tone[1] = 'b'; break;
808
+ case 'g': tone[0] = 'F'; tone[1] = '#'; break;
809
+ }
810
+ adv = sprintf(ptr, "%s", tone);
811
+ ptr += adv;
812
+
813
+ adv = sprintf(ptr, "%d", (int)track->notes[i].octave);
814
+ ptr += adv;
815
+ bloopsafx *fx = (bloopsafx *)track->notes[i].FX;
816
+ while (fx) {
817
+ if (fx->mod == 0)
818
+ adv = sprintf(ptr, "[%s %0.3f]", bloops_fxcmd_name(fx->cmd), fx->val);
819
+ else
820
+ adv = sprintf(ptr, "[%s %c %0.3f]", bloops_fxcmd_name(fx->cmd), fx->mod, fx->val);
821
+ ptr += adv;
822
+ fx = (bloopsafx *)fx->next;
823
+ }
824
+ }
825
+ }
826
+
827
+ return str;
828
+ }
829
+
830
+ char *
831
+ bloops_fxcmd_name(bloopsafxcmd fxcmd) {
832
+ char *fxname = "\0";
833
+ switch (fxcmd) {
834
+ case BLOOPS_FX_VOLUME: fxname = "volume"; break;
835
+ case BLOOPS_FX_PUNCH: fxname = "punch"; break;
836
+ case BLOOPS_FX_ATTACK: fxname = "attack"; break;
837
+ case BLOOPS_FX_SUSTAIN: fxname = "sustain"; break;
838
+ case BLOOPS_FX_DECAY: fxname = "decay"; break;
839
+ case BLOOPS_FX_SQUARE: fxname = "square"; break;
840
+ case BLOOPS_FX_SWEEP: fxname = "sweep"; break;
841
+ case BLOOPS_FX_VIBE: fxname = "vibe"; break;
842
+ case BLOOPS_FX_VSPEED: fxname = "vspeed"; break;
843
+ case BLOOPS_FX_VDELAY: fxname = "vdelay"; break;
844
+ case BLOOPS_FX_LPF: fxname = "lpf"; break;
845
+ case BLOOPS_FX_LSWEEP: fxname = "lsweep"; break;
846
+ case BLOOPS_FX_RESONANCE: fxname = "resonance"; break;
847
+ case BLOOPS_FX_HPF: fxname = "hpf"; break;
848
+ case BLOOPS_FX_HSWEEP: fxname = "hsweep"; break;
849
+ case BLOOPS_FX_ARP: fxname = "arp"; break;
850
+ case BLOOPS_FX_ASPEED: fxname = "aspeed"; break;
851
+ case BLOOPS_FX_PHASE: fxname = "phase"; break;
852
+ case BLOOPS_FX_PSWEEP: fxname = "psweep"; break;
853
+ case BLOOPS_FX_REPEAT: fxname = "repeat"; break;
854
+ }
855
+ return fxname;
856
+ }
857
+
858
+ float
859
+ bloops_note_freq(char note, int octave)
860
+ {
861
+ switch (note)
862
+ {
863
+ case 'A': // A
864
+ if (octave <= 0) return 0.0;
865
+ else if (octave == 1) return 0.121;
866
+ else if (octave == 2) return 0.175;
867
+ else if (octave == 3) return 0.248;
868
+ else if (octave == 4) return 0.353;
869
+ else if (octave == 5) return 0.500;
870
+ break;
871
+
872
+ case 'b': // A# or Bb
873
+ if (octave <= 0) return 0.0;
874
+ else if (octave == 1) return 0.125;
875
+ else if (octave == 2) return 0.181;
876
+ else if (octave == 3) return 0.255;
877
+ else if (octave == 4) return 0.364;
878
+ else if (octave == 5) return 0.515;
879
+ break;
880
+
881
+ case 'B': // B
882
+ if (octave <= 0) return 0.0;
883
+ else if (octave == 1) return 0.129;
884
+ else if (octave == 2) return 0.187;
885
+ else if (octave == 3) return 0.263;
886
+ else if (octave == 4) return 0.374;
887
+ else if (octave == 5) return 0.528;
888
+ break;
889
+
890
+ case 'C': // C
891
+ if (octave <= 1) return 0.0;
892
+ else if (octave == 2) return 0.133;
893
+ else if (octave == 3) return 0.192;
894
+ else if (octave == 4) return 0.271;
895
+ else if (octave == 5) return 0.385;
896
+ else if (octave == 6) return 0.544;
897
+ break;
898
+
899
+ case 'd': // C# or Db
900
+ if (octave <= 1) return 0.0;
901
+ else if (octave == 2) return 0.138;
902
+ else if (octave == 3) return 0.198;
903
+ else if (octave == 4) return 0.279;
904
+ else if (octave == 5) return 0.395;
905
+ else if (octave == 6) return 0.559;
906
+ break;
907
+
908
+ case 'D': // D
909
+ if (octave <= 1) return 0.0;
910
+ else if (octave == 2) return 0.143;
911
+ else if (octave == 3) return 0.202;
912
+ else if (octave == 4) return 0.287;
913
+ else if (octave == 5) return 0.406;
914
+ else if (octave == 6) return 0.575;
915
+ break;
916
+
917
+ case 'e': // D# or Eb
918
+ if (octave <= 1) return 0.0;
919
+ else if (octave == 2) return 0.148;
920
+ else if (octave == 3) return 0.208;
921
+ else if (octave == 4) return 0.296;
922
+ else if (octave == 5) return 0.418;
923
+ else if (octave == 6) return 0.593;
924
+ break;
925
+
926
+ case 'E': // E
927
+ if (octave <= 1) return 0.0;
928
+ else if (octave == 2) return 0.152;
929
+ else if (octave == 3) return 0.214;
930
+ else if (octave == 4) return 0.305;
931
+ else if (octave == 5) return 0.429;
932
+ else if (octave == 6) return 0.608;
933
+ break;
934
+
935
+ case 'F': // F
936
+ if (octave <= 1) return 0.0;
937
+ else if (octave == 2) return 0.155;
938
+ else if (octave == 3) return 0.220;
939
+ else if (octave == 4) return 0.314;
940
+ else if (octave == 5) return 0.441;
941
+ break;
942
+
943
+ case 'g': // F# or Gb
944
+ if (octave <= 1) return 0.0;
945
+ else if (octave == 2) return 0.160;
946
+ else if (octave == 3) return 0.227;
947
+ else if (octave == 4) return 0.323;
948
+ else if (octave == 5) return 0.454;
949
+ break;
950
+
951
+ case 'G': // G
952
+ if (octave <= 1) return 0.0;
953
+ else if (octave == 2) return 0.164;
954
+ else if (octave == 3) return 0.234;
955
+ else if (octave == 4) return 0.332;
956
+ else if (octave == 5) return 0.468;
957
+ break;
958
+
959
+ case 'a': // G# or Ab
960
+ if (octave <= 1) return 0.117;
961
+ else if (octave == 2) return 0.170;
962
+ else if (octave == 3) return 0.242;
963
+ else if (octave == 4) return 0.343;
964
+ else if (octave == 5) return 0.485;
965
+ break;
966
+ }
967
+
968
+ return 0.0;
969
+ }
970
+
971
+ #define KEY(name) key = (void *)&P->params.name
972
+
973
+
974
+ #line 975 "c/notation.c"
975
+ static const char _bloopserial_actions[] = {
976
+ 0, 1, 0, 1, 1, 1, 2, 1,
977
+ 5, 1, 6, 1, 7, 1, 8, 1,
978
+ 9, 1, 10, 1, 11, 1, 12, 1,
979
+ 13, 1, 14, 1, 15, 1, 16, 1,
980
+ 17, 1, 18, 1, 19, 1, 20, 1,
981
+ 21, 1, 22, 1, 23, 1, 24, 1,
982
+ 25, 1, 26, 1, 27, 1, 29, 1,
983
+ 30, 1, 31, 1, 32, 1, 33, 1,
984
+ 34, 1, 35, 1, 36, 2, 1, 3,
985
+ 2, 1, 35, 2, 4, 28, 3, 1,
986
+ 3, 35
987
+ };
988
+
989
+ static const unsigned char _bloopserial_key_offsets[] = {
990
+ 0, 0, 3, 4, 7, 13, 15, 18,
991
+ 20, 23, 25, 26, 27, 28, 29, 32,
992
+ 33, 34, 35, 36, 39, 41, 42, 43,
993
+ 44, 47, 48, 49, 50, 51, 54, 55,
994
+ 56, 57, 60, 62, 63, 66, 67, 68,
995
+ 69, 70, 73, 76, 77, 78, 79, 82,
996
+ 83, 86, 87, 88, 89, 90, 93, 96,
997
+ 97, 98, 99, 102, 103, 104, 105, 106,
998
+ 109, 110, 111, 112, 115, 116, 118, 119,
999
+ 120, 121, 124, 125, 126, 127, 128, 129,
1000
+ 130, 133, 137, 138, 139, 140, 143, 144,
1001
+ 145, 146, 147, 150, 151, 152, 153, 154,
1002
+ 155, 158, 159, 160, 161, 164, 165, 166,
1003
+ 167, 170, 175, 176, 177, 178, 179, 182,
1004
+ 183, 184, 185, 186, 187, 188, 189, 190,
1005
+ 191, 192, 193, 194, 198, 199, 200, 201,
1006
+ 202, 205, 206, 207, 210, 211, 212, 213,
1007
+ 214, 217, 218, 219, 220, 221, 224, 237,
1008
+ 240, 245, 248
1009
+ };
1010
+
1011
+ static const char _bloopserial_trans_keys[] = {
1012
+ 114, 115, 116, 112, 32, 9, 13, 32,
1013
+ 45, 9, 13, 48, 57, 48, 57, 46,
1014
+ 48, 57, 48, 57, 46, 48, 57, 48,
1015
+ 57, 112, 101, 101, 100, 32, 9, 13,
1016
+ 116, 97, 99, 107, 32, 9, 13, 101,
1017
+ 115, 99, 97, 121, 32, 9, 13, 108,
1018
+ 105, 100, 101, 32, 9, 13, 114, 101,
1019
+ 113, 32, 9, 13, 112, 115, 102, 32,
1020
+ 9, 13, 119, 101, 101, 112, 32, 9,
1021
+ 13, 105, 112, 115, 109, 105, 116, 32,
1022
+ 9, 13, 102, 32, 9, 13, 119, 101,
1023
+ 101, 112, 32, 9, 13, 104, 115, 117,
1024
+ 97, 115, 101, 32, 9, 13, 119, 101,
1025
+ 101, 112, 32, 9, 13, 110, 99, 104,
1026
+ 32, 9, 13, 101, 112, 115, 101, 97,
1027
+ 116, 32, 9, 13, 111, 110, 97, 110,
1028
+ 99, 101, 32, 9, 13, 108, 113, 117,
1029
+ 119, 105, 100, 101, 32, 9, 13, 117,
1030
+ 97, 114, 101, 32, 9, 13, 115, 116,
1031
+ 97, 105, 110, 32, 9, 13, 101, 101,
1032
+ 112, 32, 9, 13, 121, 112, 101, 32,
1033
+ 9, 13, 32, 110, 115, 9, 13, 111,
1034
+ 105, 115, 101, 97, 105, 113, 119, 116,
1035
+ 111, 111, 116, 104, 110, 101, 117, 97,
1036
+ 114, 101, 100, 105, 111, 115, 101, 108,
1037
+ 97, 121, 32, 9, 13, 98, 101, 32,
1038
+ 9, 13, 108, 117, 109, 101, 32, 9,
1039
+ 13, 112, 101, 101, 100, 32, 9, 13,
1040
+ 32, 97, 100, 102, 104, 108, 112, 114,
1041
+ 115, 116, 118, 9, 13, 32, 9, 13,
1042
+ 32, 9, 13, 48, 57, 32, 9, 13,
1043
+ 32, 9, 13, 48, 57, 0
1044
+ };
1045
+
1046
+ static const char _bloopserial_single_lengths[] = {
1047
+ 0, 3, 1, 1, 2, 0, 1, 0,
1048
+ 1, 0, 1, 1, 1, 1, 1, 1,
1049
+ 1, 1, 1, 1, 2, 1, 1, 1,
1050
+ 1, 1, 1, 1, 1, 1, 1, 1,
1051
+ 1, 1, 2, 1, 1, 1, 1, 1,
1052
+ 1, 1, 3, 1, 1, 1, 1, 1,
1053
+ 1, 1, 1, 1, 1, 1, 3, 1,
1054
+ 1, 1, 1, 1, 1, 1, 1, 1,
1055
+ 1, 1, 1, 1, 1, 2, 1, 1,
1056
+ 1, 1, 1, 1, 1, 1, 1, 1,
1057
+ 1, 4, 1, 1, 1, 1, 1, 1,
1058
+ 1, 1, 1, 1, 1, 1, 1, 1,
1059
+ 1, 1, 1, 1, 1, 1, 1, 1,
1060
+ 1, 3, 1, 1, 1, 1, 3, 1,
1061
+ 1, 1, 1, 1, 1, 1, 1, 1,
1062
+ 1, 1, 1, 4, 1, 1, 1, 1,
1063
+ 1, 1, 1, 1, 1, 1, 1, 1,
1064
+ 1, 1, 1, 1, 1, 1, 11, 1,
1065
+ 1, 1, 1
1066
+ };
1067
+
1068
+ static const char _bloopserial_range_lengths[] = {
1069
+ 0, 0, 0, 1, 2, 1, 1, 1,
1070
+ 1, 1, 0, 0, 0, 0, 1, 0,
1071
+ 0, 0, 0, 1, 0, 0, 0, 0,
1072
+ 1, 0, 0, 0, 0, 1, 0, 0,
1073
+ 0, 1, 0, 0, 1, 0, 0, 0,
1074
+ 0, 1, 0, 0, 0, 0, 1, 0,
1075
+ 1, 0, 0, 0, 0, 1, 0, 0,
1076
+ 0, 0, 1, 0, 0, 0, 0, 1,
1077
+ 0, 0, 0, 1, 0, 0, 0, 0,
1078
+ 0, 1, 0, 0, 0, 0, 0, 0,
1079
+ 1, 0, 0, 0, 0, 1, 0, 0,
1080
+ 0, 0, 1, 0, 0, 0, 0, 0,
1081
+ 1, 0, 0, 0, 1, 0, 0, 0,
1082
+ 1, 1, 0, 0, 0, 0, 0, 0,
1083
+ 0, 0, 0, 0, 0, 0, 0, 0,
1084
+ 0, 0, 0, 0, 0, 0, 0, 0,
1085
+ 1, 0, 0, 1, 0, 0, 0, 0,
1086
+ 1, 0, 0, 0, 0, 1, 1, 1,
1087
+ 2, 1, 2
1088
+ };
1089
+
1090
+ static const short _bloopserial_index_offsets[] = {
1091
+ 0, 0, 4, 6, 9, 14, 16, 19,
1092
+ 21, 24, 26, 28, 30, 32, 34, 37,
1093
+ 39, 41, 43, 45, 48, 51, 53, 55,
1094
+ 57, 60, 62, 64, 66, 68, 71, 73,
1095
+ 75, 77, 80, 83, 85, 88, 90, 92,
1096
+ 94, 96, 99, 103, 105, 107, 109, 112,
1097
+ 114, 117, 119, 121, 123, 125, 128, 132,
1098
+ 134, 136, 138, 141, 143, 145, 147, 149,
1099
+ 152, 154, 156, 158, 161, 163, 166, 168,
1100
+ 170, 172, 175, 177, 179, 181, 183, 185,
1101
+ 187, 190, 195, 197, 199, 201, 204, 206,
1102
+ 208, 210, 212, 215, 217, 219, 221, 223,
1103
+ 225, 228, 230, 232, 234, 237, 239, 241,
1104
+ 243, 246, 251, 253, 255, 257, 259, 263,
1105
+ 265, 267, 269, 271, 273, 275, 277, 279,
1106
+ 281, 283, 285, 287, 292, 294, 296, 298,
1107
+ 300, 303, 305, 307, 310, 312, 314, 316,
1108
+ 318, 321, 323, 325, 327, 329, 332, 345,
1109
+ 348, 352, 355
1110
+ };
1111
+
1112
+ static const unsigned char _bloopserial_trans_targs[] = {
1113
+ 2, 10, 15, 0, 3, 0, 4, 4,
1114
+ 0, 4, 5, 4, 8, 0, 6, 0,
1115
+ 7, 6, 0, 144, 0, 9, 8, 0,
1116
+ 146, 0, 11, 0, 12, 0, 13, 0,
1117
+ 14, 0, 4, 4, 0, 16, 0, 17,
1118
+ 0, 18, 0, 19, 0, 4, 4, 0,
1119
+ 21, 25, 0, 22, 0, 23, 0, 24,
1120
+ 0, 4, 4, 0, 26, 0, 27, 0,
1121
+ 28, 0, 29, 0, 4, 4, 0, 31,
1122
+ 0, 32, 0, 33, 0, 4, 4, 0,
1123
+ 35, 37, 0, 36, 0, 4, 4, 0,
1124
+ 38, 0, 39, 0, 40, 0, 41, 0,
1125
+ 4, 4, 0, 43, 47, 49, 0, 44,
1126
+ 0, 45, 0, 46, 0, 4, 4, 0,
1127
+ 48, 0, 4, 4, 0, 50, 0, 51,
1128
+ 0, 52, 0, 53, 0, 4, 4, 0,
1129
+ 55, 59, 64, 0, 56, 0, 57, 0,
1130
+ 58, 0, 4, 4, 0, 60, 0, 61,
1131
+ 0, 62, 0, 63, 0, 4, 4, 0,
1132
+ 65, 0, 66, 0, 67, 0, 4, 4,
1133
+ 0, 69, 0, 70, 74, 0, 71, 0,
1134
+ 72, 0, 73, 0, 4, 4, 0, 75,
1135
+ 0, 76, 0, 77, 0, 78, 0, 79,
1136
+ 0, 80, 0, 4, 4, 0, 82, 86,
1137
+ 91, 97, 0, 83, 0, 84, 0, 85,
1138
+ 0, 4, 4, 0, 87, 0, 88, 0,
1139
+ 89, 0, 90, 0, 4, 4, 0, 92,
1140
+ 0, 93, 0, 94, 0, 95, 0, 96,
1141
+ 0, 4, 4, 0, 98, 0, 99, 0,
1142
+ 100, 0, 4, 4, 0, 102, 0, 103,
1143
+ 0, 104, 0, 105, 105, 0, 105, 106,
1144
+ 110, 105, 0, 107, 0, 108, 0, 109,
1145
+ 0, 142, 0, 111, 117, 119, 0, 112,
1146
+ 0, 113, 0, 114, 0, 115, 0, 116,
1147
+ 0, 142, 0, 118, 0, 142, 0, 120,
1148
+ 0, 121, 0, 122, 0, 142, 0, 124,
1149
+ 129, 132, 137, 0, 125, 0, 126, 0,
1150
+ 127, 0, 128, 0, 4, 4, 0, 130,
1151
+ 0, 131, 0, 4, 4, 0, 133, 0,
1152
+ 134, 0, 135, 0, 136, 0, 4, 4,
1153
+ 0, 138, 0, 139, 0, 140, 0, 141,
1154
+ 0, 4, 4, 0, 143, 1, 20, 30,
1155
+ 34, 42, 54, 68, 81, 101, 123, 143,
1156
+ 0, 143, 143, 142, 145, 145, 144, 142,
1157
+ 145, 145, 142, 145, 145, 146, 142, 142,
1158
+ 142, 142, 142, 0
1159
+ };
1160
+
1161
+ static const char _bloopserial_trans_actions[] = {
1162
+ 0, 0, 0, 0, 0, 0, 7, 7,
1163
+ 0, 0, 0, 0, 0, 0, 0, 0,
1164
+ 1, 0, 0, 5, 0, 1, 0, 0,
1165
+ 5, 0, 0, 0, 0, 0, 0, 0,
1166
+ 0, 0, 9, 9, 0, 0, 0, 0,
1167
+ 0, 0, 0, 0, 0, 11, 11, 0,
1168
+ 0, 0, 0, 0, 0, 0, 0, 0,
1169
+ 0, 13, 13, 0, 0, 0, 0, 0,
1170
+ 0, 0, 0, 0, 15, 15, 0, 0,
1171
+ 0, 0, 0, 0, 0, 17, 17, 0,
1172
+ 0, 0, 0, 0, 0, 19, 19, 0,
1173
+ 0, 0, 0, 0, 0, 0, 0, 0,
1174
+ 21, 21, 0, 0, 0, 0, 0, 0,
1175
+ 0, 0, 0, 0, 0, 23, 23, 0,
1176
+ 0, 0, 25, 25, 0, 0, 0, 0,
1177
+ 0, 0, 0, 0, 0, 27, 27, 0,
1178
+ 0, 0, 0, 0, 0, 0, 0, 0,
1179
+ 0, 0, 29, 29, 0, 0, 0, 0,
1180
+ 0, 0, 0, 0, 0, 31, 31, 0,
1181
+ 0, 0, 0, 0, 0, 0, 45, 45,
1182
+ 0, 0, 0, 0, 0, 0, 0, 0,
1183
+ 0, 0, 0, 0, 33, 33, 0, 0,
1184
+ 0, 0, 0, 0, 0, 0, 0, 0,
1185
+ 0, 0, 0, 35, 35, 0, 0, 0,
1186
+ 0, 0, 0, 0, 0, 0, 0, 0,
1187
+ 0, 37, 37, 0, 0, 0, 0, 0,
1188
+ 0, 0, 0, 0, 39, 39, 0, 0,
1189
+ 0, 0, 0, 0, 0, 0, 0, 0,
1190
+ 0, 41, 41, 0, 0, 0, 0, 0,
1191
+ 0, 0, 43, 43, 0, 0, 0, 0,
1192
+ 0, 0, 0, 0, 0, 0, 0, 0,
1193
+ 0, 0, 0, 0, 0, 0, 0, 0,
1194
+ 0, 63, 0, 0, 0, 0, 0, 0,
1195
+ 0, 0, 0, 0, 0, 0, 0, 0,
1196
+ 0, 59, 0, 0, 0, 61, 0, 0,
1197
+ 0, 0, 0, 0, 0, 57, 0, 0,
1198
+ 0, 0, 0, 0, 0, 0, 0, 0,
1199
+ 0, 0, 0, 0, 51, 51, 0, 0,
1200
+ 0, 0, 0, 47, 47, 0, 0, 0,
1201
+ 0, 0, 0, 0, 0, 0, 75, 75,
1202
+ 0, 0, 0, 0, 0, 0, 0, 0,
1203
+ 0, 49, 49, 0, 0, 0, 0, 0,
1204
+ 0, 0, 0, 0, 0, 0, 0, 0,
1205
+ 0, 0, 0, 67, 69, 69, 0, 78,
1206
+ 0, 0, 65, 3, 3, 0, 72, 67,
1207
+ 78, 65, 72, 0
1208
+ };
1209
+
1210
+ static const char _bloopserial_to_state_actions[] = {
1211
+ 0, 0, 0, 0, 0, 0, 0, 0,
1212
+ 0, 0, 0, 0, 0, 0, 0, 0,
1213
+ 0, 0, 0, 0, 0, 0, 0, 0,
1214
+ 0, 0, 0, 0, 0, 0, 0, 0,
1215
+ 0, 0, 0, 0, 0, 0, 0, 0,
1216
+ 0, 0, 0, 0, 0, 0, 0, 0,
1217
+ 0, 0, 0, 0, 0, 0, 0, 0,
1218
+ 0, 0, 0, 0, 0, 0, 0, 0,
1219
+ 0, 0, 0, 0, 0, 0, 0, 0,
1220
+ 0, 0, 0, 0, 0, 0, 0, 0,
1221
+ 0, 0, 0, 0, 0, 0, 0, 0,
1222
+ 0, 0, 0, 0, 0, 0, 0, 0,
1223
+ 0, 0, 0, 0, 0, 0, 0, 0,
1224
+ 0, 0, 0, 0, 0, 0, 0, 0,
1225
+ 0, 0, 0, 0, 0, 0, 0, 0,
1226
+ 0, 0, 0, 0, 0, 0, 0, 0,
1227
+ 0, 0, 0, 0, 0, 0, 0, 0,
1228
+ 0, 0, 0, 0, 0, 0, 53, 0,
1229
+ 0, 0, 0
1230
+ };
1231
+
1232
+ static const char _bloopserial_from_state_actions[] = {
1233
+ 0, 0, 0, 0, 0, 0, 0, 0,
1234
+ 0, 0, 0, 0, 0, 0, 0, 0,
1235
+ 0, 0, 0, 0, 0, 0, 0, 0,
1236
+ 0, 0, 0, 0, 0, 0, 0, 0,
1237
+ 0, 0, 0, 0, 0, 0, 0, 0,
1238
+ 0, 0, 0, 0, 0, 0, 0, 0,
1239
+ 0, 0, 0, 0, 0, 0, 0, 0,
1240
+ 0, 0, 0, 0, 0, 0, 0, 0,
1241
+ 0, 0, 0, 0, 0, 0, 0, 0,
1242
+ 0, 0, 0, 0, 0, 0, 0, 0,
1243
+ 0, 0, 0, 0, 0, 0, 0, 0,
1244
+ 0, 0, 0, 0, 0, 0, 0, 0,
1245
+ 0, 0, 0, 0, 0, 0, 0, 0,
1246
+ 0, 0, 0, 0, 0, 0, 0, 0,
1247
+ 0, 0, 0, 0, 0, 0, 0, 0,
1248
+ 0, 0, 0, 0, 0, 0, 0, 0,
1249
+ 0, 0, 0, 0, 0, 0, 0, 0,
1250
+ 0, 0, 0, 0, 0, 0, 55, 0,
1251
+ 0, 0, 0
1252
+ };
1253
+
1254
+ static const short _bloopserial_eof_trans[] = {
1255
+ 0, 0, 0, 0, 0, 0, 0, 0,
1256
+ 0, 0, 0, 0, 0, 0, 0, 0,
1257
+ 0, 0, 0, 0, 0, 0, 0, 0,
1258
+ 0, 0, 0, 0, 0, 0, 0, 0,
1259
+ 0, 0, 0, 0, 0, 0, 0, 0,
1260
+ 0, 0, 0, 0, 0, 0, 0, 0,
1261
+ 0, 0, 0, 0, 0, 0, 0, 0,
1262
+ 0, 0, 0, 0, 0, 0, 0, 0,
1263
+ 0, 0, 0, 0, 0, 0, 0, 0,
1264
+ 0, 0, 0, 0, 0, 0, 0, 0,
1265
+ 0, 0, 0, 0, 0, 0, 0, 0,
1266
+ 0, 0, 0, 0, 0, 0, 0, 0,
1267
+ 0, 0, 0, 0, 0, 0, 0, 0,
1268
+ 0, 0, 0, 0, 0, 0, 0, 0,
1269
+ 0, 0, 0, 0, 0, 0, 0, 0,
1270
+ 0, 0, 0, 0, 0, 0, 0, 0,
1271
+ 0, 0, 0, 0, 0, 0, 0, 0,
1272
+ 0, 0, 0, 0, 0, 0, 0, 360,
1273
+ 361, 362, 363
1274
+ };
1275
+
1276
+ static const int bloopserial_start = 142;
1277
+ static const int bloopserial_error = 0;
1278
+
1279
+ static const int bloopserial_en_main = 142;
1280
+
1281
+ #line 446 "c/notation.rl"
1282
+
1283
+
1284
+ bloopsaphone *
1285
+ bloops_sound_file(bloops *B, char *fname)
1286
+ {
1287
+ FILE *fp;
1288
+ struct stat stats;
1289
+ int cs, act, len;
1290
+ float fval;
1291
+ void *key;
1292
+ char *str, *p, *pe, *pf, *ts, *te, *eof = 0;
1293
+ bloopsaphone *P;
1294
+
1295
+ if (stat(fname, &stats) == -1)
1296
+ return NULL;
1297
+
1298
+ fp = fopen(fname, "rb");
1299
+ if (!fp)
1300
+ return NULL;
1301
+
1302
+ len = stats.st_size;
1303
+ str = (char *)malloc(stats.st_size + 1);
1304
+ if (fread(str, 1, stats.st_size, fp) != stats.st_size)
1305
+ goto done;
1306
+
1307
+ p = str;
1308
+ pe = str + len + 1;
1309
+ p[len] = '\0';
1310
+
1311
+ P = bloops_square();
1312
+
1313
+ #line 1314 "c/notation.c"
1314
+ {
1315
+ cs = bloopserial_start;
1316
+ ts = 0;
1317
+ te = 0;
1318
+ act = 0;
1319
+ }
1320
+ #line 477 "c/notation.rl"
1321
+
1322
+ #line 1323 "c/notation.c"
1323
+ {
1324
+ int _klen;
1325
+ unsigned int _trans;
1326
+ const char *_acts;
1327
+ unsigned int _nacts;
1328
+ const char *_keys;
1329
+
1330
+ if ( p == pe )
1331
+ goto _test_eof;
1332
+ if ( cs == 0 )
1333
+ goto _out;
1334
+ _resume:
1335
+ _acts = _bloopserial_actions + _bloopserial_from_state_actions[cs];
1336
+ _nacts = (unsigned int) *_acts++;
1337
+ while ( _nacts-- > 0 ) {
1338
+ switch ( *_acts++ ) {
1339
+ case 30:
1340
+ #line 1 "c/notation.rl"
1341
+ {ts = p;}
1342
+ break;
1343
+ #line 1344 "c/notation.c"
1344
+ }
1345
+ }
1346
+
1347
+ _keys = _bloopserial_trans_keys + _bloopserial_key_offsets[cs];
1348
+ _trans = _bloopserial_index_offsets[cs];
1349
+
1350
+ _klen = _bloopserial_single_lengths[cs];
1351
+ if ( _klen > 0 ) {
1352
+ const char *_lower = _keys;
1353
+ const char *_mid;
1354
+ const char *_upper = _keys + _klen - 1;
1355
+ while (1) {
1356
+ if ( _upper < _lower )
1357
+ break;
1358
+
1359
+ _mid = _lower + ((_upper-_lower) >> 1);
1360
+ if ( (*p) < *_mid )
1361
+ _upper = _mid - 1;
1362
+ else if ( (*p) > *_mid )
1363
+ _lower = _mid + 1;
1364
+ else {
1365
+ _trans += (_mid - _keys);
1366
+ goto _match;
1367
+ }
1368
+ }
1369
+ _keys += _klen;
1370
+ _trans += _klen;
1371
+ }
1372
+
1373
+ _klen = _bloopserial_range_lengths[cs];
1374
+ if ( _klen > 0 ) {
1375
+ const char *_lower = _keys;
1376
+ const char *_mid;
1377
+ const char *_upper = _keys + (_klen<<1) - 2;
1378
+ while (1) {
1379
+ if ( _upper < _lower )
1380
+ break;
1381
+
1382
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
1383
+ if ( (*p) < _mid[0] )
1384
+ _upper = _mid - 2;
1385
+ else if ( (*p) > _mid[1] )
1386
+ _lower = _mid + 2;
1387
+ else {
1388
+ _trans += ((_mid - _keys)>>1);
1389
+ goto _match;
1390
+ }
1391
+ }
1392
+ _trans += _klen;
1393
+ }
1394
+
1395
+ _match:
1396
+ _eof_trans:
1397
+ cs = _bloopserial_trans_targs[_trans];
1398
+
1399
+ if ( _bloopserial_trans_actions[_trans] == 0 )
1400
+ goto _again;
1401
+
1402
+ _acts = _bloopserial_actions + _bloopserial_trans_actions[_trans];
1403
+ _nacts = (unsigned int) *_acts++;
1404
+ while ( _nacts-- > 0 )
1405
+ {
1406
+ switch ( *_acts++ )
1407
+ {
1408
+ case 0:
1409
+ #line 400 "c/notation.rl"
1410
+ {
1411
+ fval = ATOI(ts, p - ts) * 1.0f;
1412
+ }
1413
+ break;
1414
+ case 1:
1415
+ #line 404 "c/notation.rl"
1416
+ {
1417
+ fval = ATOI(pf, p - pf) * pow(0.1f, p - pf);
1418
+ }
1419
+ break;
1420
+ case 2:
1421
+ #line 408 "c/notation.rl"
1422
+ { pf = p; }
1423
+ break;
1424
+ case 3:
1425
+ #line 409 "c/notation.rl"
1426
+ { fval *= -1.0f; }
1427
+ break;
1428
+ case 4:
1429
+ #line 410 "c/notation.rl"
1430
+ { KEY(volume); }
1431
+ break;
1432
+ case 5:
1433
+ #line 411 "c/notation.rl"
1434
+ { KEY(arp); }
1435
+ break;
1436
+ case 6:
1437
+ #line 412 "c/notation.rl"
1438
+ { KEY(aspeed); }
1439
+ break;
1440
+ case 7:
1441
+ #line 413 "c/notation.rl"
1442
+ { KEY(attack); }
1443
+ break;
1444
+ case 8:
1445
+ #line 414 "c/notation.rl"
1446
+ { KEY(decay); }
1447
+ break;
1448
+ case 9:
1449
+ #line 415 "c/notation.rl"
1450
+ { KEY(dslide); }
1451
+ break;
1452
+ case 10:
1453
+ #line 416 "c/notation.rl"
1454
+ { KEY(freq); }
1455
+ break;
1456
+ case 11:
1457
+ #line 417 "c/notation.rl"
1458
+ { KEY(hpf); }
1459
+ break;
1460
+ case 12:
1461
+ #line 418 "c/notation.rl"
1462
+ { KEY(hsweep); }
1463
+ break;
1464
+ case 13:
1465
+ #line 419 "c/notation.rl"
1466
+ { KEY(limit); }
1467
+ break;
1468
+ case 14:
1469
+ #line 420 "c/notation.rl"
1470
+ { KEY(lpf); }
1471
+ break;
1472
+ case 15:
1473
+ #line 421 "c/notation.rl"
1474
+ { KEY(lsweep); }
1475
+ break;
1476
+ case 16:
1477
+ #line 422 "c/notation.rl"
1478
+ { KEY(phase); }
1479
+ break;
1480
+ case 17:
1481
+ #line 423 "c/notation.rl"
1482
+ { KEY(psweep); }
1483
+ break;
1484
+ case 18:
1485
+ #line 424 "c/notation.rl"
1486
+ { KEY(repeat); }
1487
+ break;
1488
+ case 19:
1489
+ #line 425 "c/notation.rl"
1490
+ { KEY(resonance); }
1491
+ break;
1492
+ case 20:
1493
+ #line 426 "c/notation.rl"
1494
+ { KEY(slide); }
1495
+ break;
1496
+ case 21:
1497
+ #line 427 "c/notation.rl"
1498
+ { KEY(square); }
1499
+ break;
1500
+ case 22:
1501
+ #line 428 "c/notation.rl"
1502
+ { KEY(sustain); }
1503
+ break;
1504
+ case 23:
1505
+ #line 429 "c/notation.rl"
1506
+ { KEY(sweep); }
1507
+ break;
1508
+ case 24:
1509
+ #line 430 "c/notation.rl"
1510
+ { KEY(punch); }
1511
+ break;
1512
+ case 25:
1513
+ #line 431 "c/notation.rl"
1514
+ { KEY(vibe); }
1515
+ break;
1516
+ case 26:
1517
+ #line 432 "c/notation.rl"
1518
+ { KEY(vspeed); }
1519
+ break;
1520
+ case 27:
1521
+ #line 433 "c/notation.rl"
1522
+ { KEY(vdelay); }
1523
+ break;
1524
+ case 28:
1525
+ #line 434 "c/notation.rl"
1526
+ { KEY(volume); }
1527
+ break;
1528
+ case 31:
1529
+ #line 438 "c/notation.rl"
1530
+ {te = p+1;{ P->params.type = BLOOPS_SQUARE; }}
1531
+ break;
1532
+ case 32:
1533
+ #line 439 "c/notation.rl"
1534
+ {te = p+1;{ P->params.type = BLOOPS_SAWTOOTH; }}
1535
+ break;
1536
+ case 33:
1537
+ #line 440 "c/notation.rl"
1538
+ {te = p+1;{ P->params.type = BLOOPS_SINE; }}
1539
+ break;
1540
+ case 34:
1541
+ #line 441 "c/notation.rl"
1542
+ {te = p+1;{ P->params.type = BLOOPS_NOISE; }}
1543
+ break;
1544
+ case 35:
1545
+ #line 437 "c/notation.rl"
1546
+ {te = p;p--;{ *((float *)key) = fval; }}
1547
+ break;
1548
+ case 36:
1549
+ #line 442 "c/notation.rl"
1550
+ {te = p;p--;}
1551
+ break;
1552
+ #line 1553 "c/notation.c"
1553
+ }
1554
+ }
1555
+
1556
+ _again:
1557
+ _acts = _bloopserial_actions + _bloopserial_to_state_actions[cs];
1558
+ _nacts = (unsigned int) *_acts++;
1559
+ while ( _nacts-- > 0 ) {
1560
+ switch ( *_acts++ ) {
1561
+ case 29:
1562
+ #line 1 "c/notation.rl"
1563
+ {ts = 0;}
1564
+ break;
1565
+ #line 1566 "c/notation.c"
1566
+ }
1567
+ }
1568
+
1569
+ if ( cs == 0 )
1570
+ goto _out;
1571
+ if ( ++p != pe )
1572
+ goto _resume;
1573
+ _test_eof: {}
1574
+ if ( p == eof )
1575
+ {
1576
+ if ( _bloopserial_eof_trans[cs] > 0 ) {
1577
+ _trans = _bloopserial_eof_trans[cs] - 1;
1578
+ goto _eof_trans;
1579
+ }
1580
+ }
1581
+
1582
+ _out: {}
1583
+ }
1584
+ #line 478 "c/notation.rl"
1585
+
1586
+ done:
1587
+ fclose(fp);
1588
+ return P;
1589
+ }
1590
+
1591
+ char *
1592
+ bloops_sound_str(bloopsaphone *P)
1593
+ {
1594
+ char *lines = (char *)malloc(4096), *str = lines;
1595
+ bloopsaphone *sq = bloops_square();
1596
+ if (P->params.type == BLOOPS_SQUARE)
1597
+ str += sprintf(str, "type square\n");
1598
+ else if (P->params.type == BLOOPS_SAWTOOTH)
1599
+ str += sprintf(str, "type sawtooth\n");
1600
+ else if (P->params.type == BLOOPS_SINE)
1601
+ str += sprintf(str, "type sine\n");
1602
+ else if (P->params.type == BLOOPS_NOISE)
1603
+ str += sprintf(str, "type noise\n");
1604
+
1605
+ if (P->params.volume != sq->params.volume)
1606
+ str += sprintf(str, "volume %0.3f\n", P->params.volume);
1607
+ if (P->params.punch != sq->params.punch)
1608
+ str += sprintf(str, "punch %0.3f\n", P->params.punch);
1609
+ if (P->params.attack != sq->params.attack)
1610
+ str += sprintf(str, "attack %0.3f\n", P->params.attack);
1611
+ if (P->params.sustain != sq->params.sustain)
1612
+ str += sprintf(str, "sustain %0.3f\n", P->params.sustain);
1613
+ if (P->params.decay != sq->params.decay)
1614
+ str += sprintf(str, "decay %0.3f\n", P->params.decay);
1615
+ if (P->params.freq != sq->params.freq)
1616
+ str += sprintf(str, "freq %0.3f\n", P->params.freq);
1617
+ if (P->params.limit != sq->params.limit)
1618
+ str += sprintf(str, "limit %0.3f\n", P->params.limit);
1619
+ if (P->params.slide != sq->params.slide)
1620
+ str += sprintf(str, "slide %0.3f\n", P->params.slide);
1621
+ if (P->params.dslide != sq->params.dslide)
1622
+ str += sprintf(str, "dslide %0.3f\n", P->params.dslide);
1623
+ if (P->params.square != sq->params.square)
1624
+ str += sprintf(str, "square %0.3f\n", P->params.square);
1625
+ if (P->params.sweep != sq->params.sweep)
1626
+ str += sprintf(str, "sweep %0.3f\n", P->params.sweep);
1627
+ if (P->params.vibe != sq->params.vibe)
1628
+ str += sprintf(str, "vibe %0.3f\n", P->params.vibe);
1629
+ if (P->params.vspeed != sq->params.vspeed)
1630
+ str += sprintf(str, "vspeed %0.3f\n", P->params.vspeed);
1631
+ if (P->params.vdelay != sq->params.vdelay)
1632
+ str += sprintf(str, "vdelay %0.3f\n", P->params.vdelay);
1633
+ if (P->params.lpf != sq->params.lpf)
1634
+ str += sprintf(str, "lpf %0.3f\n", P->params.lpf);
1635
+ if (P->params.lsweep != sq->params.lsweep)
1636
+ str += sprintf(str, "lsweep %0.3f\n", P->params.lsweep);
1637
+ if (P->params.resonance != sq->params.resonance)
1638
+ str += sprintf(str, "resonance %0.3f\n", P->params.resonance);
1639
+ if (P->params.hpf != sq->params.hpf)
1640
+ str += sprintf(str, "hpf %0.3f\n", P->params.hpf);
1641
+ if (P->params.hsweep != sq->params.hsweep)
1642
+ str += sprintf(str, "hsweep %0.3f\n", P->params.hsweep);
1643
+ if (P->params.arp != sq->params.arp)
1644
+ str += sprintf(str, "arp %0.3f\n", P->params.arp);
1645
+ if (P->params.aspeed != sq->params.aspeed)
1646
+ str += sprintf(str, "aspeed %0.3f\n", P->params.aspeed);
1647
+ if (P->params.phase != sq->params.phase)
1648
+ str += sprintf(str, "phase %0.3f\n", P->params.phase);
1649
+ if (P->params.psweep != sq->params.psweep)
1650
+ str += sprintf(str, "psweep %0.3f\n", P->params.psweep);
1651
+ if (P->params.repeat != sq->params.repeat)
1652
+ str += sprintf(str, "repeat %0.3f\n", P->params.repeat);
1653
+
1654
+ bloops_sound_destroy(sq);
1655
+ return lines;
1656
+ }