From: <sv...@op...> - 2024-10-19 21:32:06
|
Author: sagamusix Date: Sat Oct 19 23:31:54 2024 New Revision: 21859 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=21859 Log: [Fix] XM: If key-off is encountered before auto-vibrato sweep reaches full depth, the vibrato depth is reset. Test case: AutoVibratoSweepKeyOff.xm [Mod] OpenMPT: Version is now 1.32.00.29 Modified: trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndmix.cpp trunk/OpenMPT/soundlib/UpgradeModule.cpp Modified: trunk/OpenMPT/common/versionNumber.h ============================================================================== --- trunk/OpenMPT/common/versionNumber.h Sat Oct 19 13:46:07 2024 (r21858) +++ trunk/OpenMPT/common/versionNumber.h Sat Oct 19 23:31:54 2024 (r21859) @@ -16,4 +16,4 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 32 #define VER_MINOR 00 -#define VER_MINORMINOR 28 +#define VER_MINORMINOR 29 Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp ============================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp Sat Oct 19 13:46:07 2024 (r21858) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp Sat Oct 19 23:31:54 2024 (r21859) @@ -79,7 +79,7 @@ BOOL CModTypeDlg::OnInitDialog() { DialogBase::OnInitDialog(); - m_nType = sndFile.GetType(); + m_nType = sndFile.GetBestSaveFormat(); m_nChannels = sndFile.GetNumChannels(); m_tempoSwing = sndFile.m_tempoSwing; m_playBehaviour = sndFile.m_playBehaviour; @@ -732,6 +732,7 @@ case kMIDINotesFromChannelPlugin: desc = _T("MIDI notes can be sent to channel plugins"); break; case kITDoublePortamentoSlides: desc = _T("Parameters of conflicting volume and effect column portamento commands may overwrite each other"); break; case kS3MIgnoreCombinedFineSlides: desc =_T("Ignore combined fine slides (Kxy / Lxy)"); break; + case kFT2AutoVibratoAbortSweep: desc = _T("Key-off before auto-vibrato sweep-in is complete resets auto-vibrato depth"); break; default: MPT_ASSERT_NOTREACHED(); } Modified: trunk/OpenMPT/soundlib/Snd_defs.h ============================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h Sat Oct 19 13:46:07 2024 (r21858) +++ trunk/OpenMPT/soundlib/Snd_defs.h Sat Oct 19 23:31:54 2024 (r21859) @@ -601,6 +601,7 @@ kMIDINotesFromChannelPlugin, // Behaviour before OpenMPT 1.26: Channel plugin can be used to send MIDI notes kITDoublePortamentoSlides, // IT only reads parameters once per row, so if two commands sharing effect parameters are found in the two effect columns, they influence each other kS3MIgnoreCombinedFineSlides, // S3M commands Kxy and Lxy ignore fine slides + kFT2AutoVibratoAbortSweep, // Key-off before auto-vibrato sweep-in is complete resets auto-vibrato depth // Add new play behaviours here. Modified: trunk/OpenMPT/soundlib/Sndfile.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp Sat Oct 19 13:46:07 2024 (r21858) +++ trunk/OpenMPT/soundlib/Sndfile.cpp Sat Oct 19 23:31:54 2024 (r21859) @@ -1242,6 +1242,7 @@ playBehaviour.set(kFT2PanSustainRelease); playBehaviour.set(kFT2NoteDelayWithoutInstr); playBehaviour.set(kFT2PortaResetDirection); + playBehaviour.set(kFT2AutoVibratoAbortSweep); break; case MOD_TYPE_S3M: Modified: trunk/OpenMPT/soundlib/Sndmix.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Sndmix.cpp Sat Oct 19 13:46:07 2024 (r21858) +++ trunk/OpenMPT/soundlib/Sndmix.cpp Sat Oct 19 23:31:54 2024 (r21859) @@ -1848,23 +1848,33 @@ } else { // MPT's autovibrato code + int32 autoVibDepth = chn.nAutoVibDepth; + const int32 fullDepth = pSmp->nVibDepth * 256u; if (pSmp->nVibSweep == 0 && !(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT))) { - chn.nAutoVibDepth = pSmp->nVibDepth * 256; + autoVibDepth = fullDepth; } else { // Calculate current autovibrato depth using vibsweep - if (GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) + if(GetType() & (MOD_TYPE_IT | MOD_TYPE_MPT)) { - chn.nAutoVibDepth += pSmp->nVibSweep * 2u; + autoVibDepth += pSmp->nVibSweep * 2u; + LimitMax(autoVibDepth, fullDepth); + chn.nAutoVibDepth = autoVibDepth; } else { - if(!chn.dwFlags[CHN_KEYOFF]) + if(!chn.dwFlags[CHN_KEYOFF] && autoVibDepth <= fullDepth) { - chn.nAutoVibDepth += (pSmp->nVibDepth * 256u) / pSmp->nVibSweep; + autoVibDepth += fullDepth / pSmp->nVibSweep; + chn.nAutoVibDepth = autoVibDepth; } + // FT2 compatibility: Key-off before auto-vibrato sweep-in is complete resets auto-vibrato depth + // Test case: AutoVibratoSweepKeyOff.xm + if(autoVibDepth > fullDepth) + autoVibDepth = fullDepth; + else if(chn.dwFlags[CHN_KEYOFF] && m_playBehaviour[kFT2AutoVibratoAbortSweep]) + autoVibDepth = fullDepth / pSmp->nVibSweep; } - LimitMax(chn.nAutoVibDepth, static_cast<int>(pSmp->nVibDepth * 256u)); } chn.nAutoVibPos += pSmp->nVibRate; int vdelta; @@ -1896,7 +1906,7 @@ vdelta = (-ITSinusTable[(chn.nAutoVibPos + 192) & 0xFF] + 64) / 2; } } - int n = (vdelta * chn.nAutoVibDepth) / 256; + int n = (vdelta * autoVibDepth) / 256; if(hasTuning) { Modified: trunk/OpenMPT/soundlib/UpgradeModule.cpp ============================================================================== --- trunk/OpenMPT/soundlib/UpgradeModule.cpp Sat Oct 19 13:46:07 2024 (r21858) +++ trunk/OpenMPT/soundlib/UpgradeModule.cpp Sat Oct 19 23:31:54 2024 (r21859) @@ -625,6 +625,7 @@ { kFT2NoteDelayWithoutInstr, MPT_V("1.28.00.44") }, { kITFT2DontResetNoteOffOnPorta, MPT_V("1.29.00.34") }, { kFT2PortaResetDirection, MPT_V("1.30.00.40") }, + { kFT2AutoVibratoAbortSweep, MPT_V("1.32.00.29") }, }; for(const auto &b : behaviours) |