From: <sv...@op...> - 2025-05-24 21:56:34
|
Author: sagamusix Date: Sat May 24 23:56:21 2025 New Revision: 23168 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=23168 Log: [Imp] Avoid clicks on sample transition e.g. when doing a portamento between two different samples. The old note doesn't get an NNA channel assigned in this case, so the end-of-sample fade-out was missing. Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp ============================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp Sat May 17 21:51:38 2025 (r23167) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp Sat May 24 23:56:21 2025 (r23168) @@ -3098,6 +3098,15 @@ if(!m_playBehaviour[kITInstrWithNoteOff] || ModCommand::IsNote(note)) chn.nNewIns = 0; } + // When swapping samples without explicit note change (e.g. during portamento), avoid clicks at end of sample (as there won't be an NNA channel to fade the sample out) + if(oldSample != nullptr && oldSample != chn.pModSample) + { + m_dryLOfsVol += chn.nLOfs; + m_dryROfsVol += chn.nROfs; + chn.nLOfs = 0; + chn.nROfs = 0; + } + if(m_playBehaviour[kITPortamentoSwapResetsPos]) { // Test cases: PortaInsNum.it, PortaSample.it |