GUI: better

This commit is contained in:
tildearrow 2023-09-16 15:04:11 -05:00
parent 083f870930
commit b105dd535f
4 changed files with 26 additions and 11 deletions

View file

@ -2166,6 +2166,13 @@ int DivEngine::getRow() {
return prevRow;
}
void DivEngine::getPlayPos(int& order, int& row) {
playPosLock.lock();
order=prevOrder;
row=prevRow;
playPosLock.unlock();
}
int DivEngine::getElapsedBars() {
return elapsedBars;
}

View file

@ -446,7 +446,7 @@ class DivEngine {
// bitfield
unsigned char walked[8192];
bool isMuted[DIV_MAX_CHANS];
std::mutex isBusy, saveLock;
std::mutex isBusy, saveLock, playPosLock;
String configPath;
String configFile;
String lastError;
@ -848,6 +848,9 @@ class DivEngine {
// get current row
int getRow();
// synchronous get order/row
void getPlayPos(int& order, int& row);
// get beat/bar
int getElapsedBars();
int getElapsedBeats();

View file

@ -1164,8 +1164,10 @@ void DivEngine::nextRow() {
}
if (!stepPlay) {
playPosLock.lock();
prevOrder=curOrder;
prevRow=curRow;
playPosLock.unlock();
}
for (int i=0; i<chans; i++) {
@ -1403,8 +1405,10 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
endOfSong=false;
if (stepPlay==2) {
stepPlay=1;
playPosLock.lock();
prevOrder=curOrder;
prevRow=curRow;
playPosLock.unlock();
}
nextRow();
break;