hopefuly sequencer with ext clock bug is fixed
This commit is contained in:
@ -61,7 +61,7 @@
|
|||||||
35,
|
35,
|
||||||
36
|
36
|
||||||
],
|
],
|
||||||
"visible_layers": "fffeedf_ffffffff",
|
"visible_layers": "fffeeff_ffffffff",
|
||||||
"zone_display_mode": 0
|
"zone_display_mode": 0
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
|
|||||||
@ -115,8 +115,8 @@ unsigned int pulseCount = 0;
|
|||||||
|
|
||||||
byte masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - MIDI
|
byte masterClockMode = 0; // 0 - internal, 1 - external 24ppqn, 2 - MIDI
|
||||||
byte extClockPPQN = 0; // 0 - 24, 1 - 4 (1/16)
|
byte extClockPPQN = 0; // 0 - 24, 1 - 4 (1/16)
|
||||||
unsigned long lastExtPulseTime;
|
unsigned long lastExtPulseTime = 0;
|
||||||
unsigned long newExtPulseTime;
|
unsigned long newExtPulseTime = 0;
|
||||||
|
|
||||||
bool needPulseReset[6] = { true, true, true, true, true, true };
|
bool needPulseReset[6] = { true, true, true, true, true, true };
|
||||||
|
|
||||||
@ -168,8 +168,8 @@ const uint8_t velvetscreen[437] U8G2_FONT_SECTION("velvetscreen") =
|
|||||||
"\7p\10\255\364V\266\323\2q\7\255\364\216\257\5r\10\253d\242\32*\2t\6\255t\376#w\11"
|
"\7p\10\255\364V\266\323\2q\7\255\364\216\257\5r\10\253d\242\32*\2t\6\255t\376#w\11"
|
||||||
"\255\364V\245FN\13x\6\233dR\7\0\0\0\4\377\377\0";
|
"\255\364V\245FN\13x\6\233dR\7\0\0\0\4\377\377\0";
|
||||||
|
|
||||||
const uint8_t stkL[499] U8G2_FONT_SECTION("stk-l") =
|
const uint8_t stkL[569] U8G2_FONT_SECTION("stk-l") =
|
||||||
"\22\0\4\4\4\5\2\1\6\17\27\1\0\27\0\0\0\1\77\0\0\1\326%'\17\37\313\330R#&"
|
"\25\0\4\4\4\5\2\1\6\17\27\1\0\27\0\0\0\1\77\0\0\2\34%'\17\37\313\330R#&"
|
||||||
"\32!F\14\211I\310\24!\65\204(MF\21)Cd\304\10\62b\14\215\60Vb\334\20\0/\14"
|
"\32!F\14\211I\310\24!\65\204(MF\21)Cd\304\10\62b\14\215\60Vb\334\20\0/\14"
|
||||||
"\272\336\336d\244\350\263q\343\0\60\37|\377\12\32\25\17\2\35\263\253ChD\30\21bB\14\242S"
|
"\272\336\336d\244\350\263q\343\0\60\37|\377\12\32\25\17\2\35\263\253ChD\30\21bB\14\242S"
|
||||||
"\306lv\350A\10\65H\0\61\24z\337\322\60R\205\314\234\31\61F\310\270\371\177\224\42\3\62\33|"
|
"\306lv\350A\10\65H\0\61\24z\337\322\60R\205\314\234\31\61F\310\270\371\177\224\42\3\62\33|"
|
||||||
@ -181,10 +181,12 @@ const uint8_t stkL[499] U8G2_FONT_SECTION("stk-l") =
|
|||||||
"\216)\64*\10\35\263\331!\22D\310\240\62\205\206\10\11B\307lv\210\204\32Tf\0\71\32|\377"
|
"\216)\64*\10\35\263\331!\22D\310\240\62\205\206\10\11B\307lv\210\204\32Tf\0\71\32|\377"
|
||||||
"\216)\64*\10\35\263\263C$\226\250I\71_\14\42\241\6\225\31\0A\26}\17S\271Si(\31"
|
"\216)\64*\10\35\263\263C$\226\250I\71_\14\42\241\6\225\31\0A\26}\17S\271Si(\31"
|
||||||
"\65d\324\210q\366\356\301w\366\273\1B$}\17\203\232%KF\221\30\66b\330\210a#\206\215\30"
|
"\65d\324\210q\366\356\301w\366\273\1B$}\17\203\232%KF\221\30\66b\330\210a#\206\215\30"
|
||||||
"Eb\311&\243H\14;g\317\36\204`\261\4\0E\21|\377\302\7)\347%\42\214F\316/\37<"
|
"Eb\311&\243H\14;g\317\36\204`\261\4\0D\33}\17C\42\65KF\15\31\66b\330\210q"
|
||||||
"\60T\15}\17\303\7\251\206\316\377\377\12\0X)~\37\303@\203\307H\14\33B\210\14\21RC\206"
|
"\366\77;\66b\24\211%j\22\1E\21|\377\302\7)\347%\42\214F\316/\37<\60I\7so"
|
||||||
"\241\63h\222(I\203\346\220\15\31E\204\14!\42\303F\20;h\341\0x\24\312\336\302 CGH"
|
"\302\37$M$}\17\203\310r\346N\245Q\263\202E\12)L\224\60Q\302\310\20#C\214\14\61\23"
|
||||||
"\240\61E\312\14\222)\6Y\64\0\0\0\0\4\377\377\0";
|
"\306L\30s\366\335\0T\15}\17\303\7\251\206\316\377\377\12\0X)~\37\303@\203\307H\14\33B"
|
||||||
|
"\210\14\21RC\206\241\63h\222(I\203\346\220\15\31E\204\14!\42\303F\20;h\341\0x\24\312"
|
||||||
|
"\336\302 CGH\240\61E\312\14\222)\6Y\64\0\0\0\0\4\377\377\0";
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
@ -212,6 +214,8 @@ void setup() {
|
|||||||
calculateCycles();
|
calculateCycles();
|
||||||
calculateBPMTiming();
|
calculateBPMTiming();
|
||||||
|
|
||||||
|
resetClocks();
|
||||||
|
|
||||||
FlexiTimer2::set(1, 1.0 / 1000, clock); // 1.0/1000 = 1ms period. If other than 1ms calculateBPMTiming() might need tweaking
|
FlexiTimer2::set(1, 1.0 / 1000, clock); // 1.0/1000 = 1ms period. If other than 1ms calculateBPMTiming() might need tweaking
|
||||||
FlexiTimer2::start();
|
FlexiTimer2::start();
|
||||||
}
|
}
|
||||||
@ -303,18 +307,17 @@ void externalClock() {
|
|||||||
lastExtPulseTime = newExtPulseTime;
|
lastExtPulseTime = newExtPulseTime;
|
||||||
newExtPulseTime = millis();
|
newExtPulseTime = millis();
|
||||||
|
|
||||||
if (masterClockMode == 1 && extClockPPQN == 0) { // EXT-24
|
if (masterClockMode == 1 && extClockPPQN == 0) { // EXT 24ppqn
|
||||||
//reset cycles if there was no pulses for a while
|
|
||||||
if ((newExtPulseTime - lastExtPulseTime) > 125) { //125ms is 20bpm
|
|
||||||
//for (byte i = 0; i < 6; i++) {
|
|
||||||
//channelPulseCount[i] = 0;
|
|
||||||
//}
|
|
||||||
resetClocks();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isPlaying) {
|
if (!isPlaying) {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//reset cycles if there were no pulses for a while
|
||||||
|
if ((newExtPulseTime - lastExtPulseTime) > 125) { //125ms is 20bpm
|
||||||
|
|
||||||
|
resetClocks();
|
||||||
|
}
|
||||||
|
|
||||||
tickCount = 0; //to make things happen in the main clock function
|
tickCount = 0; //to make things happen in the main clock function
|
||||||
if (pulseCount < (PPQN - 1)) {
|
if (pulseCount < (PPQN - 1)) {
|
||||||
pulseCount++;
|
pulseCount++;
|
||||||
@ -418,7 +421,7 @@ void sendTriggers() {
|
|||||||
} else if (seqPattern == 15) {
|
} else if (seqPattern == 15) {
|
||||||
currentSeq = seqB8;
|
currentSeq = seqB8;
|
||||||
}
|
}
|
||||||
if (channels[i].mode == 2 && channelPulseCount[i] == 0 && currentSeq[currentStep]) {
|
if (channels[i].mode == 2 && currentSeq[currentStep]) { // EXT CLOCK SEQUENCER BUG IS SOMEWHERE HERE ???? && channelPulseCount[i] == 0 might be related to channelPulsesPerCycle not calculated in time
|
||||||
digitalWrite(outsPins[i], HIGH);
|
digitalWrite(outsPins[i], HIGH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,13 +498,14 @@ void calculateCycles() {
|
|||||||
}
|
}
|
||||||
playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards
|
playingModes[i] = subDivs[channels[i].subDiv - mod]; //subtracting because the innitial array is backwards
|
||||||
|
|
||||||
if (playingModes[i] > 0 && channels[i].mode != 2) {
|
if (channels[i].mode == 2) { //Sequencer plays 1/16th
|
||||||
channelPulsesPerCycle[i] = (playingModes[i] * PPQN) - 1;
|
|
||||||
} else if (playingModes[i] <= 0 && channels[i].mode != 2) {
|
|
||||||
channelPulsesPerCycle[i] = (PPQN / abs(playingModes[i])) - 1;
|
|
||||||
} else if (channels[i].mode == 2) { //Sequencer plays 1/16th
|
|
||||||
channelPulsesPerCycle[i] = (PPQN / 4) - 1;
|
channelPulsesPerCycle[i] = (PPQN / 4) - 1;
|
||||||
|
} else if (playingModes[i] > 0) {
|
||||||
|
channelPulsesPerCycle[i] = (playingModes[i] * PPQN) - 1;
|
||||||
|
} else if (playingModes[i] < 0) {
|
||||||
|
channelPulsesPerCycle[i] = (PPQN / abs(playingModes[i])) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -185,8 +185,8 @@ void checkInputs() {
|
|||||||
masterClockMode = masterClockMode + change;
|
masterClockMode = masterClockMode + change;
|
||||||
if (masterClockMode > 100) {
|
if (masterClockMode > 100) {
|
||||||
masterClockMode = 0;
|
masterClockMode = 0;
|
||||||
} else if (masterClockMode > 1) { //Set to 2 to unhide MIDI mode
|
} else if (masterClockMode > 2) { //Set to 1 to hide MIDI mode
|
||||||
masterClockMode = 1;
|
masterClockMode = 2;
|
||||||
}
|
}
|
||||||
saveState();
|
saveState();
|
||||||
} else if (insideTab
|
} else if (insideTab
|
||||||
@ -364,7 +364,6 @@ void checkInputs() {
|
|||||||
if (masterClockMode == 0) {
|
if (masterClockMode == 0) {
|
||||||
calculateBPMTiming();
|
calculateBPMTiming();
|
||||||
resetClocks();
|
resetClocks();
|
||||||
//isPlaying = !isPlaying;
|
|
||||||
if (!isPlaying) {
|
if (!isPlaying) {
|
||||||
isPlaying = true;
|
isPlaying = true;
|
||||||
sendMIDIStart();
|
sendMIDIStart();
|
||||||
|
|||||||
Reference in New Issue
Block a user