get rid of some custom tempo legacy

This commit is contained in:
tildearrow 2023-06-11 18:57:32 -05:00
parent 7f0dc576d8
commit c83232f8da
5 changed files with 16 additions and 57 deletions

View file

@ -1444,9 +1444,6 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool ol
// extra attributes // extra attributes
song.subsong[0]->hz=c.getDouble("tickRate",60.0); song.subsong[0]->hz=c.getDouble("tickRate",60.0);
if (song.subsong[0]->hz!=60.0) {
song.subsong[0]->customTempo=true;
}
} }
void DivEngine::createNew(const char* description, String sysName, bool inBase64) { void DivEngine::createNew(const char* description, String sysName, bool inBase64) {
@ -2696,16 +2693,7 @@ void DivEngine::reset() {
elapsedBars=0; elapsedBars=0;
elapsedBeats=0; elapsedBeats=0;
nextSpeed=speeds.val[0]; nextSpeed=speeds.val[0];
divider=60;
if (curSubSong->customTempo) {
divider=curSubSong->hz; divider=curSubSong->hz;
} else {
if (curSubSong->pal) {
divider=60;
} else {
divider=50;
}
}
globalPitch=0; globalPitch=0;
for (int i=0; i<song.systemLen; i++) { for (int i=0; i<song.systemLen; i++) {
disCont[i].dispatch->reset(); disCont[i].dispatch->reset();
@ -2920,14 +2908,7 @@ const DivGroovePattern& DivEngine::getSpeeds() {
} }
float DivEngine::getHz() { float DivEngine::getHz() {
if (curSubSong->customTempo) {
return curSubSong->hz; return curSubSong->hz;
} else if (curSubSong->pal) {
return 60.0;
} else {
return 50.0;
}
return 60.0;
} }
float DivEngine::getCurHz() { float DivEngine::getCurHz() {
@ -4354,23 +4335,11 @@ void DivEngine::updateSysFlags(int system, bool restart) {
BUSY_END; BUSY_END;
} }
void DivEngine::setSongRate(float hz, bool pal) { void DivEngine::setSongRate(float hz) {
BUSY_BEGIN; BUSY_BEGIN;
saveLock.lock(); saveLock.lock();
curSubSong->pal=!pal;
curSubSong->hz=hz; curSubSong->hz=hz;
// what?
curSubSong->customTempo=true;
divider=60;
if (curSubSong->customTempo) {
divider=curSubSong->hz; divider=curSubSong->hz;
} else {
if (curSubSong->pal) {
divider=60;
} else {
divider=50;
}
}
saveLock.unlock(); saveLock.unlock();
BUSY_END; BUSY_END;
} }

View file

@ -954,7 +954,7 @@ class DivEngine {
void updateSysFlags(int system, bool restart); void updateSysFlags(int system, bool restart);
// set Hz // set Hz
void setSongRate(float hz, bool pal); void setSongRate(float hz);
// set remaining loops. -1 means loop forever. // set remaining loops. -1 means loop forever.
void setLoops(int loops); void setLoops(int loops);

View file

@ -220,20 +220,22 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.subsong[0]->hilightB=reader.readC(); ds.subsong[0]->hilightB=reader.readC();
} }
bool customTempo=false;
ds.subsong[0]->timeBase=reader.readC(); ds.subsong[0]->timeBase=reader.readC();
ds.subsong[0]->speeds.len=2; ds.subsong[0]->speeds.len=2;
ds.subsong[0]->speeds.val[0]=reader.readC(); ds.subsong[0]->speeds.val[0]=reader.readC();
if (ds.version>0x07) { if (ds.version>0x07) {
ds.subsong[0]->speeds.val[1]=reader.readC(); ds.subsong[0]->speeds.val[1]=reader.readC();
ds.subsong[0]->pal=reader.readC(); bool pal=reader.readC();
ds.subsong[0]->hz=(ds.subsong[0]->pal)?60:50; ds.subsong[0]->hz=pal?60:50;
ds.subsong[0]->customTempo=reader.readC(); customTempo=reader.readC();
} else { } else {
ds.subsong[0]->speeds.len=1; ds.subsong[0]->speeds.len=1;
} }
if (ds.version>0x0a) { if (ds.version>0x0a) {
String hz=reader.readString(3); String hz=reader.readString(3);
if (ds.subsong[0]->customTempo) { if (customTempo) {
try { try {
ds.subsong[0]->hz=std::stoi(hz); ds.subsong[0]->hz=std::stoi(hz);
} catch (std::exception& e) { } catch (std::exception& e) {
@ -304,7 +306,6 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.subsong[0]->hz=248; ds.subsong[0]->hz=248;
break; break;
} }
ds.subsong[0]->customTempo=true;
ds.subsong[0]->timeBase=0; ds.subsong[0]->timeBase=0;
addWarning("Yamaha YMU759 emulation is incomplete! please migrate your song to the OPL3 system."); addWarning("Yamaha YMU759 emulation is incomplete! please migrate your song to the OPL3 system.");
} }
@ -1864,8 +1865,6 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
subSong->speeds.val[1]=reader.readC(); subSong->speeds.val[1]=reader.readC();
subSong->arpLen=reader.readC(); subSong->arpLen=reader.readC();
subSong->hz=reader.readF(); subSong->hz=reader.readF();
subSong->pal=(subSong->hz>=53);
subSong->customTempo=true;
subSong->patLen=reader.readS(); subSong->patLen=reader.readS();
subSong->ordersLen=reader.readS(); subSong->ordersLen=reader.readS();
@ -2489,8 +2488,6 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
subSong->speeds.val[1]=reader.readC(); subSong->speeds.val[1]=reader.readC();
subSong->arpLen=reader.readC(); subSong->arpLen=reader.readC();
subSong->hz=reader.readF(); subSong->hz=reader.readF();
subSong->pal=(subSong->hz>=53);
subSong->customTempo=true;
subSong->patLen=reader.readS(); subSong->patLen=reader.readS();
subSong->ordersLen=reader.readS(); subSong->ordersLen=reader.readS();
@ -3322,9 +3319,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
ds.subsong[0]->pat[ch].effectCols=fxCols; ds.subsong[0]->pat[ch].effectCols=fxCols;
} }
ds.subsong[0]->pal=false;
ds.subsong[0]->hz=50; ds.subsong[0]->hz=50;
ds.subsong[0]->customTempo=false;
ds.systemLen=(chCount+3)/4; ds.systemLen=(chCount+3)/4;
for(int i=0; i<ds.systemLen; i++) { for(int i=0; i<ds.systemLen; i++) {
ds.system[i]=DIV_SYSTEM_AMIGA; ds.system[i]=DIV_SYSTEM_AMIGA;
@ -3547,7 +3542,6 @@ bool DivEngine::loadS3M(unsigned char* file, size_t len) {
ds.subsong[0]->speeds.val[0]=(unsigned char)reader.readC(); ds.subsong[0]->speeds.val[0]=(unsigned char)reader.readC();
ds.subsong[0]->hz=((double)reader.readC())/2.5; ds.subsong[0]->hz=((double)reader.readC())/2.5;
ds.subsong[0]->customTempo=true;
unsigned char masterVol=reader.readC(); unsigned char masterVol=reader.readC();
@ -3993,8 +3987,6 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
ds.subsong[0]->ordersLen=seqLen; ds.subsong[0]->ordersLen=seqLen;
ds.subsong[0]->patLen=32; ds.subsong[0]->patLen=32;
ds.subsong[0]->hz=50; ds.subsong[0]->hz=50;
ds.subsong[0]->pal=true;
ds.subsong[0]->customTempo=true;
ds.subsong[0]->pat[3].effectCols=3; ds.subsong[0]->pat[3].effectCols=3;
ds.subsong[0]->speeds.val[0]=3; ds.subsong[0]->speeds.val[0]=3;
ds.subsong[0]->speeds.len=1; ds.subsong[0]->speeds.len=1;
@ -5820,11 +5812,13 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
w->writeC(curSubSong->hilightA); w->writeC(curSubSong->hilightA);
w->writeC(curSubSong->hilightB); w->writeC(curSubSong->hilightB);
int intHz=curSubSong->hz;
w->writeC(curSubSong->timeBase); w->writeC(curSubSong->timeBase);
w->writeC(curSubSong->speeds.val[0]); w->writeC(curSubSong->speeds.val[0]);
w->writeC((curSubSong->speeds.len>=2)?curSubSong->speeds.val[1]:curSubSong->speeds.val[0]); w->writeC((curSubSong->speeds.len>=2)?curSubSong->speeds.val[1]:curSubSong->speeds.val[0]);
w->writeC(curSubSong->pal); w->writeC((intHz<=53)?1:0);
w->writeC(curSubSong->customTempo); w->writeC((intHz!=60 && intHz!=50));
char customHz[4]; char customHz[4];
memset(customHz,0,4); memset(customHz,0,4);
snprintf(customHz,4,"%d",(int)curSubSong->hz); snprintf(customHz,4,"%d",(int)curSubSong->hz);

View file

@ -153,8 +153,6 @@ struct DivSubSong {
unsigned char timeBase, arpLen; unsigned char timeBase, arpLen;
DivGroovePattern speeds; DivGroovePattern speeds;
short virtualTempoN, virtualTempoD; short virtualTempoN, virtualTempoD;
bool pal;
bool customTempo;
float hz; float hz;
int patLen, ordersLen; int patLen, ordersLen;
@ -177,8 +175,6 @@ struct DivSubSong {
arpLen(1), arpLen(1),
virtualTempoN(150), virtualTempoN(150),
virtualTempoD(150), virtualTempoD(150),
pal(true),
customTempo(false),
hz(60.0), hz(60.0),
patLen(64), patLen(64),
ordersLen(1) { ordersLen(1) {

View file

@ -56,7 +56,7 @@ void FurnaceGUI::drawSpeed(bool asChild) {
if (tempoView) setHz/=2.5; if (tempoView) setHz/=2.5;
if (setHz<1) setHz=1; if (setHz<1) setHz=1;
if (setHz>999) setHz=999; if (setHz>999) setHz=999;
e->setSongRate(setHz,setHz<52); e->setSongRate(setHz);
} }
if (tempoView) { if (tempoView) {
ImGui::SameLine(); ImGui::SameLine();