diff --git a/NuEVI/NuEVI.ino b/NuEVI/NuEVI.ino index 246b229..bf68294 100644 --- a/NuEVI/NuEVI.ino +++ b/NuEVI/NuEVI.ino @@ -98,7 +98,9 @@ unsigned short fwcType; // 6, m6, 7, m7 unsigned short fwcLockH; // OFF:ON unsigned short fwcDrop2; // OFF:ON unsigned short hmzKey; // 0-11 (0 is C) -unsigned short hmzLimit; // 2-5: +unsigned short hmzLimit; // 2-5 +unsigned short otfKey; //OFF:ON +unsigned short breathInterval = 6; // 3-15 unsigned short vibSens = 2; // vibrato sensitivity unsigned short vibRetn = 2; // vibrato return speed @@ -169,6 +171,8 @@ byte activeMIDIchannel; // MIDI channel byte activePatch=0; byte doPatchUpdate=0; +byte cvPortaTuneCount = 0; + uint16_t legacy = 0; uint16_t legacyBrAct = 0; byte halfTime = 0; @@ -190,7 +194,7 @@ int breathCalZero; int leverPortZero; #if defined(NURAD) -int leverPortThr = 40; +int leverPortThr = 50; #else int leverPortThr = 50; #endif @@ -550,7 +554,7 @@ void setup() { analogReadResolution(12); // set resolution of ADCs to 12 bit analogWriteResolution(12); analogWriteFrequency(pwmDacPin,11718.75); - Wire.setClock(400000); + Wire.setClock(1000000); pinMode(dPin, INPUT_PULLUP); pinMode(ePin, INPUT_PULLUP); @@ -1293,7 +1297,8 @@ void loop() { } // Is it time to send more CC data? currentTime = millis(); - if (currentTime - ccBreathSendTime > (CC_BREATH_INTERVAL+slowMidi*SLOW_MIDI_ADD)){ + //if (currentTime - ccBreathSendTime > (CC_BREATH_INTERVAL+slowMidi*SLOW_MIDI_ADD)){ + if (currentTime - ccBreathSendTime > (breathInterval-1)){ breath(); ccBreathSendTime = currentTime; } @@ -1331,10 +1336,22 @@ void loop() { targetPitch = (fingeredNote-24)*42; if (portIsOn){ if (targetPitch > cvPitch){ - cvPitch += 1+(127-oldport)/4; + if (!cvPortaTuneCount) { + cvPitch += 1+(127-oldport)/4; + } + else { + cvPortaTuneCount++; + if (cvPortaTuneCount > CVPORTATUNE) cvPortaTuneCount=0; + } if (cvPitch > targetPitch) cvPitch = targetPitch; } else if (targetPitch < cvPitch){ - cvPitch -= 1+(127-oldport)/4; + if (!cvPortaTuneCount) { + cvPitch -= 1+(127-oldport)/4; + } + else { + cvPortaTuneCount++; + if (cvPortaTuneCount > CVPORTATUNE) cvPortaTuneCount=0; + } if (cvPitch < targetPitch) cvPitch = targetPitch; } else { cvPitch = targetPitch; @@ -1842,7 +1859,8 @@ void readSwitches() { // Octave rollers int touchValueRollers[12]; for (byte i=0; i<6; i++){ - touchValueRollers[i]=touchSensorRollers.filteredData(i) - calOffsetRollers[i]; + //touchValueRollers[i]=touchSensorRollers.filteredData(i) - calOffsetRollers[i]; + touchValueRollers[i]=touchSensorRollers.filteredData(i) * (300-calOffsetRollers[i])/300; } // 6-pin version octaveR = 0; @@ -1852,6 +1870,13 @@ void readSwitches() { else if (R3=(touchValueRollers[rPin3] < ctouchThrVal)) octaveR = 3; //R3 (store for combo check) else if (R2=(touchValueRollers[rPin2] < ctouchThrVal)) octaveR = 2; //R2 (store for combo check) else if (touchValueRollers[rPin1] < ctouchThrVal) octaveR = 1; //R1 + else if (lastOctaveR > 1) { + octaveR = lastOctaveR; + if (otfKey && polySelect && (polySelect 1) octaveR = lastOctaveR; + else if (lastOctaveR > 1) { + octaveR = lastOctaveR; + if (otfKey && polySelect && (polySelect