diff --git a/Open_Theremin_V3/application.cpp b/Open_Theremin_V3/application.cpp index bc7e609..a547b16 100644 --- a/Open_Theremin_V3/application.cpp +++ b/Open_Theremin_V3/application.cpp @@ -82,7 +82,7 @@ unsigned long Application::GetQMeasurement() { int qn=0; - TCCR1B = (1<= HYST_VAL) || ((wavePotValueL-wavePotValue) >= HYST_VAL)) wavePotValueL=wavePotValue; vWavetableSelector=wavePotValueL>>7; - registerValue=4-(registerPotValueL>>8); + + // New register pot configuration: + // Left = -1 octave, Center = +/- 0, Right = +1 octave + if(registerPotValue > 681) + { + registerValue = 1; + } else if(registerPotValue < 342) + { + registerValue = 3; + } else + { + registerValue = 2; + } if (_state == PLAYING && HW_BUTTON_PRESSED) { _state = CALIBRATING; @@ -251,7 +263,7 @@ void Application::loop() { // set wave frequency for each mode switch (_mode) { case MUTE : /* NOTHING! */; break; - case NORMAL : setWavetableSampleAdvance((pitchCalibrationBase-pitch_v)/registerValue+2048-(pitchPotValue<<2)); break; + case NORMAL : setWavetableSampleAdvance(((pitchCalibrationBase-pitch_v)+2048-(pitchPotValue<<2))>>registerValue); break; }; // HW_LED2_OFF; @@ -512,7 +524,3 @@ void Application::delay_NOP(unsigned long time) { __asm__ __volatile__ ("nop"); } } - - - -