basik swing works

This commit is contained in:
Oleksiy
2024-10-18 15:21:08 +03:00
parent 7c235869a9
commit 3cd323d5b9
2 changed files with 12 additions and 4 deletions

View File

@ -32,7 +32,7 @@ struct channel {
byte random : 4; //mv: 16
byte seqPattern : 4;
uint8_t gate : 6; //mv: 64
uint8_t swing : 4; //some of this params can be combinde into 4+4 bits to save space
uint8_t swing : 3; //some of this params can be combinde into 4+4 bits to save space
};
channel channels[6] = { //array of channel settings
@ -87,6 +87,7 @@ unsigned long newExtPulseTime = 0;
bool needPulseReset[6] = { true, true, true, true, true, true };
int gatePulseCount[6] = {0,0,0,0,0,0};
bool swingBit = 0;
byte displayTab = 0;
bool insideTab = false;
@ -417,9 +418,16 @@ void sendTriggers() { //rename to onPulse or something
}
}
if ((channels[i].mode == 3 && channelPulseCount[i] == 0 && swingBit == 0)
|| (channels[i].mode == 3 && channelPulseCount[i] == channels[i].swing && swingBit == 1 && currentStep %2 == 0) //swing
) {
digitalWrite(outsPins[i], HIGH);
swingBit = !swingBit;
}
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
|| (channels[i].mode == 4 && channelPulseCount[i] == 0) //Gate
) {
digitalWrite(outsPins[i], HIGH);
gatePulseCount[i] = 0; //reset gate here to avoid length "countdown" effect