Version 1.2.7

This commit is contained in:
John Stäck 2018-10-22 21:55:29 +02:00
parent 205689dbdf
commit 24c9480c5b
3 changed files with 223 additions and 139 deletions

100
NuEVI.ino
View file

@ -22,11 +22,11 @@ PROGRAMME FUNCTION: EVI Wind Controller using the Freescale MP3V5004GP breath
// Compile options, comment/uncomment to change // Compile options, comment/uncomment to change
#define FIRMWARE_VERSION "1.2.6" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<< #define FIRMWARE_VERSION "1.2.7" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
#define REVB #define REVB
//Uncomment the following line if you have Teensyduino 1.4.0 or earlier, to make pitch bend over USB-MIDI work. //Comment out the following line if you have Teensyduino 1.4.0 or earlier, to make pitch bend over USB-MIDI work.
#define NEWTEENSYDUINO #define NEWTEENSYDUINO
@ -122,9 +122,9 @@ PROGRAMME FUNCTION: EVI Wind Controller using the Freescale MP3V5004GP breath
#define CCN_PortOnOff 65// Controller number for portamento on/off #define CCN_PortOnOff 65// Controller number for portamento on/off
// Send CC data no more than every CC_INTERVAL // Send breath CC data no more than every CC_INTERVAL (other CC is sent with double interval)
// milliseconds // milliseconds (due to timing errors, the value should be about half the actual wanted value)
#define CC_INTERVAL 5 #define CC_INTERVAL 2
// The three states of our main state machine // The three states of our main state machine
@ -479,6 +479,7 @@ byte legacy = 0;
byte legacyBrAct = 0; byte legacyBrAct = 0;
byte halfTime = 0; byte halfTime = 0;
byte FPD = 0; byte FPD = 0;
boolean programonce = false;
int breathLevel=0; // breath level (smoothed) not mapped to CC value int breathLevel=0; // breath level (smoothed) not mapped to CC value
int oldbreath=0; int oldbreath=0;
@ -562,6 +563,8 @@ byte halfPitchBendKey;
byte specialKey; byte specialKey;
byte pinkyKey; byte pinkyKey;
byte lastSpecialKey = 0; byte lastSpecialKey = 0;
byte pitchlatch;
int reverb;
byte slurSustain = 0; byte slurSustain = 0;
byte parallelChord = 0; byte parallelChord = 0;
@ -798,7 +801,7 @@ void mainLoop() {
mainState = RISE_WAIT; // Go to next state mainState = RISE_WAIT; // Go to next state
} }
if (legacy || legacyBrAct) { if (legacy || legacyBrAct) {
if (((pbUp > ((pitchbMaxVal + pitchbThrVal)/2)) && (pbDn > ((pitchbMaxVal + pitchbThrVal)/2)) && legacy) || ((analogRead(0) < (breathCalZero - 500)) && legacyBrAct)){ // both pb pads touched if (((pbUp > ((pitchbMaxVal + pitchbThrVal) / 2)) && (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2)) && legacy) || ((analogRead(0) < (breathCalZero - 500)) && legacyBrAct) && (pbDn < ((pitchbMaxVal + pitchbThrVal) / 2))) { // both pb pads touched or br suck
readSwitches(); readSwitches();
fingeredNoteUntransposed = patchLimit(fingeredNoteUntransposed + 1); fingeredNoteUntransposed = patchLimit(fingeredNoteUntransposed + 1);
if (exSensor >= ((extracThrVal + extracMaxVal) / 2)) { // instant midi setting if (exSensor >= ((extracThrVal + extracMaxVal) / 2)) { // instant midi setting
@ -838,7 +841,90 @@ void mainLoop() {
} }
} }
} }
else {
if (pbDn > (pitchbMaxVal + pitchbThrVal) / 2 && (analogRead(0) < (breathCalZero - 500)) && programonce == false) { // down bend for suck programming button
programonce = true;
readSwitches();
if (octaveR == 0) { //lowest octave position
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; }
usbMIDI.sendControlChange(91, reverb, activeMIDIchannel);
dinMIDIsendControlChange(91, reverb, activeMIDIchannel - 1);
}
}
if (octaveR == 3) { //middle octave position to set breath parameters
// breathCC value is from cclist[] which assigns controller number
if (K1) { //turn on midi volume
breathCC = 3;
usbMIDI.sendControlChange(7, 0, activeMIDIchannel); //midi vol to 0
dinMIDIsendControlChange(7, 0, activeMIDIchannel - 1);
usbMIDI.sendControlChange(11, 127, activeMIDIchannel); //midi expression to 127
dinMIDIsendControlChange(11, 127, activeMIDIchannel - 1);
}
if (K3) { //turn on midi breath controller
breathCC = 2;
usbMIDI.sendControlChange(7, 127, activeMIDIchannel); //midi vol to 127
dinMIDIsendControlChange(7, 127, activeMIDIchannel - 1);
usbMIDI.sendControlChange(11, 127, activeMIDIchannel); //midi expression to 127
dinMIDIsendControlChange(11, 127, activeMIDIchannel - 1);
}
if (K4) { //sb turn on midi expression
breathCC = 4;
usbMIDI.sendControlChange(7, 127, activeMIDIchannel); //midi vol to 127
dinMIDIsendControlChange(7, 127, activeMIDIchannel - 1);
usbMIDI.sendControlChange(11, 0, activeMIDIchannel); //midi expression to 0
dinMIDIsendControlChange(11, 0, activeMIDIchannel - 1);
}
if (K2) { //2v turn on aftertouch
breathAT = 1;
usbMIDI.sendControlChange(7, 127, activeMIDIchannel); //midi vol to 127
dinMIDIsendControlChange(7, 127, activeMIDIchannel - 1);
usbMIDI.sendControlChange(11, 127, activeMIDIchannel); //midi expression to 0
dinMIDIsendControlChange(11, 127, activeMIDIchannel - 1);
}
else { breathAT = 0; }
if (K5) { //1tr turn on velocity
velocity = 0;
usbMIDI.sendControlChange(7, 127, activeMIDIchannel); //midi vol to 127
dinMIDIsendControlChange(7, 127, activeMIDIchannel - 1);
usbMIDI.sendControlChange(11, 127, activeMIDIchannel); //midi expression to 0
dinMIDIsendControlChange(11, 127, activeMIDIchannel - 1);
}
else { velocity = 127; }
if (!K1 && !K3 && !K4) {
breathCC = 0;
usbMIDI.sendControlChange(7, 127, activeMIDIchannel); //midi vol to 127
dinMIDIsendControlChange(7, 127, activeMIDIchannel - 1);
usbMIDI.sendControlChange(11, 127, activeMIDIchannel); //midi expression to 127
dinMIDIsendControlChange(11, 127, activeMIDIchannel - 1);
}
}
}
}
}
if (analogRead(0) > (breathCalZero - 400)) programonce = false;
specialKey = (touchRead(specialKeyPin) > touch_Thr); //S2 on pcb specialKey = (touchRead(specialKeyPin) > touch_Thr); //S2 on pcb
if (lastSpecialKey != specialKey) { if (lastSpecialKey != specialKey) {
if (specialKey) { if (specialKey) {
@ -1034,8 +1120,6 @@ void mainLoop() {
usbMIDI.sendNoteOff(activeNote, velocitySend, activeMIDIchannel); // send Note Off message for old note usbMIDI.sendNoteOff(activeNote, velocitySend, activeMIDIchannel); // send Note Off message for old note
dinMIDIsendNoteOff(activeNote, velocitySend, activeMIDIchannel - 1); dinMIDIsendNoteOff(activeNote, velocitySend, activeMIDIchannel - 1);
} }
fingeredNote = noteValueCheck(fingeredNote); fingeredNote = noteValueCheck(fingeredNote);
if (priority) { if (priority) {
usbMIDI.sendNoteOn(fingeredNote, velocitySend, activeMIDIchannel); // send Note On message for new note usbMIDI.sendNoteOn(fingeredNote, velocitySend, activeMIDIchannel); // send Note On message for new note