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.

This commit is contained in:
xenakios 2019-05-15 22:54:12 +03:00
parent 288ab7a6bc
commit b052ee7a10

View File

@ -574,6 +574,7 @@ void StretchAudioSource::initObjects()
void StretchAudioSource::playDrySound(const AudioSourceChannelInfo & bufferToFill) void StretchAudioSource::playDrySound(const AudioSourceChannelInfo & bufferToFill)
{ {
auto bufs = bufferToFill.buffer->getArrayOfWritePointers();
double maingain = Decibels::decibelsToGain(m_main_volume); double maingain = Decibels::decibelsToGain(m_main_volume);
m_inputfile->setXFadeLenSeconds(m_loopxfadelen); m_inputfile->setXFadeLenSeconds(m_loopxfadelen);
double* rsinbuf = nullptr; 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); m_resampler->ResampleOut(m_resampler_outbuf.data(), wanted, bufferToFill.numSamples, m_num_outchans);
for (int i = 0; i < m_num_outchans; ++i) for (int i = 0; i < m_num_outchans; ++i)
for (int j = 0; j < bufferToFill.numSamples; ++j) 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() double StretchAudioSource::getInfilePositionPercent()