From: <sv...@op...> - 2024-05-11 19:16:26
|
Author: sagamusix Date: Sat May 11 21:16:14 2024 New Revision: 20760 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20760 Log: [Fix] IT: Do not got back to sample sustain loop on portamento-ed note after key-off (test cases: SampleSustainAfterPorta.it, SampleSustainAfterPortaCompatGxx.it, SampleSustainAfterPortaInstrMode.it) [Mod] OpenMPT: Version is now 1.32.00.13 Modified: trunk/OpenMPT/common/versionNumber.h trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Snd_defs.h trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/UpgradeModule.cpp Modified: trunk/OpenMPT/common/versionNumber.h ============================================================================== --- trunk/OpenMPT/common/versionNumber.h Sat May 11 17:31:57 2024 (r20759) +++ trunk/OpenMPT/common/versionNumber.h Sat May 11 21:16:14 2024 (r20760) @@ -18,6 +18,6 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 32 #define VER_MINOR 00 -#define VER_MINORMINOR 12 +#define VER_MINORMINOR 13 OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp ============================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp Sat May 11 17:31:57 2024 (r20759) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp Sat May 11 21:16:14 2024 (r20760) @@ -709,6 +709,7 @@ case kITResetFilterOnPortaSmpChange: desc = _T("Reset filter on portamento if new note plays a different sample"); break; case kITInitialNoteMemory: desc = _T("Initial Last Note Memory of each channel is C-0 instead of No Note"); break; case kPluginDefaultProgramAndBank1: desc = _T("Assume initial plugin MIDI program and bank number is 1"); break; + case kITNoSustainOnPortamento: desc = _T("Portamento after note-off does not re-enable sample sustain loop"); break; default: MPT_ASSERT_NOTREACHED(); } Modified: trunk/OpenMPT/soundlib/Snd_defs.h ============================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h Sat May 11 17:31:57 2024 (r20759) +++ trunk/OpenMPT/soundlib/Snd_defs.h Sat May 11 21:16:14 2024 (r20760) @@ -565,6 +565,7 @@ kITResetFilterOnPortaSmpChange, // Filter is reset on portamento if sample is swapped kITInitialNoteMemory, // Initial "last note memory" for each channel is C-0 and not "no note" kPluginDefaultProgramAndBank1, // Default program and bank is set to 1 for plugins, so if an instrument is set to either of those, the program / bank change event is not sent to the plugin + kITNoSustainOnPortamento, // Do not re-enable sustain loop on portamento, even when switching between samples // Add new play behaviours here. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Sat May 11 17:31:57 2024 (r20759) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Sat May 11 21:16:14 2024 (r20760) @@ -1595,9 +1595,15 @@ return; } + const bool wasKeyOff = chn.dwFlags[CHN_KEYOFF]; + // Tone-Portamento doesn't reset the pingpong direction flag if(bPorta && pSmp == chn.pModSample && pSmp != nullptr) { + // IT compatibility: Instrument change but sample stays the same: still reset the key-off flags + // Test case: SampleSustainAfterPortaInstrMode.it + if(instrumentChanged && pIns && m_playBehaviour[kITNoSustainOnPortamento]) + chn.dwFlags.reset(CHN_KEYOFF | CHN_NOTEFADE); // If channel length is 0, we cut a previous sample using SCx. In that case, we have to update sample length, loop points, etc... if(GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT) && chn.nLength != 0) return; @@ -1706,7 +1712,9 @@ } chn.m_PortamentoFineSteps = 0; - if(chn.dwFlags[CHN_SUSTAINLOOP]) + // IT compatibility: Do not reset sustain loop status when using portamento after key-off + // Test case: SampleSustainAfterPorta.it, SampleSustainAfterPortaCompatGxx.it, SampleSustainAfterPortaInstrMode.it + if(chn.dwFlags[CHN_SUSTAINLOOP] && (!m_playBehaviour[kITNoSustainOnPortamento] || !bPorta || (pIns && !wasKeyOff))) { chn.nLoopStart = pSmp->nSustainStart; chn.nLoopEnd = pSmp->nSustainEnd; Modified: trunk/OpenMPT/soundlib/Sndfile.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp Sat May 11 17:31:57 2024 (r20759) +++ trunk/OpenMPT/soundlib/Sndfile.cpp Sat May 11 21:16:14 2024 (r20760) @@ -1124,6 +1124,10 @@ switch(type) { case MOD_TYPE_MPT: + playBehaviour.set(kOPLFlexibleNoteOff); + playBehaviour.set(kOPLwithNNA); + playBehaviour.set(kOPLNoteOffOnNoteChange); + [[fallthrough]]; case MOD_TYPE_IT: playBehaviour.set(MSF_COMPATIBLE_PLAY); playBehaviour.set(kPeriodsAreHertz); @@ -1178,12 +1182,7 @@ playBehaviour.set(kITPitchPanSeparation); playBehaviour.set(kITResetFilterOnPortaSmpChange); playBehaviour.set(kITInitialNoteMemory); - if(type == MOD_TYPE_MPT) - { - playBehaviour.set(kOPLFlexibleNoteOff); - playBehaviour.set(kOPLwithNNA); - playBehaviour.set(kOPLNoteOffOnNoteChange); - } + playBehaviour.set(kITNoSustainOnPortamento); break; case MOD_TYPE_XM: Modified: trunk/OpenMPT/soundlib/UpgradeModule.cpp ============================================================================== --- trunk/OpenMPT/soundlib/UpgradeModule.cpp Sat May 11 17:31:57 2024 (r20759) +++ trunk/OpenMPT/soundlib/UpgradeModule.cpp Sat May 11 21:16:14 2024 (r20760) @@ -596,6 +596,7 @@ { kITPitchPanSeparation, MPT_V("1.30.00.53") }, { kITResetFilterOnPortaSmpChange, MPT_V("1.30.08.02") }, { kITInitialNoteMemory, MPT_V("1.31.00.25") }, + { kITNoSustainOnPortamento, MPT_V("1.32.00.13") }, }; for(const auto &b : behaviours) |