From 0f05211b8125c5555f4e3dce1ae428e2da475207 Mon Sep 17 00:00:00 2001 From: Johannes Schultz Date: Thu, 2 Jan 2025 15:42:38 +0000 Subject: [PATCH] [Fix] Sample tab: Time stretchin didn't update cue points. git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22691 56274372-70c3-4bfc-bfc3-4c3a0b034d27 --- tracklib/TimeStretchPitchShift.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tracklib/TimeStretchPitchShift.cpp b/tracklib/TimeStretchPitchShift.cpp index 0b6c6d6edac..dc0cd5ec139 100644 --- a/tracklib/TimeStretchPitchShift.cpp +++ b/tracklib/TimeStretchPitchShift.cpp @@ -10,6 +10,7 @@ #include "stdafx.h" #include "TimeStretchPitchShift.h" +#include "SampleEdit.h" #include "../soundlib/ModSample.h" #include "../soundlib/SampleCopy.h" #include "../soundlib/Sndfile.h" @@ -75,14 +76,14 @@ void Base::FinishProcessing(void *newSampleData) m_sample.ReplaceWaveform(newSampleData, m_newLength, m_sndFile); - if(m_sample.nLoopStart > m_start) - m_sample.nLoopStart = m_start + mpt::saturate_round((m_sample.nLoopStart - m_start) * m_stretchRatio); - if(m_sample.nLoopEnd > m_start) - m_sample.nLoopEnd = m_start + mpt::saturate_round((m_sample.nLoopEnd - m_start) * m_stretchRatio); - if(m_sample.nSustainStart > m_start) - m_sample.nSustainStart = m_start + mpt::saturate_round((m_sample.nSustainStart - m_start) * m_stretchRatio); - if(m_sample.nSustainEnd > m_start) - m_sample.nSustainEnd = m_start + mpt::saturate_round((m_sample.nSustainEnd - m_start) * m_stretchRatio); + if(m_stretchRatio != 1.0) + { + for(SmpLength &cue : SampleEdit::GetCuesAndLoops(m_sample)) + { + if(cue > m_start) + cue = m_start + mpt::saturate_round((cue - m_start) * m_stretchRatio); + } + } m_sample.SetLoop( m_sample.nLoopStart, m_sample.nLoopEnd,