Automated prettifier and tabulator

This commit is contained in:
John Stäck 2019-03-02 09:46:26 +01:00
parent 3aa427fdd5
commit ca90f8f664

View file

@ -701,21 +701,35 @@ void loop() {
}
}
}
}
else {
} else {
if (pbDn > (pitchbMaxVal + pitchbThrVal) / 2 && (analogRead(0) < (breathCalZero - 800)) && programonce == false) { // down bend for suck programming button
programonce = true;
readSwitches();
if (octaveR == 0) { //lowest octave position
if (K1 && K2 && !K3 &&K4) { patch = patch -10; doPatchUpdate = 1; } // e28 send patch change -10
else if (K1 && !K2 && !K3 && K4) { patch--; doPatchUpdate = 1; } //f29 decrement and send patch change
else if (!K1 && K2 && !K3 && K4) {patch = patch +10; doPatchUpdate = 1; } //f#30 send patch change +10
else if (!K1 && !K2 && !K3 &&K4) { patch++; doPatchUpdate = 1; } //g31 increment and send patch change
if (K1 && K2 && !K3 && K4) { // e28 send patch change -10
patch = patch - 10;
doPatchUpdate = 1;
} else if (K1 && !K2 && !K3 && K4) { //f29 decrement and send patch change
patch--;
doPatchUpdate = 1;
} else if (!K1 && K2 && !K3 && K4) { //f#30 send patch change +10
patch = patch + 10;
doPatchUpdate = 1;
} else if (!K1 && !K2 && !K3 && K4) { //g31 increment and send patch change
patch++;
doPatchUpdate = 1;
}
if (!K1 && !K2 && K3 && !K4) { //send reverb pitchlatch value
reverb = ((pitchlatch - 36) * 2);
if (reverb > 127) {reverb = 127;}
if (reverb < 0) {reverb = 0;}
if (reverb > 127) {
reverb = 127;
}
if (reverb < 0) {
reverb = 0;
}
midiSendControlChange(91, reverb);
}
}
@ -741,14 +755,16 @@ void loop() {
breathAT = 1;
midiSendControlChange(7, 127); //midi vol to 127
midiSendControlChange(11, 127); //midi expression to 0
} else {
breathAT = 0;
}
else { breathAT = 0; }
if (K5) { //1tr turn on velocity
velocity = 0;
midiSendControlChange(7, 127); //midi vol to 127
midiSendControlChange(11, 127); //midi expression to 0
} else {
velocity = 127;
}
else { velocity = 127; }
if (!K1 && !K3 && !K4) {
breathCC = 0;
midiSendControlChange(7, 127); //midi vol to 127
@ -761,7 +777,6 @@ void loop() {
if (analogRead(0) > (breathCalZero - 800)) programonce = false;
specialKey = (touchRead(specialKeyPin) > touch_Thr); //S2 on pcb
if (lastSpecialKey != specialKey) {
if (specialKey) {
@ -844,7 +859,8 @@ void loop() {
}
if (rotatorOn) {
midiSendNoteOn(noteValueCheck(fingeredNote + parallel), velocitySend); // send Note On message for new note
if (currentRotation < 3) currentRotation++; else currentRotation = 0;
if (currentRotation < 3) currentRotation++;
else currentRotation = 0;
midiSendNoteOn(noteValueCheck(fingeredNote + rotations[currentRotation]), velocitySend); // send Note On message for new note
}
if (!priority) { // mono prio to base note
@ -935,7 +951,6 @@ void loop() {
midiSendNoteOff(activeNote); // send Note Off message for old note
}
fingeredNote = noteValueCheck(fingeredNote);
if (priority) {
midiSendNoteOn(fingeredNote, velocitySend); // send Note On message for new note
@ -955,7 +970,8 @@ void loop() {
}
if (rotatorOn) {
midiSendNoteOn(noteValueCheck(fingeredNote + parallel), velocitySend); // send Note On message for new note
if (currentRotation < 3) currentRotation++; else currentRotation = 0;
if (currentRotation < 3) currentRotation++;
else currentRotation = 0;
midiSendNoteOn(noteValueCheck(fingeredNote + rotations[currentRotation]), velocitySend); // send Note On message for new note
}
@ -1015,8 +1031,7 @@ void loop() {
// non linear mapping function (http://playground.arduino.cc/Main/MultiMap)
// note: the _in array should have increasing values
unsigned int multiMap(unsigned int val, unsigned int* _in, unsigned int* _out, uint8_t size)
{
unsigned int multiMap(unsigned int val, unsigned int * _in, unsigned int * _out, uint8_t size) {
// take care the value is within range
// val = constrain(val, _in[0], _in[size-1]);
if (val <= _in[0]) return _out[0];
@ -1130,7 +1145,9 @@ int noteValueCheck(int note) {
//**************************************************************
int patchLimit(int value) {
if (value < 1) return 1; else if (value > 128) return 128; else return value;
if (value < 1) return 1;
else if (value > 128) return 128;
else return value;
}
//**************************************************************
@ -1296,8 +1313,7 @@ void doorKnobCheck() {
delay(50);
digitalWrite(statusLedPin, HIGH);
delay(50);
}
else if (pbDn > ((pitchbMaxVal + pitchbThrVal)/2)) {
} else if (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2)) {
gateOpen = 0;
midiPanic();
digitalWrite(statusLedPin, LOW);
@ -1464,7 +1480,6 @@ void readSwitches() {
qTransp = 0;
}
// Calculate midi note number from pressed keys
#if defined(CASSIDY)
fingeredNote = startNote - 2*K1 - K2 - 3*K3 - 5*K4 + 2*K5 + K6 + 3*K7 + octaveR*12 + (octave - 3)*12 + transpose - 12 + qTransp;
@ -1473,7 +1488,7 @@ void readSwitches() {
fingeredNote = startNote - 2*K1 - K2 - 3*K3 - 5*K4 + 2*K5 + K6 + 4*K7 + octaveR*12 + (octave - 3)*12 + transpose - 12 + qTransp;
fingeredNoteUntransposed = startNote - 2*K1 - K2 - 3*K3 - 5*K4 + 2*K5 + K6 + 4*K7 + octaveR*12;
#endif
//}
if (pinkyKey) pitchlatch = fingeredNoteUntransposed; //use pitchlatch to make settings based on note fingered
}