-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayhead_manager.pde
52 lines (43 loc) · 1.06 KB
/
playhead_manager.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
class PlayheadManager {
Playhead[] playheads;
PApplet parent;
PlayheadManager (Stave s, PApplet p) {
playheads = new Playhead[4];
parent = p;
Playhead p1 = new Playhead(stave, parent, color(128,0,0), true);
playheads[0] = p1;
Playhead p2 = new Playhead(stave, parent, color(0,128,0), false);
playheads[1] = p2;
Playhead p3 = new Playhead(stave, parent, color(0,0,128), false);
playheads[2] = p3;
Playhead p4 = new Playhead(stave, parent, color(128,0,128), false);
playheads[3] = p4;
}
void render() {
for (Playhead p : playheads) {
if(p.active) {
p.render();
p.renderIntersections();
}
}
}
void playNotes() {
for (Playhead p : playheads) {
if(p.active) {
p.playNotes();
}
}
}
void modifyPositionBy(float amt) {
for (Playhead p : playheads) {
p.modifyPositionBy(amt);
}
}
void updatePlayheadsToWidth() {
for (Playhead p : playheads) {
if(p.position > stave.staveWidth) {
p.position = stave.staveWidth;
}
}
}
}