-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pressed.pde
64 lines (61 loc) · 1.45 KB
/
Pressed.pde
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
void mousePressed() {
for (int i = 0; i < ratebuttons.length; i++) {
if (ratebuttons[i].pressed() && played && myChannel.state==Ess.STOPPED) {
results = append(results, nf(clip, 3) + ", " + nf(i+1, 1));
saveStrings("results" + sections[sectionIndex] + ".txt", results);
played = false;
if (index+1 < notes.length) {
index++;
loadNewSound();
} else {
if (sectionIndex + 1 == sections.length) {
finishedPhase = true;
playPhase = false;
} else {
playPhase = false;
restPhase = true;
}
}
}
}
if ((play.contains(mouseX, mouseY)) && (playPhase)) {
if (myChannel.state==Ess.STOPPED) {
myChannel.play(1);
played = true;
}
else {
myChannel.stop();
}
}
}
void keyPressed() {
if (key == ' ') {
if (startPhase) {
startPhase = false;
playPhase = true;
}
if (restPhase) {
restPhase = false;
index = 0;
sectionIndex++;
notes = files[sections[sectionIndex]];
loadNewSound();
playPhase = true;
}
if (playPhase) {
if (myChannel.state==Ess.STOPPED) {
myChannel.play(1);
played = true;
} else {
myChannel.stop();
}
}
}
}
void loadNewSound() {
clip = notes[index];
println(clip + " " + sections[sectionIndex]);
load = str(clip) + ".wav";
myChannel.loadSound(load);
// myChannel = new AudioChannel(load);
}