-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathIO.ino
41 lines (33 loc) · 852 Bytes
/
IO.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
//voltage update routine calls. to be called at regular intervals.
void Vupdate() {
envelope.env_update();
Pitch.control_update();
}
//get control readings and update time constants
void controls_read() {
float Attack = analogRead(ATTACK);
float Decay = analogRead(DECAY);
float sus = analogRead(SUSTAIN);
float Release = analogRead(RELEASE);
float glidetime = 1024 - analogRead(GLIDE);
Pitch.update_glide(glidetime);
envelope.control_update(Attack, Decay, sus, Release);
}
//gate output
void output_gate(int state) {
if (state == 1) {
digitalWrite(GATE, HIGH);
}
else if (state == 0) {
digitalWrite(GATE, LOW);
}
}
//retrigger output
void output_retrigger() {
digitalWrite(RETRIGGER, HIGH);
RetriggerTimer.begin(trigoff, 1000);
}
void trigoff() {
digitalWrite(RETRIGGER, LOW);
RetriggerTimer.end();
}