bloopsaphone 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,94 @@
1
+ //
2
+ // bloopsaphone.h
3
+ // the chiptune maker for portaudio
4
+ //
5
+ #ifndef BLOOPSAPHONE_H
6
+ #define BLOOPSAPHONE_H
7
+
8
+ #define BLOOPSAPHONE_VERSION "1.0"
9
+
10
+ #define BLOOPS_STOP 0
11
+ #define BLOOPS_PLAY 1
12
+ #define BLOOPS_MUTE 2
13
+
14
+ #define BLOOPS_SQUARE 0
15
+ #define BLOOPS_SAWTOOTH 1
16
+ #define BLOOPS_SINE 2
17
+ #define BLOOPS_NOISE 3
18
+
19
+ typedef struct {
20
+ unsigned char type, pan;
21
+ float volume;
22
+ float punch;
23
+ float attack;
24
+ float sustain;
25
+ float decay;
26
+ float freq, limit, slide, dslide; // pitch
27
+ float square, sweep; // square wave
28
+ float vibe, vspeed, vdelay; // vibrato
29
+ float lpf, lsweep, resonance, hpf, hsweep;
30
+ // hi-pass, lo-pass
31
+ float arp, aspeed; // arpeggiator
32
+ float phase, psweep; // phaser
33
+ float repeat; // repeats?
34
+ } bloopsaphone;
35
+
36
+ #define BLOOPS_HI_OCTAVE 8
37
+
38
+ typedef struct {
39
+ char tone, octave, duration;
40
+ } bloopsanote;
41
+
42
+ typedef struct {
43
+ bloopsaphone *P;
44
+ int nlen, capa;
45
+ bloopsanote *notes;
46
+
47
+ int frames;
48
+ float volume, freq;
49
+ unsigned char playing;
50
+ int stage, time, length[3];
51
+ double period, maxperiod, slide, dslide;
52
+ float square, sweep;
53
+ int phase, iphase, phasex;
54
+ float fphase, dphase;
55
+ float phaser[1024];
56
+ float noise[32];
57
+ float filter[8];
58
+ float vibe, vspeed, vdelay;
59
+ int repeat, limit;
60
+ double arp;
61
+ int atime, alimit;
62
+ } bloopsatrack;
63
+
64
+ #define BLOOPS_MAX_TRACKS 64
65
+
66
+ typedef struct {
67
+ void *stream;
68
+ int tempo;
69
+ float volume;
70
+ bloopsatrack *tracks[BLOOPS_MAX_TRACKS];
71
+ unsigned char play;
72
+ } bloops;
73
+
74
+ //
75
+ // the api
76
+ //
77
+ bloops *bloops_new();
78
+ void bloops_destroy(bloops *);
79
+ bloopsaphone *bloops_square();
80
+ bloopsaphone *bloops_load(char *);
81
+ void bloops_clear(bloops *);
82
+ void bloops_tempo(bloops *, int tempo);
83
+ void bloops_track_at(bloops *, bloopsatrack *, int);
84
+ void bloops_track_destroy(bloopsatrack *);
85
+ void bloops_play(bloops *);
86
+ int bloops_is_done(bloops *);
87
+ bloopsatrack *bloops_track(bloops *, bloopsaphone *, char *, int);
88
+ bloopsatrack *bloops_track2(bloops *, bloopsaphone *, char *);
89
+ char *bloops_track_str(bloopsatrack *);
90
+ float bloops_note_freq(char, int);
91
+ bloopsaphone *bloops_sound_file(bloops *, char *);
92
+ char *bloops_sound_str(bloops *, bloopsaphone *);
93
+
94
+ #endif
@@ -0,0 +1,1209 @@
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
+ S->nlen++
39
+
40
+
41
+ #line 42 "c/notation.c"
42
+ static const char _bloopnotes_actions[] = {
43
+ 0, 1, 0, 1, 3, 1, 4, 1,
44
+ 5, 1, 6, 1, 7, 1, 8, 1,
45
+ 9, 2, 0, 10, 2, 0, 12, 2,
46
+ 0, 13, 2, 3, 12, 2, 4, 13,
47
+ 3, 1, 2, 11, 3, 5, 2, 11,
48
+ 3, 6, 2, 11
49
+ };
50
+
51
+ static const char _bloopnotes_key_offsets[] = {
52
+ 0, 0, 11, 13, 16, 17, 17, 19,
53
+ 22, 23, 23, 30, 35, 39, 43, 45
54
+ };
55
+
56
+ static const char _bloopnotes_trans_keys[] = {
57
+ 32, 43, 45, 9, 13, 49, 57, 65,
58
+ 71, 97, 103, 49, 57, 58, 48, 57,
59
+ 58, 49, 57, 58, 48, 57, 58, 58,
60
+ 48, 57, 65, 71, 97, 103, 58, 65,
61
+ 71, 97, 103, 65, 71, 97, 103, 35,
62
+ 98, 49, 56, 49, 56, 0
63
+ };
64
+
65
+ static const char _bloopnotes_single_lengths[] = {
66
+ 0, 3, 0, 1, 1, 0, 0, 1,
67
+ 1, 0, 1, 1, 0, 2, 0, 0
68
+ };
69
+
70
+ static const char _bloopnotes_range_lengths[] = {
71
+ 0, 4, 1, 1, 0, 0, 1, 1,
72
+ 0, 0, 3, 2, 2, 1, 1, 0
73
+ };
74
+
75
+ static const char _bloopnotes_index_offsets[] = {
76
+ 0, 0, 8, 10, 13, 15, 16, 18,
77
+ 21, 23, 24, 29, 33, 36, 40, 42
78
+ };
79
+
80
+ static const char _bloopnotes_trans_targs[] = {
81
+ 1, 2, 6, 1, 10, 13, 13, 0,
82
+ 3, 1, 5, 4, 1, 5, 1, 1,
83
+ 7, 1, 9, 8, 1, 9, 1, 1,
84
+ 12, 11, 13, 13, 1, 12, 13, 13,
85
+ 1, 13, 13, 1, 14, 14, 15, 1,
86
+ 15, 1, 1, 1, 1, 1, 1, 1,
87
+ 1, 1, 1, 1, 1, 1, 1, 1,
88
+ 1, 0
89
+ };
90
+
91
+ static const char _bloopnotes_trans_actions[] = {
92
+ 15, 0, 0, 15, 0, 0, 0, 0,
93
+ 3, 26, 0, 0, 20, 0, 20, 20,
94
+ 5, 29, 0, 0, 23, 0, 23, 23,
95
+ 0, 0, 1, 1, 17, 0, 1, 1,
96
+ 17, 1, 1, 17, 9, 9, 9, 40,
97
+ 7, 36, 32, 26, 20, 20, 20, 29,
98
+ 23, 23, 23, 17, 17, 17, 40, 36,
99
+ 32, 0
100
+ };
101
+
102
+ static const char _bloopnotes_to_state_actions[] = {
103
+ 0, 11, 0, 0, 0, 0, 0, 0,
104
+ 0, 0, 0, 0, 0, 0, 0, 0
105
+ };
106
+
107
+ static const char _bloopnotes_from_state_actions[] = {
108
+ 0, 13, 0, 0, 0, 0, 0, 0,
109
+ 0, 0, 0, 0, 0, 0, 0, 0
110
+ };
111
+
112
+ static const char _bloopnotes_eof_trans[] = {
113
+ 0, 0, 44, 47, 47, 47, 48, 51,
114
+ 51, 51, 54, 54, 54, 55, 56, 57
115
+ };
116
+
117
+ static const int bloopnotes_start = 1;
118
+ static const int bloopnotes_error = 0;
119
+
120
+ static const int bloopnotes_en_main = 1;
121
+
122
+ #line 109 "c/notation.rl"
123
+
124
+
125
+ bloopsatrack *
126
+ bloops_track(bloops *B, bloopsaphone *P, char *track, int tracklen)
127
+ {
128
+ int cs, act, oct = 4, len = 4;
129
+ bloopsatrack *S = (bloopsatrack *)malloc(sizeof(bloopsatrack));
130
+ char tone, mod, *p, *pe, *ts, *te, *eof = 0;
131
+
132
+ S->P = P;
133
+ S->nlen = 0;
134
+ S->capa = 1024;
135
+ S->notes = (bloopsanote *)calloc(sizeof(bloopsanote), 1024);
136
+
137
+ p = track;
138
+ pe = track + tracklen + 1;
139
+
140
+
141
+ #line 142 "c/notation.c"
142
+ {
143
+ cs = bloopnotes_start;
144
+ ts = 0;
145
+ te = 0;
146
+ act = 0;
147
+ }
148
+ #line 127 "c/notation.rl"
149
+
150
+ #line 151 "c/notation.c"
151
+ {
152
+ int _klen;
153
+ unsigned int _trans;
154
+ const char *_acts;
155
+ unsigned int _nacts;
156
+ const char *_keys;
157
+
158
+ if ( p == pe )
159
+ goto _test_eof;
160
+ if ( cs == 0 )
161
+ goto _out;
162
+ _resume:
163
+ _acts = _bloopnotes_actions + _bloopnotes_from_state_actions[cs];
164
+ _nacts = (unsigned int) *_acts++;
165
+ while ( _nacts-- > 0 ) {
166
+ switch ( *_acts++ ) {
167
+ case 8:
168
+ #line 1 "c/notation.rl"
169
+ {ts = p;}
170
+ break;
171
+ #line 172 "c/notation.c"
172
+ }
173
+ }
174
+
175
+ _keys = _bloopnotes_trans_keys + _bloopnotes_key_offsets[cs];
176
+ _trans = _bloopnotes_index_offsets[cs];
177
+
178
+ _klen = _bloopnotes_single_lengths[cs];
179
+ if ( _klen > 0 ) {
180
+ const char *_lower = _keys;
181
+ const char *_mid;
182
+ const char *_upper = _keys + _klen - 1;
183
+ while (1) {
184
+ if ( _upper < _lower )
185
+ break;
186
+
187
+ _mid = _lower + ((_upper-_lower) >> 1);
188
+ if ( (*p) < *_mid )
189
+ _upper = _mid - 1;
190
+ else if ( (*p) > *_mid )
191
+ _lower = _mid + 1;
192
+ else {
193
+ _trans += (_mid - _keys);
194
+ goto _match;
195
+ }
196
+ }
197
+ _keys += _klen;
198
+ _trans += _klen;
199
+ }
200
+
201
+ _klen = _bloopnotes_range_lengths[cs];
202
+ if ( _klen > 0 ) {
203
+ const char *_lower = _keys;
204
+ const char *_mid;
205
+ const char *_upper = _keys + (_klen<<1) - 2;
206
+ while (1) {
207
+ if ( _upper < _lower )
208
+ break;
209
+
210
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
211
+ if ( (*p) < _mid[0] )
212
+ _upper = _mid - 2;
213
+ else if ( (*p) > _mid[1] )
214
+ _lower = _mid + 2;
215
+ else {
216
+ _trans += ((_mid - _keys)>>1);
217
+ goto _match;
218
+ }
219
+ }
220
+ _trans += _klen;
221
+ }
222
+
223
+ _match:
224
+ _eof_trans:
225
+ cs = _bloopnotes_trans_targs[_trans];
226
+
227
+ if ( _bloopnotes_trans_actions[_trans] == 0 )
228
+ goto _again;
229
+
230
+ _acts = _bloopnotes_actions + _bloopnotes_trans_actions[_trans];
231
+ _nacts = (unsigned int) *_acts++;
232
+ while ( _nacts-- > 0 )
233
+ {
234
+ switch ( *_acts++ )
235
+ {
236
+ case 0:
237
+ #line 42 "c/notation.rl"
238
+ {
239
+ len = ATOI(ts, p - ts);
240
+ }
241
+ break;
242
+ case 1:
243
+ #line 46 "c/notation.rl"
244
+ {
245
+ oct = ATOI(p - 1, 1);
246
+ }
247
+ break;
248
+ case 2:
249
+ #line 50 "c/notation.rl"
250
+ {
251
+ switch (tone) {
252
+ case 'a': case 'A':
253
+ if (mod == 'b') NOTE.tone = 'a';
254
+ else if (mod == '#') NOTE.tone = 'b';
255
+ else NOTE.tone = 'A';
256
+ break;
257
+ case 'b': case 'B':
258
+ if (mod == 'b') NOTE.tone = 'b';
259
+ else if (mod == '#') NOTE.tone = 'C';
260
+ else NOTE.tone = 'B';
261
+ break;
262
+ case 'c': case 'C':
263
+ if (mod == 'b') NOTE.tone = 'B';
264
+ else if (mod == '#') NOTE.tone = 'd';
265
+ else NOTE.tone = 'C';
266
+ break;
267
+ case 'd': case 'D':
268
+ if (mod == 'b') NOTE.tone = 'd';
269
+ else if (mod == '#') NOTE.tone = 'e';
270
+ else NOTE.tone = 'D';
271
+ break;
272
+ case 'e': case 'E':
273
+ if (mod == 'b') NOTE.tone = 'e';
274
+ else if (mod == '#') NOTE.tone = 'F';
275
+ else NOTE.tone = 'E';
276
+ break;
277
+ case 'f': case 'F':
278
+ if (mod == 'b') NOTE.tone = 'E';
279
+ else if (mod == '#') NOTE.tone = 'g';
280
+ else NOTE.tone = 'F';
281
+ break;
282
+ case 'g': case 'G':
283
+ if (mod == 'b') NOTE.tone = 'g';
284
+ else if (mod == '#') NOTE.tone = 'a';
285
+ else NOTE.tone = 'G';
286
+ break;
287
+ }
288
+ }
289
+ break;
290
+ case 3:
291
+ #line 91 "c/notation.rl"
292
+ { len = 1; }
293
+ break;
294
+ case 4:
295
+ #line 92 "c/notation.rl"
296
+ { len = 1; }
297
+ break;
298
+ case 5:
299
+ #line 93 "c/notation.rl"
300
+ { mod = p[-1]; }
301
+ break;
302
+ case 6:
303
+ #line 95 "c/notation.rl"
304
+ { tone = p[-1]; }
305
+ break;
306
+ case 9:
307
+ #line 105 "c/notation.rl"
308
+ {te = p+1;}
309
+ break;
310
+ case 10:
311
+ #line 98 "c/notation.rl"
312
+ {te = p;p--;{
313
+ NOTE.tone = 0;
314
+ NEXT();
315
+ }}
316
+ break;
317
+ case 11:
318
+ #line 102 "c/notation.rl"
319
+ {te = p;p--;{ NEXT(); }}
320
+ break;
321
+ case 12:
322
+ #line 103 "c/notation.rl"
323
+ {te = p;p--;{ oct++; len = 4; }}
324
+ break;
325
+ case 13:
326
+ #line 104 "c/notation.rl"
327
+ {te = p;p--;{ oct--; len = 4; }}
328
+ break;
329
+ #line 330 "c/notation.c"
330
+ }
331
+ }
332
+
333
+ _again:
334
+ _acts = _bloopnotes_actions + _bloopnotes_to_state_actions[cs];
335
+ _nacts = (unsigned int) *_acts++;
336
+ while ( _nacts-- > 0 ) {
337
+ switch ( *_acts++ ) {
338
+ case 7:
339
+ #line 1 "c/notation.rl"
340
+ {ts = 0;}
341
+ break;
342
+ #line 343 "c/notation.c"
343
+ }
344
+ }
345
+
346
+ if ( cs == 0 )
347
+ goto _out;
348
+ if ( ++p != pe )
349
+ goto _resume;
350
+ _test_eof: {}
351
+ if ( p == eof )
352
+ {
353
+ if ( _bloopnotes_eof_trans[cs] > 0 ) {
354
+ _trans = _bloopnotes_eof_trans[cs] - 1;
355
+ goto _eof_trans;
356
+ }
357
+ }
358
+
359
+ _out: {}
360
+ }
361
+ #line 128 "c/notation.rl"
362
+
363
+ return S;
364
+ }
365
+
366
+ bloopsatrack *
367
+ bloops_track2(bloops *B, bloopsaphone *P, char *track)
368
+ {
369
+ return bloops_track(B, P, track, strlen(track));
370
+ }
371
+
372
+ char *
373
+ bloops_track_str(bloopsatrack *track)
374
+ {
375
+ char *str = (char *)malloc(sizeof(char) * track->nlen * 6), *ptr = str;
376
+ int i, adv;
377
+
378
+ for (i = 0; i < track->nlen; i++)
379
+ {
380
+ if (ptr > str)
381
+ strcat(ptr++, " ");
382
+
383
+ if (track->notes[i].duration != 4)
384
+ {
385
+ adv = sprintf(ptr, "%d:", (int)track->notes[i].duration);
386
+ ptr += adv;
387
+ }
388
+
389
+ if (track->notes[i].tone)
390
+ {
391
+ char tone[3] = "\0\0\0";
392
+ tone[0] = track->notes[i].tone;
393
+ switch (tone[0]) {
394
+ case 'a': tone[0] = 'A'; tone[1] = 'b'; break;
395
+ case 'b': tone[0] = 'B'; tone[1] = 'b'; break;
396
+ case 'd': tone[0] = 'C'; tone[1] = '#'; break;
397
+ case 'e': tone[0] = 'E'; tone[1] = 'b'; break;
398
+ case 'g': tone[0] = 'F'; tone[1] = '#'; break;
399
+ }
400
+ adv = sprintf(ptr, "%s", tone);
401
+ ptr += adv;
402
+
403
+ adv = sprintf(ptr, "%d", (int)track->notes[i].octave);
404
+ ptr += adv;
405
+ }
406
+ }
407
+
408
+ return str;
409
+ }
410
+
411
+ float
412
+ bloops_note_freq(char note, int octave)
413
+ {
414
+ switch (note)
415
+ {
416
+ case 'A': // A
417
+ if (octave <= 0) return 0.0;
418
+ else if (octave == 1) return 0.121;
419
+ else if (octave == 2) return 0.175;
420
+ else if (octave == 3) return 0.248;
421
+ else if (octave == 4) return 0.353;
422
+ else if (octave == 5) return 0.500;
423
+ break;
424
+
425
+ case 'b': // A# or Bb
426
+ if (octave <= 0) return 0.0;
427
+ else if (octave == 1) return 0.125;
428
+ else if (octave == 2) return 0.181;
429
+ else if (octave == 3) return 0.255;
430
+ else if (octave == 4) return 0.364;
431
+ else if (octave == 5) return 0.515;
432
+ break;
433
+
434
+ case 'B': // B
435
+ if (octave <= 0) return 0.0;
436
+ else if (octave == 1) return 0.129;
437
+ else if (octave == 2) return 0.187;
438
+ else if (octave == 3) return 0.263;
439
+ else if (octave == 4) return 0.374;
440
+ else if (octave == 5) return 0.528;
441
+ break;
442
+
443
+ case 'C': // C
444
+ if (octave <= 1) return 0.0;
445
+ else if (octave == 2) return 0.133;
446
+ else if (octave == 3) return 0.192;
447
+ else if (octave == 4) return 0.271;
448
+ else if (octave == 5) return 0.385;
449
+ else if (octave == 6) return 0.544;
450
+ break;
451
+
452
+ case 'd': // C# or Db
453
+ if (octave <= 1) return 0.0;
454
+ else if (octave == 2) return 0.138;
455
+ else if (octave == 3) return 0.198;
456
+ else if (octave == 4) return 0.279;
457
+ else if (octave == 5) return 0.395;
458
+ else if (octave == 6) return 0.559;
459
+ break;
460
+
461
+ case 'D': // D
462
+ if (octave <= 1) return 0.0;
463
+ else if (octave == 2) return 0.143;
464
+ else if (octave == 3) return 0.202;
465
+ else if (octave == 4) return 0.287;
466
+ else if (octave == 5) return 0.406;
467
+ else if (octave == 6) return 0.575;
468
+ break;
469
+
470
+ case 'e': // D# or Eb
471
+ if (octave <= 1) return 0.0;
472
+ else if (octave == 2) return 0.148;
473
+ else if (octave == 3) return 0.208;
474
+ else if (octave == 4) return 0.296;
475
+ else if (octave == 5) return 0.418;
476
+ else if (octave == 6) return 0.593;
477
+ break;
478
+
479
+ case 'E': // E
480
+ if (octave <= 1) return 0.0;
481
+ else if (octave == 2) return 0.152;
482
+ else if (octave == 3) return 0.214;
483
+ else if (octave == 4) return 0.305;
484
+ else if (octave == 5) return 0.429;
485
+ else if (octave == 6) return 0.608;
486
+ break;
487
+
488
+ case 'F': // F
489
+ if (octave <= 1) return 0.0;
490
+ else if (octave == 2) return 0.155;
491
+ else if (octave == 3) return 0.220;
492
+ else if (octave == 4) return 0.314;
493
+ else if (octave == 5) return 0.441;
494
+ break;
495
+
496
+ case 'g': // F# or Gb
497
+ if (octave <= 1) return 0.0;
498
+ else if (octave == 2) return 0.160;
499
+ else if (octave == 3) return 0.227;
500
+ else if (octave == 4) return 0.323;
501
+ else if (octave == 5) return 0.454;
502
+ break;
503
+
504
+ case 'G': // G
505
+ if (octave <= 1) return 0.0;
506
+ else if (octave == 2) return 0.164;
507
+ else if (octave == 3) return 0.234;
508
+ else if (octave == 4) return 0.332;
509
+ else if (octave == 5) return 0.468;
510
+ break;
511
+
512
+ case 'a': // G# or Ab
513
+ if (octave <= 1) return 0.117;
514
+ else if (octave == 2) return 0.170;
515
+ else if (octave == 3) return 0.242;
516
+ else if (octave == 4) return 0.343;
517
+ else if (octave == 5) return 0.485;
518
+ break;
519
+ }
520
+
521
+ return 0.0;
522
+ }
523
+
524
+ #define KEY(name) key = (void *)&P->name
525
+
526
+
527
+ #line 528 "c/notation.c"
528
+ static const char _bloopserial_actions[] = {
529
+ 0, 1, 0, 1, 1, 1, 2, 1,
530
+ 5, 1, 6, 1, 7, 1, 8, 1,
531
+ 9, 1, 10, 1, 11, 1, 12, 1,
532
+ 13, 1, 14, 1, 15, 1, 16, 1,
533
+ 17, 1, 18, 1, 19, 1, 20, 1,
534
+ 21, 1, 22, 1, 23, 1, 24, 1,
535
+ 25, 1, 26, 1, 27, 1, 29, 1,
536
+ 30, 1, 31, 1, 32, 1, 33, 1,
537
+ 34, 1, 35, 1, 36, 2, 1, 3,
538
+ 2, 1, 35, 2, 4, 28, 3, 1,
539
+ 3, 35
540
+ };
541
+
542
+ static const unsigned char _bloopserial_key_offsets[] = {
543
+ 0, 0, 3, 4, 7, 13, 15, 18,
544
+ 20, 23, 25, 26, 27, 28, 29, 32,
545
+ 33, 34, 35, 36, 39, 41, 42, 43,
546
+ 44, 47, 48, 49, 50, 51, 54, 55,
547
+ 56, 57, 60, 62, 63, 66, 67, 68,
548
+ 69, 70, 73, 76, 77, 78, 79, 82,
549
+ 83, 86, 87, 88, 89, 90, 93, 96,
550
+ 97, 98, 99, 102, 103, 104, 105, 106,
551
+ 109, 110, 111, 112, 115, 116, 118, 119,
552
+ 120, 121, 124, 125, 126, 127, 128, 129,
553
+ 130, 133, 137, 138, 139, 140, 143, 144,
554
+ 145, 146, 147, 150, 151, 152, 153, 154,
555
+ 155, 158, 159, 160, 161, 164, 165, 166,
556
+ 167, 170, 175, 176, 177, 178, 179, 182,
557
+ 183, 184, 185, 186, 187, 188, 189, 190,
558
+ 191, 192, 193, 194, 198, 199, 200, 201,
559
+ 202, 205, 206, 207, 210, 211, 212, 213,
560
+ 214, 217, 218, 219, 220, 221, 224, 237,
561
+ 240, 245, 248
562
+ };
563
+
564
+ static const char _bloopserial_trans_keys[] = {
565
+ 114, 115, 116, 112, 32, 9, 13, 32,
566
+ 45, 9, 13, 48, 57, 48, 57, 46,
567
+ 48, 57, 48, 57, 46, 48, 57, 48,
568
+ 57, 112, 101, 101, 100, 32, 9, 13,
569
+ 116, 97, 99, 107, 32, 9, 13, 101,
570
+ 115, 99, 97, 121, 32, 9, 13, 108,
571
+ 105, 100, 101, 32, 9, 13, 114, 101,
572
+ 113, 32, 9, 13, 112, 115, 102, 32,
573
+ 9, 13, 119, 101, 101, 112, 32, 9,
574
+ 13, 105, 112, 115, 109, 105, 116, 32,
575
+ 9, 13, 102, 32, 9, 13, 119, 101,
576
+ 101, 112, 32, 9, 13, 104, 115, 117,
577
+ 97, 115, 101, 32, 9, 13, 119, 101,
578
+ 101, 112, 32, 9, 13, 110, 99, 104,
579
+ 32, 9, 13, 101, 112, 115, 101, 97,
580
+ 116, 32, 9, 13, 111, 110, 97, 110,
581
+ 99, 101, 32, 9, 13, 108, 113, 117,
582
+ 119, 105, 100, 101, 32, 9, 13, 117,
583
+ 97, 114, 101, 32, 9, 13, 115, 116,
584
+ 97, 105, 110, 32, 9, 13, 101, 101,
585
+ 112, 32, 9, 13, 121, 112, 101, 32,
586
+ 9, 13, 32, 110, 115, 9, 13, 111,
587
+ 105, 115, 101, 97, 105, 113, 119, 116,
588
+ 111, 111, 116, 104, 110, 101, 117, 97,
589
+ 114, 101, 100, 105, 111, 115, 101, 108,
590
+ 97, 121, 32, 9, 13, 98, 101, 32,
591
+ 9, 13, 108, 117, 109, 101, 32, 9,
592
+ 13, 112, 101, 101, 100, 32, 9, 13,
593
+ 32, 97, 100, 102, 104, 108, 112, 114,
594
+ 115, 116, 118, 9, 13, 32, 9, 13,
595
+ 32, 9, 13, 48, 57, 32, 9, 13,
596
+ 32, 9, 13, 48, 57, 0
597
+ };
598
+
599
+ static const char _bloopserial_single_lengths[] = {
600
+ 0, 3, 1, 1, 2, 0, 1, 0,
601
+ 1, 0, 1, 1, 1, 1, 1, 1,
602
+ 1, 1, 1, 1, 2, 1, 1, 1,
603
+ 1, 1, 1, 1, 1, 1, 1, 1,
604
+ 1, 1, 2, 1, 1, 1, 1, 1,
605
+ 1, 1, 3, 1, 1, 1, 1, 1,
606
+ 1, 1, 1, 1, 1, 1, 3, 1,
607
+ 1, 1, 1, 1, 1, 1, 1, 1,
608
+ 1, 1, 1, 1, 1, 2, 1, 1,
609
+ 1, 1, 1, 1, 1, 1, 1, 1,
610
+ 1, 4, 1, 1, 1, 1, 1, 1,
611
+ 1, 1, 1, 1, 1, 1, 1, 1,
612
+ 1, 1, 1, 1, 1, 1, 1, 1,
613
+ 1, 3, 1, 1, 1, 1, 3, 1,
614
+ 1, 1, 1, 1, 1, 1, 1, 1,
615
+ 1, 1, 1, 4, 1, 1, 1, 1,
616
+ 1, 1, 1, 1, 1, 1, 1, 1,
617
+ 1, 1, 1, 1, 1, 1, 11, 1,
618
+ 1, 1, 1
619
+ };
620
+
621
+ static const char _bloopserial_range_lengths[] = {
622
+ 0, 0, 0, 1, 2, 1, 1, 1,
623
+ 1, 1, 0, 0, 0, 0, 1, 0,
624
+ 0, 0, 0, 1, 0, 0, 0, 0,
625
+ 1, 0, 0, 0, 0, 1, 0, 0,
626
+ 0, 1, 0, 0, 1, 0, 0, 0,
627
+ 0, 1, 0, 0, 0, 0, 1, 0,
628
+ 1, 0, 0, 0, 0, 1, 0, 0,
629
+ 0, 0, 1, 0, 0, 0, 0, 1,
630
+ 0, 0, 0, 1, 0, 0, 0, 0,
631
+ 0, 1, 0, 0, 0, 0, 0, 0,
632
+ 1, 0, 0, 0, 0, 1, 0, 0,
633
+ 0, 0, 1, 0, 0, 0, 0, 0,
634
+ 1, 0, 0, 0, 1, 0, 0, 0,
635
+ 1, 1, 0, 0, 0, 0, 0, 0,
636
+ 0, 0, 0, 0, 0, 0, 0, 0,
637
+ 0, 0, 0, 0, 0, 0, 0, 0,
638
+ 1, 0, 0, 1, 0, 0, 0, 0,
639
+ 1, 0, 0, 0, 0, 1, 1, 1,
640
+ 2, 1, 2
641
+ };
642
+
643
+ static const short _bloopserial_index_offsets[] = {
644
+ 0, 0, 4, 6, 9, 14, 16, 19,
645
+ 21, 24, 26, 28, 30, 32, 34, 37,
646
+ 39, 41, 43, 45, 48, 51, 53, 55,
647
+ 57, 60, 62, 64, 66, 68, 71, 73,
648
+ 75, 77, 80, 83, 85, 88, 90, 92,
649
+ 94, 96, 99, 103, 105, 107, 109, 112,
650
+ 114, 117, 119, 121, 123, 125, 128, 132,
651
+ 134, 136, 138, 141, 143, 145, 147, 149,
652
+ 152, 154, 156, 158, 161, 163, 166, 168,
653
+ 170, 172, 175, 177, 179, 181, 183, 185,
654
+ 187, 190, 195, 197, 199, 201, 204, 206,
655
+ 208, 210, 212, 215, 217, 219, 221, 223,
656
+ 225, 228, 230, 232, 234, 237, 239, 241,
657
+ 243, 246, 251, 253, 255, 257, 259, 263,
658
+ 265, 267, 269, 271, 273, 275, 277, 279,
659
+ 281, 283, 285, 287, 292, 294, 296, 298,
660
+ 300, 303, 305, 307, 310, 312, 314, 316,
661
+ 318, 321, 323, 325, 327, 329, 332, 345,
662
+ 348, 352, 355
663
+ };
664
+
665
+ static const unsigned char _bloopserial_trans_targs[] = {
666
+ 2, 10, 15, 0, 3, 0, 4, 4,
667
+ 0, 4, 5, 4, 8, 0, 6, 0,
668
+ 7, 6, 0, 144, 0, 9, 8, 0,
669
+ 146, 0, 11, 0, 12, 0, 13, 0,
670
+ 14, 0, 4, 4, 0, 16, 0, 17,
671
+ 0, 18, 0, 19, 0, 4, 4, 0,
672
+ 21, 25, 0, 22, 0, 23, 0, 24,
673
+ 0, 4, 4, 0, 26, 0, 27, 0,
674
+ 28, 0, 29, 0, 4, 4, 0, 31,
675
+ 0, 32, 0, 33, 0, 4, 4, 0,
676
+ 35, 37, 0, 36, 0, 4, 4, 0,
677
+ 38, 0, 39, 0, 40, 0, 41, 0,
678
+ 4, 4, 0, 43, 47, 49, 0, 44,
679
+ 0, 45, 0, 46, 0, 4, 4, 0,
680
+ 48, 0, 4, 4, 0, 50, 0, 51,
681
+ 0, 52, 0, 53, 0, 4, 4, 0,
682
+ 55, 59, 64, 0, 56, 0, 57, 0,
683
+ 58, 0, 4, 4, 0, 60, 0, 61,
684
+ 0, 62, 0, 63, 0, 4, 4, 0,
685
+ 65, 0, 66, 0, 67, 0, 4, 4,
686
+ 0, 69, 0, 70, 74, 0, 71, 0,
687
+ 72, 0, 73, 0, 4, 4, 0, 75,
688
+ 0, 76, 0, 77, 0, 78, 0, 79,
689
+ 0, 80, 0, 4, 4, 0, 82, 86,
690
+ 91, 97, 0, 83, 0, 84, 0, 85,
691
+ 0, 4, 4, 0, 87, 0, 88, 0,
692
+ 89, 0, 90, 0, 4, 4, 0, 92,
693
+ 0, 93, 0, 94, 0, 95, 0, 96,
694
+ 0, 4, 4, 0, 98, 0, 99, 0,
695
+ 100, 0, 4, 4, 0, 102, 0, 103,
696
+ 0, 104, 0, 105, 105, 0, 105, 106,
697
+ 110, 105, 0, 107, 0, 108, 0, 109,
698
+ 0, 142, 0, 111, 117, 119, 0, 112,
699
+ 0, 113, 0, 114, 0, 115, 0, 116,
700
+ 0, 142, 0, 118, 0, 142, 0, 120,
701
+ 0, 121, 0, 122, 0, 142, 0, 124,
702
+ 129, 132, 137, 0, 125, 0, 126, 0,
703
+ 127, 0, 128, 0, 4, 4, 0, 130,
704
+ 0, 131, 0, 4, 4, 0, 133, 0,
705
+ 134, 0, 135, 0, 136, 0, 4, 4,
706
+ 0, 138, 0, 139, 0, 140, 0, 141,
707
+ 0, 4, 4, 0, 143, 1, 20, 30,
708
+ 34, 42, 54, 68, 81, 101, 123, 143,
709
+ 0, 143, 143, 142, 145, 145, 144, 142,
710
+ 145, 145, 142, 145, 145, 146, 142, 142,
711
+ 142, 142, 142, 0
712
+ };
713
+
714
+ static const char _bloopserial_trans_actions[] = {
715
+ 0, 0, 0, 0, 0, 0, 7, 7,
716
+ 0, 0, 0, 0, 0, 0, 0, 0,
717
+ 1, 0, 0, 5, 0, 1, 0, 0,
718
+ 5, 0, 0, 0, 0, 0, 0, 0,
719
+ 0, 0, 9, 9, 0, 0, 0, 0,
720
+ 0, 0, 0, 0, 0, 11, 11, 0,
721
+ 0, 0, 0, 0, 0, 0, 0, 0,
722
+ 0, 13, 13, 0, 0, 0, 0, 0,
723
+ 0, 0, 0, 0, 15, 15, 0, 0,
724
+ 0, 0, 0, 0, 0, 17, 17, 0,
725
+ 0, 0, 0, 0, 0, 19, 19, 0,
726
+ 0, 0, 0, 0, 0, 0, 0, 0,
727
+ 21, 21, 0, 0, 0, 0, 0, 0,
728
+ 0, 0, 0, 0, 0, 23, 23, 0,
729
+ 0, 0, 25, 25, 0, 0, 0, 0,
730
+ 0, 0, 0, 0, 0, 27, 27, 0,
731
+ 0, 0, 0, 0, 0, 0, 0, 0,
732
+ 0, 0, 29, 29, 0, 0, 0, 0,
733
+ 0, 0, 0, 0, 0, 31, 31, 0,
734
+ 0, 0, 0, 0, 0, 0, 45, 45,
735
+ 0, 0, 0, 0, 0, 0, 0, 0,
736
+ 0, 0, 0, 0, 33, 33, 0, 0,
737
+ 0, 0, 0, 0, 0, 0, 0, 0,
738
+ 0, 0, 0, 35, 35, 0, 0, 0,
739
+ 0, 0, 0, 0, 0, 0, 0, 0,
740
+ 0, 37, 37, 0, 0, 0, 0, 0,
741
+ 0, 0, 0, 0, 39, 39, 0, 0,
742
+ 0, 0, 0, 0, 0, 0, 0, 0,
743
+ 0, 41, 41, 0, 0, 0, 0, 0,
744
+ 0, 0, 43, 43, 0, 0, 0, 0,
745
+ 0, 0, 0, 0, 0, 0, 0, 0,
746
+ 0, 0, 0, 0, 0, 0, 0, 0,
747
+ 0, 63, 0, 0, 0, 0, 0, 0,
748
+ 0, 0, 0, 0, 0, 0, 0, 0,
749
+ 0, 59, 0, 0, 0, 61, 0, 0,
750
+ 0, 0, 0, 0, 0, 57, 0, 0,
751
+ 0, 0, 0, 0, 0, 0, 0, 0,
752
+ 0, 0, 0, 0, 51, 51, 0, 0,
753
+ 0, 0, 0, 47, 47, 0, 0, 0,
754
+ 0, 0, 0, 0, 0, 0, 75, 75,
755
+ 0, 0, 0, 0, 0, 0, 0, 0,
756
+ 0, 49, 49, 0, 0, 0, 0, 0,
757
+ 0, 0, 0, 0, 0, 0, 0, 0,
758
+ 0, 0, 0, 67, 69, 69, 0, 78,
759
+ 0, 0, 65, 3, 3, 0, 72, 67,
760
+ 78, 65, 72, 0
761
+ };
762
+
763
+ static const char _bloopserial_to_state_actions[] = {
764
+ 0, 0, 0, 0, 0, 0, 0, 0,
765
+ 0, 0, 0, 0, 0, 0, 0, 0,
766
+ 0, 0, 0, 0, 0, 0, 0, 0,
767
+ 0, 0, 0, 0, 0, 0, 0, 0,
768
+ 0, 0, 0, 0, 0, 0, 0, 0,
769
+ 0, 0, 0, 0, 0, 0, 0, 0,
770
+ 0, 0, 0, 0, 0, 0, 0, 0,
771
+ 0, 0, 0, 0, 0, 0, 0, 0,
772
+ 0, 0, 0, 0, 0, 0, 0, 0,
773
+ 0, 0, 0, 0, 0, 0, 0, 0,
774
+ 0, 0, 0, 0, 0, 0, 0, 0,
775
+ 0, 0, 0, 0, 0, 0, 0, 0,
776
+ 0, 0, 0, 0, 0, 0, 0, 0,
777
+ 0, 0, 0, 0, 0, 0, 0, 0,
778
+ 0, 0, 0, 0, 0, 0, 0, 0,
779
+ 0, 0, 0, 0, 0, 0, 0, 0,
780
+ 0, 0, 0, 0, 0, 0, 0, 0,
781
+ 0, 0, 0, 0, 0, 0, 53, 0,
782
+ 0, 0, 0
783
+ };
784
+
785
+ static const char _bloopserial_from_state_actions[] = {
786
+ 0, 0, 0, 0, 0, 0, 0, 0,
787
+ 0, 0, 0, 0, 0, 0, 0, 0,
788
+ 0, 0, 0, 0, 0, 0, 0, 0,
789
+ 0, 0, 0, 0, 0, 0, 0, 0,
790
+ 0, 0, 0, 0, 0, 0, 0, 0,
791
+ 0, 0, 0, 0, 0, 0, 0, 0,
792
+ 0, 0, 0, 0, 0, 0, 0, 0,
793
+ 0, 0, 0, 0, 0, 0, 0, 0,
794
+ 0, 0, 0, 0, 0, 0, 0, 0,
795
+ 0, 0, 0, 0, 0, 0, 0, 0,
796
+ 0, 0, 0, 0, 0, 0, 0, 0,
797
+ 0, 0, 0, 0, 0, 0, 0, 0,
798
+ 0, 0, 0, 0, 0, 0, 0, 0,
799
+ 0, 0, 0, 0, 0, 0, 0, 0,
800
+ 0, 0, 0, 0, 0, 0, 0, 0,
801
+ 0, 0, 0, 0, 0, 0, 0, 0,
802
+ 0, 0, 0, 0, 0, 0, 0, 0,
803
+ 0, 0, 0, 0, 0, 0, 55, 0,
804
+ 0, 0, 0
805
+ };
806
+
807
+ static const short _bloopserial_eof_trans[] = {
808
+ 0, 0, 0, 0, 0, 0, 0, 0,
809
+ 0, 0, 0, 0, 0, 0, 0, 0,
810
+ 0, 0, 0, 0, 0, 0, 0, 0,
811
+ 0, 0, 0, 0, 0, 0, 0, 0,
812
+ 0, 0, 0, 0, 0, 0, 0, 0,
813
+ 0, 0, 0, 0, 0, 0, 0, 0,
814
+ 0, 0, 0, 0, 0, 0, 0, 0,
815
+ 0, 0, 0, 0, 0, 0, 0, 0,
816
+ 0, 0, 0, 0, 0, 0, 0, 0,
817
+ 0, 0, 0, 0, 0, 0, 0, 0,
818
+ 0, 0, 0, 0, 0, 0, 0, 0,
819
+ 0, 0, 0, 0, 0, 0, 0, 0,
820
+ 0, 0, 0, 0, 0, 0, 0, 0,
821
+ 0, 0, 0, 0, 0, 0, 0, 0,
822
+ 0, 0, 0, 0, 0, 0, 0, 0,
823
+ 0, 0, 0, 0, 0, 0, 0, 0,
824
+ 0, 0, 0, 0, 0, 0, 0, 0,
825
+ 0, 0, 0, 0, 0, 0, 0, 360,
826
+ 361, 362, 363
827
+ };
828
+
829
+ static const int bloopserial_start = 142;
830
+ static const int bloopserial_error = 0;
831
+
832
+ static const int bloopserial_en_main = 142;
833
+
834
+ #line 345 "c/notation.rl"
835
+
836
+
837
+ bloopsaphone *
838
+ bloops_sound_file(bloops *B, char *fname)
839
+ {
840
+ FILE *fp;
841
+ struct stat stats;
842
+ int cs, act, len;
843
+ float fval;
844
+ void *key;
845
+ char *str, *p, *pe, *pf, *ts, *te, *eof = 0;
846
+ bloopsaphone *P;
847
+
848
+ if (stat(fname, &stats) == -1)
849
+ return NULL;
850
+
851
+ fp = fopen(fname, "rb");
852
+ if (!fp)
853
+ return NULL;
854
+
855
+ len = stats.st_size;
856
+ str = (char *)malloc(stats.st_size + 1);
857
+ if (fread(str, 1, stats.st_size, fp) != stats.st_size)
858
+ goto done;
859
+
860
+ p = str;
861
+ pe = str + len + 1;
862
+ p[len] = '\0';
863
+
864
+ P = bloops_square();
865
+
866
+ #line 867 "c/notation.c"
867
+ {
868
+ cs = bloopserial_start;
869
+ ts = 0;
870
+ te = 0;
871
+ act = 0;
872
+ }
873
+ #line 376 "c/notation.rl"
874
+
875
+ #line 876 "c/notation.c"
876
+ {
877
+ int _klen;
878
+ unsigned int _trans;
879
+ const char *_acts;
880
+ unsigned int _nacts;
881
+ const char *_keys;
882
+
883
+ if ( p == pe )
884
+ goto _test_eof;
885
+ if ( cs == 0 )
886
+ goto _out;
887
+ _resume:
888
+ _acts = _bloopserial_actions + _bloopserial_from_state_actions[cs];
889
+ _nacts = (unsigned int) *_acts++;
890
+ while ( _nacts-- > 0 ) {
891
+ switch ( *_acts++ ) {
892
+ case 30:
893
+ #line 1 "c/notation.rl"
894
+ {ts = p;}
895
+ break;
896
+ #line 897 "c/notation.c"
897
+ }
898
+ }
899
+
900
+ _keys = _bloopserial_trans_keys + _bloopserial_key_offsets[cs];
901
+ _trans = _bloopserial_index_offsets[cs];
902
+
903
+ _klen = _bloopserial_single_lengths[cs];
904
+ if ( _klen > 0 ) {
905
+ const char *_lower = _keys;
906
+ const char *_mid;
907
+ const char *_upper = _keys + _klen - 1;
908
+ while (1) {
909
+ if ( _upper < _lower )
910
+ break;
911
+
912
+ _mid = _lower + ((_upper-_lower) >> 1);
913
+ if ( (*p) < *_mid )
914
+ _upper = _mid - 1;
915
+ else if ( (*p) > *_mid )
916
+ _lower = _mid + 1;
917
+ else {
918
+ _trans += (_mid - _keys);
919
+ goto _match;
920
+ }
921
+ }
922
+ _keys += _klen;
923
+ _trans += _klen;
924
+ }
925
+
926
+ _klen = _bloopserial_range_lengths[cs];
927
+ if ( _klen > 0 ) {
928
+ const char *_lower = _keys;
929
+ const char *_mid;
930
+ const char *_upper = _keys + (_klen<<1) - 2;
931
+ while (1) {
932
+ if ( _upper < _lower )
933
+ break;
934
+
935
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
936
+ if ( (*p) < _mid[0] )
937
+ _upper = _mid - 2;
938
+ else if ( (*p) > _mid[1] )
939
+ _lower = _mid + 2;
940
+ else {
941
+ _trans += ((_mid - _keys)>>1);
942
+ goto _match;
943
+ }
944
+ }
945
+ _trans += _klen;
946
+ }
947
+
948
+ _match:
949
+ _eof_trans:
950
+ cs = _bloopserial_trans_targs[_trans];
951
+
952
+ if ( _bloopserial_trans_actions[_trans] == 0 )
953
+ goto _again;
954
+
955
+ _acts = _bloopserial_actions + _bloopserial_trans_actions[_trans];
956
+ _nacts = (unsigned int) *_acts++;
957
+ while ( _nacts-- > 0 )
958
+ {
959
+ switch ( *_acts++ )
960
+ {
961
+ case 0:
962
+ #line 299 "c/notation.rl"
963
+ {
964
+ fval = ATOI(ts, p - ts) * 1.0f;
965
+ }
966
+ break;
967
+ case 1:
968
+ #line 303 "c/notation.rl"
969
+ {
970
+ fval = ATOI(pf, p - pf) * pow(0.1f, p - pf);
971
+ }
972
+ break;
973
+ case 2:
974
+ #line 307 "c/notation.rl"
975
+ { pf = p; }
976
+ break;
977
+ case 3:
978
+ #line 308 "c/notation.rl"
979
+ { fval *= -1.0f; }
980
+ break;
981
+ case 4:
982
+ #line 309 "c/notation.rl"
983
+ { KEY(volume); }
984
+ break;
985
+ case 5:
986
+ #line 310 "c/notation.rl"
987
+ { KEY(arp); }
988
+ break;
989
+ case 6:
990
+ #line 311 "c/notation.rl"
991
+ { KEY(aspeed); }
992
+ break;
993
+ case 7:
994
+ #line 312 "c/notation.rl"
995
+ { KEY(attack); }
996
+ break;
997
+ case 8:
998
+ #line 313 "c/notation.rl"
999
+ { KEY(decay); }
1000
+ break;
1001
+ case 9:
1002
+ #line 314 "c/notation.rl"
1003
+ { KEY(dslide); }
1004
+ break;
1005
+ case 10:
1006
+ #line 315 "c/notation.rl"
1007
+ { KEY(freq); }
1008
+ break;
1009
+ case 11:
1010
+ #line 316 "c/notation.rl"
1011
+ { KEY(hpf); }
1012
+ break;
1013
+ case 12:
1014
+ #line 317 "c/notation.rl"
1015
+ { KEY(hsweep); }
1016
+ break;
1017
+ case 13:
1018
+ #line 318 "c/notation.rl"
1019
+ { KEY(limit); }
1020
+ break;
1021
+ case 14:
1022
+ #line 319 "c/notation.rl"
1023
+ { KEY(lpf); }
1024
+ break;
1025
+ case 15:
1026
+ #line 320 "c/notation.rl"
1027
+ { KEY(lsweep); }
1028
+ break;
1029
+ case 16:
1030
+ #line 321 "c/notation.rl"
1031
+ { KEY(phase); }
1032
+ break;
1033
+ case 17:
1034
+ #line 322 "c/notation.rl"
1035
+ { KEY(psweep); }
1036
+ break;
1037
+ case 18:
1038
+ #line 323 "c/notation.rl"
1039
+ { KEY(repeat); }
1040
+ break;
1041
+ case 19:
1042
+ #line 324 "c/notation.rl"
1043
+ { KEY(resonance); }
1044
+ break;
1045
+ case 20:
1046
+ #line 325 "c/notation.rl"
1047
+ { KEY(slide); }
1048
+ break;
1049
+ case 21:
1050
+ #line 326 "c/notation.rl"
1051
+ { KEY(square); }
1052
+ break;
1053
+ case 22:
1054
+ #line 327 "c/notation.rl"
1055
+ { KEY(sustain); }
1056
+ break;
1057
+ case 23:
1058
+ #line 328 "c/notation.rl"
1059
+ { KEY(sweep); }
1060
+ break;
1061
+ case 24:
1062
+ #line 329 "c/notation.rl"
1063
+ { KEY(punch); }
1064
+ break;
1065
+ case 25:
1066
+ #line 330 "c/notation.rl"
1067
+ { KEY(vibe); }
1068
+ break;
1069
+ case 26:
1070
+ #line 331 "c/notation.rl"
1071
+ { KEY(vspeed); }
1072
+ break;
1073
+ case 27:
1074
+ #line 332 "c/notation.rl"
1075
+ { KEY(vdelay); }
1076
+ break;
1077
+ case 28:
1078
+ #line 333 "c/notation.rl"
1079
+ { KEY(volume); }
1080
+ break;
1081
+ case 31:
1082
+ #line 337 "c/notation.rl"
1083
+ {te = p+1;{ P->type = BLOOPS_SQUARE; }}
1084
+ break;
1085
+ case 32:
1086
+ #line 338 "c/notation.rl"
1087
+ {te = p+1;{ P->type = BLOOPS_SAWTOOTH; }}
1088
+ break;
1089
+ case 33:
1090
+ #line 339 "c/notation.rl"
1091
+ {te = p+1;{ P->type = BLOOPS_SINE; }}
1092
+ break;
1093
+ case 34:
1094
+ #line 340 "c/notation.rl"
1095
+ {te = p+1;{ P->type = BLOOPS_NOISE; }}
1096
+ break;
1097
+ case 35:
1098
+ #line 336 "c/notation.rl"
1099
+ {te = p;p--;{ *((float *)key) = fval; }}
1100
+ break;
1101
+ case 36:
1102
+ #line 341 "c/notation.rl"
1103
+ {te = p;p--;}
1104
+ break;
1105
+ #line 1106 "c/notation.c"
1106
+ }
1107
+ }
1108
+
1109
+ _again:
1110
+ _acts = _bloopserial_actions + _bloopserial_to_state_actions[cs];
1111
+ _nacts = (unsigned int) *_acts++;
1112
+ while ( _nacts-- > 0 ) {
1113
+ switch ( *_acts++ ) {
1114
+ case 29:
1115
+ #line 1 "c/notation.rl"
1116
+ {ts = 0;}
1117
+ break;
1118
+ #line 1119 "c/notation.c"
1119
+ }
1120
+ }
1121
+
1122
+ if ( cs == 0 )
1123
+ goto _out;
1124
+ if ( ++p != pe )
1125
+ goto _resume;
1126
+ _test_eof: {}
1127
+ if ( p == eof )
1128
+ {
1129
+ if ( _bloopserial_eof_trans[cs] > 0 ) {
1130
+ _trans = _bloopserial_eof_trans[cs] - 1;
1131
+ goto _eof_trans;
1132
+ }
1133
+ }
1134
+
1135
+ _out: {}
1136
+ }
1137
+ #line 377 "c/notation.rl"
1138
+
1139
+ done:
1140
+ fclose(fp);
1141
+ return P;
1142
+ }
1143
+
1144
+ char *
1145
+ bloops_sound_str(bloops *B, bloopsaphone *P)
1146
+ {
1147
+ char *lines = (char *)malloc(4096), *str = lines;
1148
+ bloopsaphone *sq = bloops_square();
1149
+ if (P->type == BLOOPS_SQUARE)
1150
+ str += sprintf(str, "type square\n");
1151
+ else if (P->type == BLOOPS_SAWTOOTH)
1152
+ str += sprintf(str, "type sawtooth\n");
1153
+ else if (P->type == BLOOPS_SINE)
1154
+ str += sprintf(str, "type sine\n");
1155
+ else if (P->type == BLOOPS_NOISE)
1156
+ str += sprintf(str, "type noise\n");
1157
+
1158
+ if (P->volume != sq->volume)
1159
+ str += sprintf(str, "volume %0.3f\n", P->volume);
1160
+ if (P->punch != sq->punch)
1161
+ str += sprintf(str, "punch %0.3f\n", P->punch);
1162
+ if (P->attack != sq->attack)
1163
+ str += sprintf(str, "attack %0.3f\n", P->attack);
1164
+ if (P->sustain != sq->sustain)
1165
+ str += sprintf(str, "sustain %0.3f\n", P->sustain);
1166
+ if (P->decay != sq->decay)
1167
+ str += sprintf(str, "decay %0.3f\n", P->decay);
1168
+ if (P->freq != sq->freq)
1169
+ str += sprintf(str, "freq %0.3f\n", P->freq);
1170
+ if (P->limit != sq->limit)
1171
+ str += sprintf(str, "limit %0.3f\n", P->limit);
1172
+ if (P->slide != sq->slide)
1173
+ str += sprintf(str, "slide %0.3f\n", P->slide);
1174
+ if (P->dslide != sq->dslide)
1175
+ str += sprintf(str, "dslide %0.3f\n", P->dslide);
1176
+ if (P->square != sq->square)
1177
+ str += sprintf(str, "square %0.3f\n", P->square);
1178
+ if (P->sweep != sq->sweep)
1179
+ str += sprintf(str, "sweep %0.3f\n", P->sweep);
1180
+ if (P->vibe != sq->vibe)
1181
+ str += sprintf(str, "vibe %0.3f\n", P->vibe);
1182
+ if (P->vspeed != sq->vspeed)
1183
+ str += sprintf(str, "vspeed %0.3f\n", P->vspeed);
1184
+ if (P->vdelay != sq->vdelay)
1185
+ str += sprintf(str, "vdelay %0.3f\n", P->vdelay);
1186
+ if (P->lpf != sq->lpf)
1187
+ str += sprintf(str, "lpf %0.3f\n", P->lpf);
1188
+ if (P->lsweep != sq->lsweep)
1189
+ str += sprintf(str, "lsweep %0.3f\n", P->lsweep);
1190
+ if (P->resonance != sq->resonance)
1191
+ str += sprintf(str, "resonance %0.3f\n", P->resonance);
1192
+ if (P->hpf != sq->hpf)
1193
+ str += sprintf(str, "hpf %0.3f\n", P->hpf);
1194
+ if (P->hsweep != sq->hsweep)
1195
+ str += sprintf(str, "hsweep %0.3f\n", P->hsweep);
1196
+ if (P->arp != sq->arp)
1197
+ str += sprintf(str, "arp %0.3f\n", P->arp);
1198
+ if (P->aspeed != sq->aspeed)
1199
+ str += sprintf(str, "aspeed %0.3f\n", P->aspeed);
1200
+ if (P->phase != sq->phase)
1201
+ str += sprintf(str, "phase %0.3f\n", P->phase);
1202
+ if (P->psweep != sq->psweep)
1203
+ str += sprintf(str, "psweep %0.3f\n", P->psweep);
1204
+ if (P->repeat != sq->repeat)
1205
+ str += sprintf(str, "repeat %0.3f\n", P->repeat);
1206
+
1207
+ free(sq);
1208
+ return lines;
1209
+ }