Deglitching on keys also for CV note pitch. CV note pitch now also changes immediately when new note is fingered in note off state, not waiting for new note on.
This commit is contained in:
parent
2b147d91fd
commit
9f7fbb60c3
2 changed files with 91 additions and 91 deletions
|
@ -413,6 +413,7 @@ void setup() {
|
|||
void loop() {
|
||||
breathFilter.input(analogRead(breathSensorPin));
|
||||
pressureSensor = constrain((int) breathFilter.output(), 0, 4095); // Get the filtered pressure sensor reading from analog pin A0, input from sensor MP3V5004GP
|
||||
readSwitches();
|
||||
if (mainState == NOTE_OFF) {
|
||||
if (activeMIDIchannel != MIDIchannel) {
|
||||
activeMIDIchannel = MIDIchannel; // only switch channel if no active note
|
||||
|
@ -441,7 +442,6 @@ void loop() {
|
|||
if (((pbUp > ((pitchbMaxVal + pitchbThrVal) / 2)) && (pbDn > ((pitchbMaxVal + pitchbThrVal) / 2)) && legacy) ||
|
||||
((analogRead(breathSensorPin) < breathCalZero - 800) && legacyBrAct && (pbUp > (pitchbMaxVal + pitchbThrVal) / 2) && (pbDn < (pitchbMaxVal + pitchbThrVal) / 2))) { // both pb pads touched or br suck
|
||||
#endif
|
||||
readSwitches();
|
||||
fingeredNoteUntransposed = patchLimit(fingeredNoteUntransposed + 1);
|
||||
if (exSensor >= ((extracThrVal + extracMaxVal) / 2)) { // instant midi setting
|
||||
if ((fingeredNoteUntransposed >= 73) && (fingeredNoteUntransposed <= 88)) {
|
||||
|
@ -490,7 +490,6 @@ void loop() {
|
|||
} else {
|
||||
if (pbDn > (pitchbMaxVal + pitchbThrVal) / 2 && (analogRead(breathSensorPin) < (breathCalZero - 800)) && programonce == false) { // down bend for suck programming button
|
||||
programonce = true;
|
||||
readSwitches();
|
||||
|
||||
if (octaveR == 0) { //lowest octave position
|
||||
|
||||
|
@ -563,7 +562,6 @@ void loop() {
|
|||
if (lastSpecialKey != specialKey) {
|
||||
if (specialKey) {
|
||||
// special key just pressed, check other keys
|
||||
readSwitches();
|
||||
if (K4) {
|
||||
if (!slurSustain) {
|
||||
slurSustain = 1;
|
||||
|
@ -607,7 +605,6 @@ void loop() {
|
|||
// sample?
|
||||
if ((millis() - breath_on_time > velSmpDl) || (0 == velSmpDl)) {
|
||||
// Yes, so calculate MIDI note and velocity, then send a note on event
|
||||
readSwitches();
|
||||
// We should be at tonguing peak, so set velocity based on current pressureSensor value unless fixed velocity is set
|
||||
breathLevel = constrain(max(pressureSensor, initial_breath_value), breathThrVal, breathMaxVal);
|
||||
if (!velocity) {
|
||||
|
@ -689,14 +686,6 @@ void loop() {
|
|||
breathLevel = 0;
|
||||
mainState = NOTE_OFF;
|
||||
} else {
|
||||
readSwitches();
|
||||
if (fingeredNote != lastFingering) { //
|
||||
// reset the debouncing timer
|
||||
lastDeglitchTime = millis();
|
||||
}
|
||||
if ((millis() - lastDeglitchTime) > deglitch) {
|
||||
// whatever the reading is at, it's been there for longer
|
||||
// than the debounce delay, so take it as the actual current state
|
||||
if (noteValueCheck(fingeredNote) != activeNote) {
|
||||
// Player has moved to a new fingering while still blowing.
|
||||
// Send a note off for the current note and a note on for
|
||||
|
@ -774,7 +763,6 @@ void loop() {
|
|||
activeNote = fingeredNote;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pressureSensor > breathThrVal) cursorBlinkTime = millis(); // keep display from updating with cursor blinking if breath is over thr
|
||||
}
|
||||
// Is it time to send more CC data?
|
||||
|
@ -804,7 +792,7 @@ void loop() {
|
|||
}
|
||||
pixelUpdateTime = millis();
|
||||
}
|
||||
lastFingering = fingeredNote;
|
||||
|
||||
#if defined(CVSCALEBOARD) // pitch CV from DAC and breath CV from PWM on pin 6, for filtering and scaling on separate board
|
||||
targetPitch = (fingeredNote-24)*42;
|
||||
if (portIsOn){
|
||||
|
@ -1165,6 +1153,7 @@ void portOff() {
|
|||
//***********************************************************
|
||||
|
||||
void readSwitches() {
|
||||
|
||||
int qTransp;
|
||||
// Read touch pads (MPR121) and put value in variables
|
||||
int touchValue[12];
|
||||
|
@ -1221,7 +1210,18 @@ void readSwitches() {
|
|||
|
||||
#endif
|
||||
|
||||
fingeredNote = fingeredNoteUntransposed + transpose - 12 + qTransp;
|
||||
int fingeredNoteRead = fingeredNoteUntransposed + transpose - 12 + qTransp;
|
||||
|
||||
if (pinkyKey) pitchlatch = fingeredNoteUntransposed; //use pitchlatch to make settings based on note fingered
|
||||
|
||||
if (fingeredNoteRead != lastFingering) { //
|
||||
// reset the debouncing timer
|
||||
lastDeglitchTime = millis();
|
||||
}
|
||||
if ((millis() - lastDeglitchTime) > deglitch) {
|
||||
// whatever the reading is at, it's been there for longer
|
||||
// than the debounce delay, so take it as the actual current state
|
||||
fingeredNote = fingeredNoteRead;
|
||||
}
|
||||
lastFingering = fingeredNoteRead;
|
||||
}
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
|
||||
// Compile options, comment/uncomment to change
|
||||
|
||||
#define FIRMWARE_VERSION "1.3.5" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
#define FIRMWARE_VERSION "1.3.6" // FIRMWARE VERSION NUMBER HERE <<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
|
||||
//#define CASSIDY
|
||||
//#define CVSCALEBOARD
|
||||
#define CVSCALEBOARD
|
||||
|
||||
#define ON_Delay 20 // Set Delay after ON threshold before velocity is checked (wait for tounging peak)
|
||||
//#define touch_Thr 1200 // sensitivity for Teensy touch sensors
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue