diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index c062d22c8..3ead7a688 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -156,7 +156,17 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul return "FFxx: Stop song"; default: if ((effect&0xf0)==0x90) { - return "9xxx: Set sample offset*256"; + if (song.oldSampleOffset) { + return "9xxx: Set sample offset*256"; + } + switch (effect) { + case 0x90: + return "90xx: Set sample offset (first byte)"; + case 0x91: + return "91xx: Set sample offset (second byte, ×256)"; + case 0x92: + return "92xx: Set sample offset (third byte, ×65536)"; + } } else if (chan>=0 && chaneffectHandlers.find(effect); @@ -562,8 +572,8 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool ol // extra attributes song.subsong[0]->hz=c.getDouble("tickRate",60.0); - if (song.subsong[0]->hz<1.0) song->subsong[0]->hz=1.0; - if (song.subsong[0]->hz>999.0) song->subsong[0]->hz=999.0; + if (song.subsong[0]->hz<1.0) song.subsong[0]->hz=1.0; + if (song.subsong[0]->hz>999.0) song.subsong[0]->hz=999.0; song.author=getConfString("defaultAuthorName",""); } diff --git a/src/engine/engine.h b/src/engine/engine.h index 06d7e57d3..72ce8d266 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -54,8 +54,8 @@ class DivWorkPool; #define DIV_UNSTABLE -#define DIV_VERSION "dev199" -#define DIV_ENGINE_VERSION 199 +#define DIV_VERSION "dev200" +#define DIV_ENGINE_VERSION 200 // for imports #define DIV_VERSION_MOD 0xff01 #define DIV_VERSION_FC 0xff02 @@ -105,9 +105,10 @@ struct DivChannelState { int delayOrder, delayRow, retrigSpeed, retrigTick; int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoDir, vibratoFine; int tremoloDepth, tremoloRate, tremoloPos; + int sampleOff; unsigned char arp, arpStage, arpTicks, panL, panR, panRL, panRR, lastVibrato, lastPorta, cutType; bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff, releasing; - bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, wasShorthandPorta, noteOnInhibit, resetArp; + bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, wasShorthandPorta, noteOnInhibit, resetArp, sampleOffSet; bool wentThroughNote, goneThroughNote; int midiNote, curMidiNote, midiPitch; @@ -141,6 +142,7 @@ struct DivChannelState { tremoloDepth(0), tremoloRate(0), tremoloPos(0), + sampleOff(0), arp(0), arpStage(-1), arpTicks(1), @@ -167,6 +169,7 @@ struct DivChannelState { wasShorthandPorta(false), noteOnInhibit(false), resetArp(false), + sampleOffSet(false), wentThroughNote(false), goneThroughNote(false), midiNote(-1), diff --git a/src/engine/fileOps/fur.cpp b/src/engine/fileOps/fur.cpp index 0cd32fa76..7a51166b6 100644 --- a/src/engine/fileOps/fur.cpp +++ b/src/engine/fileOps/fur.cpp @@ -861,6 +861,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) { if (ds.version<191) { ds.oldAlwaysSetVolume=true; } + if (ds.version<200) { + ds.oldSampleOffset=true; + } ds.isDMF=false; reader.readS(); // reserved @@ -1414,7 +1417,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len, int variantID) { } else { reader.readC(); } - for (int i=0; i<1; i++) { + if (ds.version>=200) { + ds.oldSampleOffset=reader.readC(); + } else { reader.readC(); } } @@ -2402,9 +2407,7 @@ SafeWriter* DivEngine::saveFur(bool notPrimary, bool newPatternFormat) { w->writeC(song.resetArpPhaseOnNewNote); w->writeC(song.ceilVolumeScaling); w->writeC(song.oldAlwaysSetVolume); - for (int i=0; i<1; i++) { - w->writeC(0); - } + w->writeC(song.oldSampleOffset); // speeds of first song w->writeC(subSong->speeds.len); diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index 38187cfe7..e5f83a5b3 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -654,6 +654,7 @@ void DivEngine::processRow(int i, bool afterDelay) { bool calledPorta=false; bool panChanged=false; bool surroundPanChanged=false; + bool sampleOffSet=false; // effects for (int j=0; j ins; std::vector wave; @@ -456,7 +457,8 @@ struct DivSong { oldDPCM(false), resetArpPhaseOnNewNote(false), ceilVolumeScaling(false), - oldAlwaysSetVolume(false) { + oldAlwaysSetVolume(false), + oldSampleOffset(false) { for (int i=0; i