add compatibility flag for vol slide reset on targ

et
This commit is contained in:
tildearrow 2026-01-18 19:04:49 -05:00
parent 344f8d3a22
commit ca19c631d9
4 changed files with 26 additions and 7 deletions

View file

@ -2232,24 +2232,34 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
} else if (chan[i].volSpeed<0) {
chan[i].volume=MIN(preSpeedVol,chan[i].volSpeedTarget);
}
chan[i].volSpeed=0;
chan[i].volSpeedTarget=-1;
// COMPAT FLAG: don't stop volume slides after reaching target
// - when enabled, we don't reset the volume speed
if (!song.compatFlags.noVolSlideReset) {
chan[i].volSpeed=0;
chan[i].volSpeedTarget=-1;
}
dispatchCmd(DivCommand(DIV_CMD_HINT_VOLUME,i,chan[i].volume>>8));
dispatchCmd(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
dispatchCmd(DivCommand(DIV_CMD_HINT_VOL_SLIDE,i,0));
}
}
// stop sliding if we reach maximum/minimum volume
// there isn't a compat flag for this yet... sorry...
if (chan[i].volume>chan[i].volMax) {
chan[i].volume=chan[i].volMax;
chan[i].volSpeed=0;
chan[i].volSpeedTarget=-1;
// COMPAT FLAG: don't stop volume slides after reaching target
if (!song.compatFlags.noVolSlideReset) {
chan[i].volSpeed=0;
chan[i].volSpeedTarget=-1;
}
dispatchCmd(DivCommand(DIV_CMD_HINT_VOLUME,i,chan[i].volume>>8));
dispatchCmd(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
dispatchCmd(DivCommand(DIV_CMD_HINT_VOL_SLIDE,i,0));
} else if (chan[i].volume<0) {
chan[i].volSpeed=0;
// COMPAT FLAG: don't stop volume slides after reaching target
if (!song.compatFlags.noVolSlideReset) {
chan[i].volSpeed=0;
chan[i].volSpeedTarget=-1;
}
dispatchCmd(DivCommand(DIV_CMD_HINT_VOL_SLIDE,i,0));
// COMPAT FLAG: legacy volume slides
// - sets volume to max once a vol slide down has finished (thus setting volume to volMax+1)
@ -2259,7 +2269,6 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
} else {
chan[i].volume=0;
}
chan[i].volSpeedTarget=-1;
dispatchCmd(DivCommand(DIV_CMD_VOLUME,i,chan[i].volume>>8));
dispatchCmd(DivCommand(DIV_CMD_HINT_VOLUME,i,chan[i].volume>>8));
} else {

View file

@ -1165,6 +1165,7 @@ void DivCompatFlags::setDefaults() {
oldAlwaysSetVolume=false;
oldSampleOffset=false;
oldCenterRate=true;
noVolSlideReset=false;
}
bool DivCompatFlags::areDefaults() {
@ -1250,6 +1251,7 @@ bool DivCompatFlags::readData(SafeReader& reader) {
CHECK_AND_LOAD_BOOL(oldAlwaysSetVolume);
CHECK_AND_LOAD_BOOL(oldSampleOffset);
CHECK_AND_LOAD_BOOL(oldCenterRate);
CHECK_AND_LOAD_BOOL(noVolSlideReset);
return true;
}
@ -1324,6 +1326,7 @@ void DivCompatFlags::putData(SafeWriter* w) {
CHECK_AND_STORE_BOOL(oldAlwaysSetVolume);
CHECK_AND_STORE_BOOL(oldSampleOffset);
CHECK_AND_STORE_BOOL(oldCenterRate);
CHECK_AND_STORE_BOOL(noVolSlideReset);
String data=c.toString();
w->write("CFLG",4);

View file

@ -255,6 +255,7 @@ struct DivCompatFlags {
bool oldSampleOffset;
// new flags as of dev240
bool oldCenterRate;
bool noVolSlideReset;
void setDefaults();
bool areDefaults();

View file

@ -426,6 +426,12 @@ void FurnaceGUI::drawCompatFlags() {
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("when enabled, the slide effect will not be disabled after it reaches its target."));
}
if (ImGui::Checkbox(_("Don't reset volume slides after reaching target"),&e->song.compatFlags.noVolSlideReset)) {
MARK_MODIFIED;
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip(_("when enabled, volume slide speeds will not be reset after reaching target or bounds."));
}
if (ImGui::Checkbox(_("Continuous vibrato"),&e->song.compatFlags.continuousVibrato)) {
MARK_MODIFIED;
}