bloops 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/COPYING +27 -0
- data/Makefile +60 -0
- data/README +172 -0
- data/c/bloopsaphone-internal.h +46 -0
- data/c/bloopsaphone.c +596 -0
- data/c/bloopsaphone.h +154 -0
- data/c/bloopsawhat.c +38 -0
- data/c/notation.c +1656 -0
- data/c/notation.rl +549 -0
- data/ext/ruby/extconf.rb +15 -0
- data/ext/ruby/rubyext.c +332 -0
- data/ext/ruby/test.rb +41 -0
- data/ext/ruby/test_load.rb +25 -0
- data/ext/ruby/tune_cheeky_drat.rb +210 -0
- data/ext/ruby/tune_warp.rb +408 -0
- data/misc/Makefile-dll +91 -0
- data/sounds/dart.blu +10 -0
- data/sounds/error.blu +13 -0
- data/sounds/ice.blu +5 -0
- data/sounds/jump.blu +8 -0
- data/sounds/pogo.blu +19 -0
- data/sounds/stun.blu +6 -0
- metadata +66 -0
data/c/bloopsaphone.h
ADDED
@@ -0,0 +1,154 @@
|
|
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
|
+
typedef enum {
|
11
|
+
BLOOPS_STOP = 0,
|
12
|
+
BLOOPS_PLAY = 1
|
13
|
+
} bloopsastate;
|
14
|
+
|
15
|
+
typedef enum {
|
16
|
+
BLOOPS_SQUARE = 0,
|
17
|
+
BLOOPS_SAWTOOTH = 1,
|
18
|
+
BLOOPS_SINE = 2,
|
19
|
+
BLOOPS_NOISE = 3
|
20
|
+
} bloopswaveform;
|
21
|
+
|
22
|
+
typedef enum {
|
23
|
+
BLOOPS_FX_VOLUME = 0,
|
24
|
+
BLOOPS_FX_PUNCH = 1,
|
25
|
+
BLOOPS_FX_ATTACK = 2,
|
26
|
+
BLOOPS_FX_SUSTAIN = 3,
|
27
|
+
BLOOPS_FX_DECAY = 4,
|
28
|
+
BLOOPS_FX_SWEEP = 5,
|
29
|
+
BLOOPS_FX_SQUARE = 6,
|
30
|
+
BLOOPS_FX_VIBE = 7,
|
31
|
+
BLOOPS_FX_VSPEED = 8,
|
32
|
+
BLOOPS_FX_VDELAY = 9,
|
33
|
+
BLOOPS_FX_LPF = 10,
|
34
|
+
BLOOPS_FX_LSWEEP = 11,
|
35
|
+
BLOOPS_FX_RESONANCE = 12,
|
36
|
+
BLOOPS_FX_HPF = 13,
|
37
|
+
BLOOPS_FX_HSWEEP = 14,
|
38
|
+
BLOOPS_FX_ARP = 15,
|
39
|
+
BLOOPS_FX_ASPEED = 16,
|
40
|
+
BLOOPS_FX_PHASE = 17,
|
41
|
+
BLOOPS_FX_PSWEEP = 18,
|
42
|
+
BLOOPS_FX_REPEAT = 19
|
43
|
+
} bloopsafxcmd;
|
44
|
+
|
45
|
+
typedef struct {
|
46
|
+
bloopswaveform type;
|
47
|
+
unsigned char pan;
|
48
|
+
float volume;
|
49
|
+
float punch;
|
50
|
+
float attack;
|
51
|
+
float sustain;
|
52
|
+
float decay;
|
53
|
+
float freq, limit, slide, dslide; // pitch
|
54
|
+
float square, sweep; // square wave
|
55
|
+
float vibe, vspeed, vdelay; // vibrato
|
56
|
+
float lpf, lsweep, resonance, hpf, hsweep;
|
57
|
+
// hi-pass, lo-pass
|
58
|
+
float arp, aspeed; // arpeggiator
|
59
|
+
float phase, psweep; // phaser
|
60
|
+
float repeat; // repeats?
|
61
|
+
} bloopsaparams;
|
62
|
+
|
63
|
+
typedef struct {
|
64
|
+
unsigned refcount;
|
65
|
+
bloopsaparams params;
|
66
|
+
} bloopsaphone;
|
67
|
+
|
68
|
+
#define BLOOPS_HI_OCTAVE 8
|
69
|
+
|
70
|
+
typedef struct bloopsafx_tag {
|
71
|
+
bloopsafxcmd cmd;
|
72
|
+
float val;
|
73
|
+
char mod;
|
74
|
+
struct bloopsafx_tag *next;
|
75
|
+
} bloopsafx;
|
76
|
+
|
77
|
+
typedef struct {
|
78
|
+
char tone, octave, duration;
|
79
|
+
bloopsafx *FX;
|
80
|
+
} bloopsanote;
|
81
|
+
|
82
|
+
typedef struct {
|
83
|
+
unsigned refcount;
|
84
|
+
int nlen, capa;
|
85
|
+
bloopsanote *notes;
|
86
|
+
bloopsaparams params;
|
87
|
+
} bloopsatrack;
|
88
|
+
|
89
|
+
typedef struct {
|
90
|
+
bloopsatrack *track;
|
91
|
+
bloopsaparams params;
|
92
|
+
int frames, nextnote[2];
|
93
|
+
float volume, freq;
|
94
|
+
bloopsastate state;
|
95
|
+
int stage, time, length[3];
|
96
|
+
double period, maxperiod, slide, dslide;
|
97
|
+
float square, sweep;
|
98
|
+
int phase, iphase, phasex;
|
99
|
+
float fphase, dphase;
|
100
|
+
float phaser[1024];
|
101
|
+
float noise[32];
|
102
|
+
float filter[8];
|
103
|
+
float vibe, vspeed, vdelay;
|
104
|
+
int repeat, limit;
|
105
|
+
double arp;
|
106
|
+
int atime, alimit;
|
107
|
+
} bloopsavoice;
|
108
|
+
|
109
|
+
#define BLOOPS_MAX_TRACKS 64
|
110
|
+
#define BLOOPS_MAX_CHANNELS 64
|
111
|
+
|
112
|
+
typedef struct {
|
113
|
+
unsigned refcount;
|
114
|
+
int tempo;
|
115
|
+
float volume;
|
116
|
+
bloopsavoice voices[BLOOPS_MAX_TRACKS];
|
117
|
+
bloopsastate state;
|
118
|
+
} bloops;
|
119
|
+
|
120
|
+
typedef struct {
|
121
|
+
bloops *B[BLOOPS_MAX_CHANNELS];
|
122
|
+
void *stream;
|
123
|
+
} bloopsmix;
|
124
|
+
|
125
|
+
//
|
126
|
+
// the api
|
127
|
+
//
|
128
|
+
bloops *bloops_new();
|
129
|
+
void bloops_ref(bloops *);
|
130
|
+
void bloops_destroy(bloops *);
|
131
|
+
|
132
|
+
void bloops_clear(bloops *);
|
133
|
+
void bloops_tempo(bloops *, int tempo);
|
134
|
+
void bloops_play(bloops *);
|
135
|
+
void bloops_stop(bloops *);
|
136
|
+
int bloops_is_done(bloops *);
|
137
|
+
|
138
|
+
bloopsatrack *bloops_track(bloops *, bloopsaphone *, char *, int);
|
139
|
+
bloopsatrack *bloops_track2(bloops *, bloopsaphone *, char *);
|
140
|
+
void bloops_track_ref(bloopsatrack *);
|
141
|
+
void bloops_track_destroy(bloopsatrack *);
|
142
|
+
|
143
|
+
bloopsaphone *bloops_square();
|
144
|
+
bloopsaphone *bloops_sound_file(bloops *, char *);
|
145
|
+
void bloops_sound_copy(bloopsaphone *, bloopsaphone const *);
|
146
|
+
void bloops_sound_ref(bloopsaphone *);
|
147
|
+
void bloops_sound_destroy(bloopsaphone *);
|
148
|
+
|
149
|
+
char *bloops_track_str(bloopsatrack *);
|
150
|
+
char *bloops_fxcmd_name(bloopsafxcmd fxcmd);
|
151
|
+
float bloops_note_freq(char, int);
|
152
|
+
char *bloops_sound_str(bloopsaphone *);
|
153
|
+
|
154
|
+
#endif
|
data/c/bloopsawhat.c
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
//
|
2
|
+
// bloopsawhat.c
|
3
|
+
// a simple commandline player
|
4
|
+
//
|
5
|
+
#include <stdio.h>
|
6
|
+
#include <stdlib.h>
|
7
|
+
#include <unistd.h>
|
8
|
+
#include "bloopsaphone.h"
|
9
|
+
|
10
|
+
static void
|
11
|
+
usage()
|
12
|
+
{
|
13
|
+
printf("usage: bloopsawhat notes\n"
|
14
|
+
" (ex.: bloopsawhat \"a b c d e f g + a b c\"\n");
|
15
|
+
}
|
16
|
+
|
17
|
+
int
|
18
|
+
main(int argc, char *argv[])
|
19
|
+
{
|
20
|
+
char *str;
|
21
|
+
if (argc > 1) {
|
22
|
+
bloops *B = bloops_new();
|
23
|
+
bloopsaphone *P = bloops_square();
|
24
|
+
bloopsatrack *track = bloops_track2(B, P, argv[1]);
|
25
|
+
bloops_sound_destroy(P);
|
26
|
+
printf("%s\n", str = bloops_track_str(track));
|
27
|
+
bloops_play(B);
|
28
|
+
while (!bloops_is_done(B))
|
29
|
+
sleep(1);
|
30
|
+
free(str);
|
31
|
+
bloops_track_destroy(track);
|
32
|
+
bloops_destroy(B);
|
33
|
+
return 0;
|
34
|
+
}
|
35
|
+
|
36
|
+
usage();
|
37
|
+
return 0;
|
38
|
+
}
|