From: <sv...@op...> - 2024-05-28 16:40:21
|
Author: sagamusix Date: Mon May 27 21:34:41 2024 New Revision: 20863 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=20863 Log: [Fix] IT compatibility: Offset with instrument number but no note plays offset effect with previous note (https://bugs.openmpt.org/view.php?id=1785). 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 Sun May 26 22:50:38 2024 (r20862) +++ trunk/OpenMPT/common/versionNumber.h Mon May 27 21:34:41 2024 (r20863) @@ -18,6 +18,6 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 32 #define VER_MINOR 00 -#define VER_MINORMINOR 14 +#define VER_MINORMINOR 15 OPENMPT_NAMESPACE_END Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp ============================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp Sun May 26 22:50:38 2024 (r20862) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp Mon May 27 21:34:41 2024 (r20863) @@ -711,6 +711,7 @@ 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; case kITEmptyNoteMapSlotIgnoreCell: desc = _T("Ignore pattern cell completely when trying to play unmapped instrument note"); break; + case kITOffsetWithInstrNumber: desc = _T("Offset command with instrument number recalls offset with last note"); break; default: MPT_ASSERT_NOTREACHED(); } Modified: trunk/OpenMPT/soundlib/Snd_defs.h ============================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h Sun May 26 22:50:38 2024 (r20862) +++ trunk/OpenMPT/soundlib/Snd_defs.h Mon May 27 21:34:41 2024 (r20863) @@ -590,6 +590,7 @@ 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 kITEmptyNoteMapSlotIgnoreCell, // IT ignores the entire pattern cell when trying to play an unmapped note of an instrument + kITOffsetWithInstrNumber, // IT applies offset commands even if just an instrument number without note is present // Add new play behaviours here. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Sun May 26 22:50:38 2024 (r20862) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Mon May 27 21:34:41 2024 (r20863) @@ -5683,13 +5683,14 @@ param /= 2u; } - if(chn.rowCommand.IsNote() || m_playBehaviour[kApplyOffsetWithoutNote]) + const auto note = (m_playBehaviour[kITOffsetWithInstrNumber] && chn.rowCommand.instr) ? chn.nNewNote : chn.rowCommand.note; + if(ModCommand::IsNote(note) || m_playBehaviour[kApplyOffsetWithoutNote]) { // IT compatibility: If this note is not mapped to a sample, ignore it. // Test case: empty_sample_offset.it - if(chn.pModInstrument != nullptr && chn.rowCommand.IsNote()) + if(chn.pModInstrument != nullptr && ModCommand::IsNote(note)) { - SAMPLEINDEX smp = chn.pModInstrument->Keyboard[chn.rowCommand.note - NOTE_MIN]; + SAMPLEINDEX smp = chn.pModInstrument->Keyboard[note - NOTE_MIN]; if(smp == 0 || smp > GetNumSamples()) return; } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp Sun May 26 22:50:38 2024 (r20862) +++ trunk/OpenMPT/soundlib/Sndfile.cpp Mon May 27 21:34:41 2024 (r20863) @@ -1184,6 +1184,7 @@ playBehaviour.set(kITInitialNoteMemory); playBehaviour.set(kITNoSustainOnPortamento); playBehaviour.set(kITEmptyNoteMapSlotIgnoreCell); + playBehaviour.set(kITOffsetWithInstrNumber); break; case MOD_TYPE_XM: Modified: trunk/OpenMPT/soundlib/UpgradeModule.cpp ============================================================================== --- trunk/OpenMPT/soundlib/UpgradeModule.cpp Sun May 26 22:50:38 2024 (r20862) +++ trunk/OpenMPT/soundlib/UpgradeModule.cpp Mon May 27 21:34:41 2024 (r20863) @@ -598,6 +598,7 @@ { kITInitialNoteMemory, MPT_V("1.31.00.25") }, { kITNoSustainOnPortamento, MPT_V("1.32.00.13") }, { kITEmptyNoteMapSlotIgnoreCell, MPT_V("1.32.00.13") }, + { kITOffsetWithInstrNumber, MPT_V("1.32.00.15") }, }; for(const auto &b : behaviours) |