Skip to content

Commit

Permalink
[Fix] Sample tab: Time stretchin didn't update cue points.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22691 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Jan 2, 2025
1 parent 54f2a68 commit 0f05211
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tracklib/TimeStretchPitchShift.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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<SmpLength>((m_sample.nLoopStart - m_start) * m_stretchRatio);
if(m_sample.nLoopEnd > m_start)
m_sample.nLoopEnd = m_start + mpt::saturate_round<SmpLength>((m_sample.nLoopEnd - m_start) * m_stretchRatio);
if(m_sample.nSustainStart > m_start)
m_sample.nSustainStart = m_start + mpt::saturate_round<SmpLength>((m_sample.nSustainStart - m_start) * m_stretchRatio);
if(m_sample.nSustainEnd > m_start)
m_sample.nSustainEnd = m_start + mpt::saturate_round<SmpLength>((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<SmpLength>((cue - m_start) * m_stretchRatio);
}
}
m_sample.SetLoop(
m_sample.nLoopStart,
m_sample.nLoopEnd,
Expand Down

0 comments on commit 0f05211

Please sign in to comment.