From 392f536203c5a624f5b02e548b4864468c57d0b7 Mon Sep 17 00:00:00 2001 From: Oleksiy Date: Thu, 3 Aug 2023 00:53:15 +0300 Subject: [PATCH] Added quantization --- Software/Gravity/Gravity.ino | 5 +++++ Software/Gravity/Interactions.ino | 6 +++++- Software/Gravity/UI.ino | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Software/Gravity/Gravity.ino b/Software/Gravity/Gravity.ino index 41e2496..a52d0da 100644 --- a/Software/Gravity/Gravity.ino +++ b/Software/Gravity/Gravity.ino @@ -82,6 +82,7 @@ int playingModes[6]; //actual channel modes array updated from channels object unsigned int pulsePeriod; bool isPlaying = false; bool isRecording = false; +bool recordToNextStep = false; unsigned int tickCount = 0; unsigned int pulseCount = 0; @@ -318,6 +319,9 @@ void sendTriggers() { } if (sixteenthPulseCount < (PPQN / 4) - 1) { sixteenthPulseCount++; + if (sixteenthPulseCount > 3) { //quantization. might need fine-tuning + recordToNextStep = true; + } } else { sixteenthPulseCount = 0; if (currentStep < 15) { @@ -325,6 +329,7 @@ void sendTriggers() { } else { currentStep = 0; } + recordToNextStep = false; } //switching modes on the beat and resetting channel clock diff --git a/Software/Gravity/Interactions.ino b/Software/Gravity/Interactions.ino index 30fb16b..4101913 100644 --- a/Software/Gravity/Interactions.ino +++ b/Software/Gravity/Interactions.ino @@ -243,8 +243,12 @@ void checkInputs() { if (displayScreen == 1 && !isRecording) { patternToEdit[stepNumSelected] = !patternToEdit[stepNumSelected]; saveState(); - } else if (displayScreen == 1 && isRecording) { + } else if (displayScreen == 1 && isRecording && !recordToNextStep) { //Recording patternToEdit[currentStep] = 1; + } else if (displayScreen == 1 && isRecording && recordToNextStep && currentStep != 15) { + patternToEdit[currentStep+1] = 1; + } else if (displayScreen == 1 && isRecording && recordToNextStep && currentStep == 15) { + patternToEdit[0] = 1; } updateScreen(); } else if (digitalRead(SHIFT_BTN_PIN) && shiftBtnPushed) { diff --git a/Software/Gravity/UI.ino b/Software/Gravity/UI.ino index cc07e0b..8ccb457 100644 --- a/Software/Gravity/UI.ino +++ b/Software/Gravity/UI.ino @@ -85,7 +85,7 @@ void updateScreen() { char bpmChar[5]; bpmStr.toCharArray(bpmChar, 5); u8g2.setFont(u8g2_font_logisoso24_tn); - if (!insideTab && shiftBtnPushed) { + if (!insideTab && shiftBtnPushed && masterClockMode == 0) { u8g2.drawButtonUTF8(28, 26, U8G2_BTN_BW1|U8G2_BTN_INV|U8G2_BTN_HCENTER, 56, 0, 0, bpmChar ); u8g2.setFont(velvetscreen); if (masterClockMode == 0) {