fix endOfSong inconsistency

fixes #719
This commit is contained in:
tildearrow 2022-10-22 03:31:03 -05:00
parent 0ce746d1d3
commit b073368b21

View file

@ -1042,6 +1042,8 @@ void DivEngine::runExportThread() {
curOrder=0; curOrder=0;
prevOrder=0; prevOrder=0;
curFadeOutSample=0; curFadeOutSample=0;
lastLoopPos=-1;
totalLoops=0;
isFadingOut=false; isFadingOut=false;
if (exportFadeOut<=0.01) { if (exportFadeOut<=0.01) {
remainingLoops=loopCount; remainingLoops=loopCount;
@ -1984,10 +1986,14 @@ void DivEngine::getCommandStream(std::vector<DivCommand>& where) {
} }
void DivEngine::playSub(bool preserveDrift, int goalRow) { void DivEngine::playSub(bool preserveDrift, int goalRow) {
logV("playSub() called");
std::chrono::high_resolution_clock::time_point timeStart=std::chrono::high_resolution_clock::now(); std::chrono::high_resolution_clock::time_point timeStart=std::chrono::high_resolution_clock::now();
for (int i=0; i<song.systemLen; i++) disCont[i].dispatch->setSkipRegisterWrites(false); for (int i=0; i<song.systemLen; i++) disCont[i].dispatch->setSkipRegisterWrites(false);
reset(); reset();
if (preserveDrift && curOrder==0) return; if (preserveDrift && curOrder==0) {
logV("preserveDrift && curOrder is true");
return;
}
bool oldRepeatPattern=repeatPattern; bool oldRepeatPattern=repeatPattern;
repeatPattern=false; repeatPattern=false;
int goal=curOrder; int goal=curOrder;
@ -2000,9 +2006,7 @@ void DivEngine::playSub(bool preserveDrift, int goalRow) {
prevDrift=clockDrift; prevDrift=clockDrift;
clockDrift=0; clockDrift=0;
cycles=0; cycles=0;
if (preserveDrift) { if (!preserveDrift) {
endOfSong=false;
} else {
ticks=1; ticks=1;
tempoAccum=0; tempoAccum=0;
totalTicks=0; totalTicks=0;
@ -2011,6 +2015,7 @@ void DivEngine::playSub(bool preserveDrift, int goalRow) {
totalLoops=0; totalLoops=0;
lastLoopPos=-1; lastLoopPos=-1;
} }
endOfSong=false;
speedAB=false; speedAB=false;
playing=true; playing=true;
skipping=true; skipping=true;