GUI: add a clock

This commit is contained in:
tildearrow 2022-11-10 01:26:59 -05:00
parent baa3989502
commit 3f2f8a7197
8 changed files with 172 additions and 5 deletions

View file

@ -2359,6 +2359,8 @@ void DivEngine::reset() {
shallStop=false;
shallStopSched=false;
pendingMetroTick=0;
elapsedBars=0;
elapsedBeats=0;
nextSpeed=speed1;
divider=60;
if (curSubSong->customTempo) {
@ -2547,6 +2549,14 @@ int DivEngine::getRow() {
return prevRow;
}
int DivEngine::getElapsedBars() {
return elapsedBars;
}
int DivEngine::getElapsedBeats() {
return elapsedBeats;
}
size_t DivEngine::getCurrentSubSong() {
return curSubSongIndex;
}

View file

@ -351,7 +351,7 @@ class DivEngine {
bool midiOutClock;
int midiOutMode;
int softLockCount;
int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed;
int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed, elapsedBars, elapsedBeats;
size_t curSubSongIndex;
double divider;
int cycles;
@ -709,6 +709,10 @@ class DivEngine {
// get current row
int getRow();
// get beat/bar
int getElapsedBars();
int getElapsedBeats();
// get current subsong
size_t getCurrentSubSong();
@ -1058,6 +1062,8 @@ class DivEngine {
lastLoopPos(0),
exportLoopCount(0),
nextSpeed(3),
elapsedBars(0),
elapsedBeats(0),
curSubSongIndex(0),
divider(60),
cycles(0),

View file

@ -964,10 +964,17 @@ void DivEngine::nextRow() {
}
if (curSubSong->hilightA>0) {
if ((curRow%curSubSong->hilightA)==0) pendingMetroTick=1;
if ((curRow%curSubSong->hilightA)==0) {
pendingMetroTick=1;
elapsedBeats++;
}
}
if (curSubSong->hilightB>0) {
if ((curRow%curSubSong->hilightB)==0) pendingMetroTick=2;
if ((curRow%curSubSong->hilightB)==0) {
pendingMetroTick=2;
elapsedBars++;
elapsedBeats=0;
}
}
prevOrder=curOrder;