-
Notifications
You must be signed in to change notification settings - Fork 3
/
modeFuncs.ino
279 lines (235 loc) · 4.94 KB
/
modeFuncs.ino
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
void musicbox() {
if (bools.firstRun) { //one time code
xMode = 0;
bools.disablePortB = false;
bools.play = true;
bools.firstRun = false;
//bools.ownBeat = false;
bools.allowHHSeqMod = true;
bools.allowSDSeqMod = true;
bools.allowTranspose = true;
bools.allowBDSeqMod = false;
bools.allowNoteAddition = true;
// bools.ownBeat = true;
if (!bools.preserveMelody) {
clearDrums();
clearMelody();
clearBassLine();
generateChords();
generateBassLine();
gener8Melody();
gener8BDbeat();
gener8SDbeat();
if (random(2)) {
gener8hats();
}
bools.MELODY = true;
bools.BASS = false;
}
//refreshRandom();
}
if (bools.leftSwitch) { //if left button is in
bools.bend = true;
// Decay = 4;
octOffset = (x >> 7);
playPortBsamp(t, portBselector);
t++;
}
else if (bools.rightSwitch) { // If right button is in
xMode = 0;
if (mood < 3) {
octOffset = (x >> 7);
}
//distAmount = 1;
else {
Decay = (x >> 6);// 8;
}
}
else { //if no buttons are in
xMode = 0;
bools.bend = false;
//Decay = 10;
distAmount = 0;
if (bools.BONG_L) { //if this is transition from On to Off
octOffset = 2;
if (!bools.ownBeat) {
newDrums();
}
// selector = random(1, 17);
bools.disablePortB = !bools.disablePortB;
}
if (bools.BONG_R) { //if this is transition from On to Off
playMode++;
if (playMode % 3 == 0) {
bools.BASS = true;
bools.MELODY = true;
bools.bend = false;
}
else if (playMode % 3 == 1) {
bools.MELODY = true;
bools.BASS = false;
}
else {
bools.MELODY = false;
bools.BASS = true;
}
}
}
}
void myFirstSong() {
if (bools.firstRun) {
if (!bools.preserveMelody) {
clearMelody();
clearBassLine();
}
xMode = 0;
bools.disablePortB = false;
bools.play = true;
bools.ownBeat = false;
bools.preserveMelody = true;
bools.allowBDSeqMod = false;
bools.allowHHSeqMod = false;
bools.allowSDSeqMod = false;
bools.myFirstSongMode = true;
bools.allowTranspose = false;
bools.bend = false;
bools.allowHHSeqMod = true;
bools.allowSDSeqMod = true;
bools.allowBDSeqMod = true;
bools.allowNoteAddition = true;
bools.MELODY = true;
bools.BASS = true;
if (!bools.ownBeat){
clearDrums();
gener8BDbeat();
}
bools.firstRun = false;
for (int i = 0; i < 16; i++) {
// amps[i] = 4;
}
}
bools.play = true;
if (bools.leftSwitch) {
bools.eraseNote = true;
}
else if (bools.rightSwitch) {
xMode = 0;
bools.writeNote = true;
}
else {
bools.eraseNote = false;
bools.writeNote = false;
}
}
void myFirstBeat() {
if (bools.firstRun) {
bools.ownBeat = true;
bools.preserveMelody = true; //this will actually preserve both
bools.allowBDSeqMod = false;
bools.allowHHSeqMod = false;
bools.allowSDSeqMod = false;
bools.play = true;
bools.disablePortB = false;
bools.firstRun = false;
BDseq = 0;
SDseq = 0;
//gener8hats(); //hats to use as a metronome
//HHseq = 0;
}
if (bools.rightSwitch) {
bools.beatWrite = true;
}
else if (bools.leftSwitch) {
bools.beatErase = true;
}
else {
bools.beatErase = false;
bools.beatWrite = false;
}
}
void trigOnChangeSolo() {
if (bools.firstRun) {
bools.portBMode = false;
//bools.ownBeat = false;
//bools.firstRun = false;
xMode = 0;
}
bools.play = false;
xMode = 0;
diff = oldX - x;
if ((diff < -30) | (diff > 30)) {
oldX = x;
chordSolo(x);
}
if (bools.leftSwitch) {
playPortBsamp(t, portBselector);
//PORTB = (PORTB & ~mask) | (t % ((t >> x) & (t >> 5))) & mask ;
t++;
}
if (bools.rightSwitch) {
playPortBsamp(t, (portBselector + 1) % 5);
//PORTB = (PORTB & ~mask) | (((t * (t >> 4 | t >> 9) | (t / 256 + x)&t >> 8)) ^ (t & t >> 8 | t >> 6)) & mask;
t++;
if (bools.BANG_R) {
octaveselect++;
if (octaveselect > 4) {
octaveselect = 0;
//bools.oldRightSwitch = true;
}
}
}
//bools.oldRightSwitch = false;
}
void trigOnPurifySolo() {
//bools.play = false;
//bools.portBMode = false;
if (bools.BANG_R) {
chordSolo(x);
}
if (bools.BANG_L) {
chordSolo(x + 10);
}
}
void buttonSolos() {
bools.disablePortB = true; //only disaples drums
bools.play = false;
if (bools.rightSwitch) {
xMode = 0;
a = x / 10;
playPortBsamp(t, portBselector);
t++;
}
else if (bools.leftSwitch) {
xMode = 0;
bools.bend = true;
// Decay = 7;
// playNoteNow(x, octaveselect, 2);
}
else {
refreshRandom();
//xMode = random(0, 2);
octaveselect = random(0, 4);
}
}
void portBplayer() {
bools.disablePortB = true; //only disables drums
if (bools.BANG_R) {
pip++;
pip = pip % 5;
}
else if (bools.leftSwitch) {
refreshRandom();
playNoteNow(x, 1, 4);
}
else {
// bools.Blink=true;
//refreshRandom();
//xMode = 0;
//octaveselect = random(0, 4);
//t = 0;
t = s >> pip;
}
//a = x / 10;
bools.bend = true;
playPortBsamp(t, portBselector); //using melody offset so i dont need to store an own portB
}