-
Notifications
You must be signed in to change notification settings - Fork 0
/
Instrument.pde
68 lines (52 loc) · 1.47 KB
/
Instrument.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
64
65
66
67
68
class Instrument extends Effected {
Knob knob;
int value;
int channel;
//ArrayList waves = new ArrayList();
Instrument(TuioObject tobj, int channel) {
super(tobj);
this.channel = channel;
setChannels();
init();
}
void setChannels() {
this.volumeCtrl = tobj.getSymbolID();
this.reverbCtrl = tobj.getSymbolID() + 10;
this.gateCtrl = tobj.getSymbolID() + 20;
this.equalizerCtrl = tobj.getSymbolID() - 30;
this.delayCtrl = tobj.getSymbolID() - 20;
}
void update() {
mainBus.sendNoteOff(channel, MuMusic.currentScale[(int)value], 20);
value = 10 + (int)(tobj.getAngle() / (2.0*PI)*30);
mainBus.sendNoteOn(channel, MuMusic.currentScale[(int)value], 100);
}
MuObjectType getType() {
return MuObjectType.INSTRUMENT;
}
void init() {
action();
}
void display() {
stroke(0);
fill(255, 220, 255);
//noFill();
strokeWeight(1);
pushMatrix();
translate(tobj.getScreenX(width), tobj.getScreenY(height));
rotate(tobj.getAngle());
//rect(-obj_size/2, -obj_size/2, obj_size, obj_size);
polygon(0, 0, obj_size/1.6, 6);
popMatrix();
fill(0);
text(""+tobj.getSymbolID(), tobj.getScreenX(width), tobj.getScreenY(height));
}
void action() {
value = 10 + (int)(tobj.getAngle() / (2.0*PI)*30);
mainBus.sendNoteOn(channel, MuMusic.currentScale[(int)value], 100);
}
//TODO
void dismiss() {
mainBus.sendNoteOff(channel, MuMusic.currentScale[(int)value], 0);
}
}