-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.ino
57 lines (38 loc) · 1.2 KB
/
test.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
int counter;
#define COUNTER_LIMIT 32
boolean flip;
boolean sendSwitch;
void testMode(){
MIDI.read();
counter++;
if(counter>COUNTER_LIMIT) counter=0, flip=!flip, randomize(hw.soundFromSwitches());
if(flip) anySound();
else stopSound();
if(hw.justPressed(SMALL_BUTTON_1)) page=increaseValue(page,2) , MIDI.sendControlChange(13,page,1);
if(hw.justPressed(SMALL_BUTTON_2)) page=decreaseValue(page,2), MIDI.sendControlChange(13,page,1);
hw.setColor(page+1);
for(int i=0;i<3;i++){
if(hw.justPressed(i)) hw.flipSwitch(i), sendSwitch=true;
hw.setLed(i,hw.switchState(i));
hw.unfreezeKnob(i);
if(hw.knobMoved(i)) MIDI.sendControlChange(10+i,hw.knobValue(i)>>3,1), hw.setColor(WHITE);
}
if(sendSwitch) MIDI.sendControlChange(14,hw.soundFromSwitches(),1), sendSwitch=false;
if(hw.buttonState(EXTRA_BUTTON_1) || hw.buttonState(EXTRA_BUTTON_2) ){
for(int i=0;i<3;i++) hw.setSwitch(i,random(2));
}
}
void anySound(){
//randomize(1);
renderTweaking(0);
renderTimeStretch();
playSound(1,DEFAULT_VELOCITY);
}
void stopSound(){
renderTimeStretch();
}
int decreaseValue(int _VALUE, int _OVERFLOW){
if(_VALUE > 0) _VALUE--;
else _VALUE=_OVERFLOW;
return _VALUE;
}