From b052ee7a1032ede26fd13dd52f74f90d81cd0fda Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 15 May 2019 22:54:12 +0300 Subject: [PATCH] Use raw buffer pointers instead of setSample. Note to self : remember to avoid using setSample and just use the damn array of pointers because setSample does the AudioBuffer flag setting and that can slow things down. --- Source/PS_Source/StretchSource.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index 90dcc60..3e3187a 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -574,6 +574,7 @@ void StretchAudioSource::initObjects() void StretchAudioSource::playDrySound(const AudioSourceChannelInfo & bufferToFill) { + auto bufs = bufferToFill.buffer->getArrayOfWritePointers(); double maingain = Decibels::decibelsToGain(m_main_volume); m_inputfile->setXFadeLenSeconds(m_loopxfadelen); double* rsinbuf = nullptr; @@ -586,7 +587,7 @@ void StretchAudioSource::playDrySound(const AudioSourceChannelInfo & bufferToFil m_resampler->ResampleOut(m_resampler_outbuf.data(), wanted, bufferToFill.numSamples, m_num_outchans); for (int i = 0; i < m_num_outchans; ++i) for (int j = 0; j < bufferToFill.numSamples; ++j) - bufferToFill.buffer->setSample(i, j + bufferToFill.startSample, maingain * m_resampler_outbuf[j*m_num_outchans + i]); + bufs[i][j + bufferToFill.startSample] = maingain * m_resampler_outbuf[j*m_num_outchans + i]; } double StretchAudioSource::getInfilePositionPercent()