Added quantization

This commit is contained in:
2023-08-03 00:53:15 +03:00
parent a40f7ec67d
commit 392f536203
3 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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) {