shift + play = mute channel

This commit is contained in:
Oleksiy
2025-03-04 20:42:51 +02:00
parent 3552cfd2f5
commit d04e7b0dbb
2 changed files with 31 additions and 20 deletions

View File

@ -9,7 +9,7 @@
#include "config.h" #include "config.h"
#include "fonts.h" #include "fonts.h"
#define VERSION "V:1.2A" #define VERSION "V:1.2A2"
byte memCode = 'd'; //Change to different letter if you changed the data structure byte memCode = 'd'; //Change to different letter if you changed the data structure
@ -33,15 +33,16 @@ struct channel {
uint8_t swing : 3; uint8_t swing : 3;
uint8_t offset : 7; //mv: 128 uint8_t offset : 7; //mv: 128
uint8_t gate : 6; //mv: 64 uint8_t gate : 6; //mv: 64
bool isMute : 1;
}; };
channel channels[6] = { //array of channel settings channel channels[6] = { //array of channel settings
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 }, { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 }, { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 }, { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 }, { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 }, { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 7, 0, 0, 0, 0, 0, 0, 0 } { 0, 7, 0, 0, 0, 0, 0, 0, 0, 0 }
}; };
bool seqA1[16] = {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1}; //switch to struct seqs { uint32_t sequence; uint8_t length : 5 ; uint8_t currentStep : 5}. test with lengthOf bool seqA1[16] = {1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1}; //switch to struct seqs { uint32_t sequence; uint8_t length : 5 ; uint8_t currentStep : 5}. test with lengthOf
@ -415,19 +416,20 @@ void sendTriggers() { //rename to onPulse or something
digitalWrite(outsPins[i], LOW); digitalWrite(outsPins[i], LOW);
} }
} }
if (!channels[i].isMute) {
if ((channels[i].mode == 3 && channelPulseCount[i] == 0 && stepIsOdd == 0)
|| (channels[i].mode == 3 && channelPulseCount[i] == channels[i].swing && stepIsOdd == 1) //swing
) {
digitalWrite(outsPins[i], HIGH);
}
if ((channels[i].mode == 3 && channelPulseCount[i] == 0 && stepIsOdd == 0) if ((channels[i].mode == 0 && channelPulseCount[i] == channels[i].offset) //CLK with offset
|| (channels[i].mode == 3 && channelPulseCount[i] == channels[i].swing && stepIsOdd == 1) //swing || (channels[i].mode == 1 && channelPulseCount[i] == 0 && (random(10) + 1) > randAmount) //RND
) { || (channels[i].mode == 4 && channelPulseCount[i] == 0) //Gate
digitalWrite(outsPins[i], HIGH); ) {
} digitalWrite(outsPins[i], HIGH);
gatePulseCount[i] = 0; //reset gate here to avoid length "countdown" effect
if ((channels[i].mode == 0 && channelPulseCount[i] == channels[i].offset) //CLK with offset }
|| (channels[i].mode == 1 && channelPulseCount[i] == 0 && (random(10) + 1) > randAmount) //RND
|| (channels[i].mode == 4 && channelPulseCount[i] == 0) //Gate
) {
digitalWrite(outsPins[i], HIGH);
gatePulseCount[i] = 0; //reset gate here to avoid length "countdown" effect
} }
if (channelPulseCount[i] < channelPulsesPerCycle[i]) { if (channelPulseCount[i] < channelPulsesPerCycle[i]) {
channelPulseCount[i]++; channelPulseCount[i]++;

View File

@ -392,7 +392,7 @@ void checkInputs() {
} }
//play button //play button
if (!digitalRead(START_STOP_BTN_PIN) && !playBtnPushed) { if (!digitalRead(START_STOP_BTN_PIN) && !playBtnPushed && !shiftBtnPushed) {
if (masterClockMode == 0) { if (masterClockMode == 0) {
calculateBPMTiming(); calculateBPMTiming();
if (!isPlaying) { if (!isPlaying) {
@ -411,6 +411,15 @@ void checkInputs() {
playBtnPushed = false; playBtnPushed = false;
} }
//shift + play = mute channel
if (!digitalRead(START_STOP_BTN_PIN) && !playBtnPushed && shiftBtnPushed) {
channels[displayTab - 1].isMute = !channels[displayTab - 1].isMute;
playBtnPushed = true;
updateScreen(); //to wake up the screen if turned off
} else if (digitalRead(START_STOP_BTN_PIN) && playBtnPushed) {
playBtnPushed = false;
}
//shift button //shift button
if (!digitalRead(SHIFT_BTN_PIN) && !shiftBtnPushed) { if (!digitalRead(SHIFT_BTN_PIN) && !shiftBtnPushed) {
shiftBtnPushed = true; shiftBtnPushed = true;