better loop tracking
This commit is contained in:
parent
8d8f26d4f7
commit
5523a43804
|
@ -1419,14 +1419,20 @@ void DivEngine::setLoops(int loops) {
|
||||||
remainingLoops=loops;
|
remainingLoops=loops;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivEngine::playSub() {
|
void DivEngine::playSub(bool preserveDrift) {
|
||||||
reset();
|
reset();
|
||||||
|
if (preserveDrift && curOrder==0) return;
|
||||||
int goal=curOrder;
|
int goal=curOrder;
|
||||||
curOrder=0;
|
curOrder=0;
|
||||||
curRow=0;
|
curRow=0;
|
||||||
|
int prevDrift=clockDrift;
|
||||||
clockDrift=0;
|
clockDrift=0;
|
||||||
cycles=0;
|
cycles=0;
|
||||||
|
if (preserveDrift) {
|
||||||
|
endOfSong=false;
|
||||||
|
} else {
|
||||||
ticks=1;
|
ticks=1;
|
||||||
|
}
|
||||||
speedAB=false;
|
speedAB=false;
|
||||||
playing=true;
|
playing=true;
|
||||||
dispatch->setSkipRegisterWrites(true);
|
dispatch->setSkipRegisterWrites(true);
|
||||||
|
@ -1435,14 +1441,20 @@ void DivEngine::playSub() {
|
||||||
}
|
}
|
||||||
dispatch->setSkipRegisterWrites(false);
|
dispatch->setSkipRegisterWrites(false);
|
||||||
dispatch->forceIns();
|
dispatch->forceIns();
|
||||||
|
if (preserveDrift) {
|
||||||
|
clockDrift=prevDrift;
|
||||||
|
} else {
|
||||||
clockDrift=0;
|
clockDrift=0;
|
||||||
|
}
|
||||||
|
if (!preserveDrift) {
|
||||||
cycles=0;
|
cycles=0;
|
||||||
ticks=1;
|
ticks=1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::play() {
|
void DivEngine::play() {
|
||||||
isBusy.lock();
|
isBusy.lock();
|
||||||
playSub();
|
playSub(false);
|
||||||
isBusy.unlock();
|
isBusy.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1682,7 +1694,7 @@ void DivEngine::setOrder(unsigned char order) {
|
||||||
curOrder=order;
|
curOrder=order;
|
||||||
if (order>=song.ordersLen) curOrder=0;
|
if (order>=song.ordersLen) curOrder=0;
|
||||||
if (playing) {
|
if (playing) {
|
||||||
playSub();
|
playSub(false);
|
||||||
}
|
}
|
||||||
isBusy.unlock();
|
isBusy.unlock();
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@ class DivEngine {
|
||||||
bool perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal);
|
bool perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal);
|
||||||
void renderSamples();
|
void renderSamples();
|
||||||
void reset();
|
void reset();
|
||||||
void playSub();
|
void playSub(bool preserveDrift);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DivSong song;
|
DivSong song;
|
||||||
|
|
|
@ -697,7 +697,7 @@ bool DivEngine::nextTick() {
|
||||||
if (--ticks<=0) {
|
if (--ticks<=0) {
|
||||||
ret=endOfSong;
|
ret=endOfSong;
|
||||||
if (endOfSong) {
|
if (endOfSong) {
|
||||||
reset();
|
playSub(true);
|
||||||
}
|
}
|
||||||
endOfSong=false;
|
endOfSong=false;
|
||||||
nextRow();
|
nextRow();
|
||||||
|
|
Loading…
Reference in a new issue