fix arpeggio not resetting note to base on 0000

This commit is contained in:
tildearrow 2022-03-17 16:37:49 -05:00
parent 9dea093052
commit d63f3d311b
5 changed files with 30 additions and 9 deletions

View File

@ -37,8 +37,8 @@
warnings+=(String("\n")+x); \
}
#define DIV_VERSION "dev68"
#define DIV_ENGINE_VERSION 68
#define DIV_VERSION "dev69"
#define DIV_ENGINE_VERSION 69
// for imports
#define DIV_VERSION_MOD 0xff01
@ -78,7 +78,8 @@ struct DivChannelState {
int vibratoDepth, vibratoRate, vibratoPos, vibratoDir, vibratoFine;
int tremoloDepth, tremoloRate, tremoloPos;
unsigned char arp, arpStage, arpTicks;
bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff, arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, noteOnInhibit;
bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff;
bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, noteOnInhibit, resetArp;
DivChannelState():
note(-1),
@ -119,7 +120,8 @@ struct DivChannelState {
inPorta(false),
scheduledSlideReset(false),
shorthandPorta(false),
noteOnInhibit(false) {}
noteOnInhibit(false),
resetArp(false) {}
};
struct DivNoteEvent {

View File

@ -143,6 +143,7 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
ds.brokenDACMode=true;
ds.oneTickCut=false;
ds.newInsTriggersInPorta=true;
ds.arp0Reset=true;
// 1.1 compat flags
if (ds.version>24) {
@ -818,6 +819,9 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
if (ds.version<66) {
ds.newInsTriggersInPorta=false;
}
if (ds.version<69) {
ds.arp0Reset=false;
}
ds.isDMF=false;
reader.readS(); // reserved
@ -1009,7 +1013,11 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
} else {
reader.readC();
}
for (int i=0; i<1; i++) reader.readC();
if (ds.version>=69) {
ds.arp0Reset=reader.readC();
} else {
reader.readC();
}
} else {
for (int i=0; i<20; i++) reader.readC();
}
@ -1828,9 +1836,7 @@ SafeWriter* DivEngine::saveFur() {
w->writeC(song.brokenDACMode);
w->writeC(song.oneTickCut);
w->writeC(song.newInsTriggersInPorta);
for (int i=0; i<1; i++) {
w->writeC(0);
}
w->writeC(song.arp0Reset);
ptrSeek=w->tell();
// instrument pointers (we'll seek here later)

View File

@ -909,6 +909,9 @@ void DivEngine::processRow(int i, bool afterDelay) {
break;
case 0x00: // arpeggio
chan[i].arp=effectVal;
if (chan[i].arp==0 && song.arp0Reset) {
chan[i].resetArp=true;
}
break;
case 0x0c: // retrigger
if (effectVal!=0) {
@ -1335,6 +1338,10 @@ bool DivEngine::nextTick(bool noAccum) {
dispatchCmd(DivCommand(DIV_CMD_NOTE_OFF,i));
}
}
if (chan[i].resetArp) {
dispatchCmd(DivCommand(DIV_CMD_LEGATO,i,chan[i].note));
chan[i].resetArp=false;
}
if (chan[i].arp!=0 && !chan[i].arpYield && chan[i].portaSpeed<1) {
if (--chan[i].arpTicks<1) {
chan[i].arpTicks=song.arpLen;

View File

@ -300,6 +300,7 @@ struct DivSong {
bool brokenDACMode;
bool oneTickCut;
bool newInsTriggersInPorta;
bool arp0Reset;
DivOrders orders;
std::vector<DivInstrument*> ins;
@ -371,7 +372,8 @@ struct DivSong {
continuousVibrato(false),
brokenDACMode(false),
oneTickCut(false),
newInsTriggersInPorta(true) {
newInsTriggersInPorta(true),
arp0Reset(true) {
for (int i=0; i<32; i++) {
system[i]=DIV_SYSTEM_NULL;
systemVol[i]=64;

View File

@ -2197,6 +2197,10 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("behavior changed in 0.6");
}
ImGui::Checkbox("Reset note to base on arpeggio stop",&e->song.arp0Reset);
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("behavior changed in 0.6");
}
}
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_COMPAT_FLAGS;
ImGui::End();