Minor Stuff. Branching out
This commit is contained in:
@ -26,25 +26,25 @@ byte bpmModulationRange = 0;
|
||||
struct channel {
|
||||
byte mode : 3; //mv: 7. 0 - CLK, 1 - RND, 2 - SEQ, 3 - SWING, 4 - Gate
|
||||
byte subDiv : 5; //mv: 32
|
||||
byte CV1Target : 3; //0 - Off, 1 - Subdiv, 2 - RND, 3 - SeqPattern
|
||||
byte CV2Target : 3;
|
||||
uint8_t offset : 7; //mv: 128
|
||||
byte random : 4; //mv: 16
|
||||
byte seqPattern : 4;
|
||||
byte CV1Target : 3; //0 - Off, 1 - Subdiv, 2 - RND, 3 - SeqPattern
|
||||
byte CV2Target : 3;
|
||||
uint8_t swing : 3;
|
||||
uint8_t offset : 7; //mv: 128
|
||||
uint8_t gate : 6; //mv: 64
|
||||
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
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 23, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 23, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 23, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 23, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 23, 0 },
|
||||
{ 0, 7, 0, 0, 0, 0, 0, 23, 0 }
|
||||
{ 0, 7, 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, 7, 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 }
|
||||
};
|
||||
|
||||
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; uint8_t subdiv }. 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
|
||||
bool seqA2[16] = {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0};
|
||||
bool seqA3[16] = {1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0};
|
||||
bool seqA4[16] = {0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1};
|
||||
@ -64,7 +64,6 @@ byte currentStep = 0;
|
||||
byte stepNumSelected = 0;
|
||||
bool *patternToEdit;
|
||||
|
||||
|
||||
unsigned int channelPulseCount[6];
|
||||
unsigned int channelPulsesPerCycle[6];
|
||||
byte sixteenthPulseCount = 0;
|
||||
@ -87,7 +86,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;
|
||||
bool stepIsOdd = 1;
|
||||
|
||||
byte displayTab = 0;
|
||||
bool insideTab = false;
|
||||
@ -300,10 +299,10 @@ void sendTriggers() { //rename to onPulse or something
|
||||
playingModesOld[i] = playingModes[i];
|
||||
}
|
||||
}
|
||||
//16th notes for sequencer
|
||||
//16th notes for sequencer and swing
|
||||
if (sixteenthPulseCount == 0) {
|
||||
bool *currentSeq;
|
||||
|
||||
stepIsOdd = !stepIsOdd;
|
||||
for (byte i = 0; i < 6; i++) {
|
||||
|
||||
//pattern modulation
|
||||
@ -418,11 +417,10 @@ 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
|
||||
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);
|
||||
swingBit = !swingBit;
|
||||
}
|
||||
|
||||
if ((channels[i].mode == 0 && channelPulseCount[i] == channels[i].offset) //CLK with offset
|
||||
@ -438,7 +436,6 @@ void sendTriggers() { //rename to onPulse or something
|
||||
channelPulseCount[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void calculateCycles() {
|
||||
@ -452,7 +449,7 @@ void calculateCycles() {
|
||||
}
|
||||
playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards
|
||||
|
||||
if (channels[i].mode == 2 || channels[i].mode == 3) { //Sequencer and swing plays 1/16th
|
||||
if (channels[i].mode == 2) { //} || channels[i].mode == 3) { //Sequencer and swing plays 1/16th
|
||||
channelPulsesPerCycle[i] = (PPQN / 4) - 1;
|
||||
} else if (playingModes[i] > 0) {
|
||||
channelPulsesPerCycle[i] = (playingModes[i] * PPQN) - 1;
|
||||
@ -489,6 +486,7 @@ void resetClocks() {
|
||||
tickCount = 0;
|
||||
sixteenthPulseCount = 0;
|
||||
currentStep = 0;
|
||||
stepIsOdd = 1;
|
||||
}
|
||||
|
||||
void saveState() {
|
||||
|
||||
Reference in New Issue
Block a user