Skip to content

Commit fca02af

Browse files
committed
AudioProcessing: Fixed loop end cut formula
Otherwise, result was incorrect sometimes
1 parent 73dc8e5 commit fca02af

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

_common/AudioProcessor/audio_processor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,9 +356,9 @@ bool MoondustAudioProcessor::runChunk(bool dry)
356356
const auto &source = m_in_file->getSpec();
357357
size_t sample_in = (SDL_AUDIO_BITSIZE(source.m_sample_format) / 8) * source.m_channels;
358358

359-
if(source.m_loop_end > 0 && m_stat_read + amount > (source.m_loop_end * sample_in))
359+
if(source.m_loop_end > 0 && m_stat_read + amount > (source.m_loop_end * sample_in) + sample_in)
360360
{
361-
amount = m_stat_read + amount - (source.m_loop_end * sample_in);
361+
amount = (source.m_loop_end * sample_in) - m_stat_read + sample_in;
362362
m_cuttedAtLoop = true;
363363
}
364364
}

0 commit comments

Comments
 (0)