From 22aaaeb836dfb0b0cef47357d4e8cd55b29bbfdf Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 27 Dec 2017 17:57:00 +0200 Subject: [PATCH] Got rid of unnecessary buffers. There may have at some point been some reason to do it like that though... --- Source/PS_Source/StretchSource.cpp | 19 ++----------------- Source/PS_Source/StretchSource.h | 1 - 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index 4acb06a..1707f08 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -219,15 +219,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer { readed = m_inputfile->readNextBlock(m_file_inbuf, readsize, m_num_outchans); } - auto inbufptrs = m_file_inbuf.getArrayOfReadPointers(); - for (int ch = 0; ch < m_num_outchans; ++ch) - { - int inchantouse = ch; - for (int i = 0; i < readed; i++) - { - m_inbufs[ch][i] = inbufptrs[inchantouse][i]; - } - } + auto inbufptrs = m_file_inbuf.getArrayOfWritePointers(); REALTYPE onset_max = std::numeric_limits::min(); #ifdef USE_PPL_TO_PROCESS_STRETCHERS std::array onset_values_arr; @@ -241,7 +233,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer #else for (int i = 0; i < m_stretchers.size(); ++i) { - REALTYPE onset_l = m_stretchers[i]->process(m_inbufs[i].data(), readed); + REALTYPE onset_l = m_stretchers[i]->process(inbufptrs[i], readed); onset_max = std::max(onset_max, onset_l); } #endif @@ -442,15 +434,8 @@ void StretchAudioSource::initObjects() fill_container(m_stretchers[i]->out_buf, 0.0f); m_stretchers[i]->m_spectrum_processes = m_specproc_order; } - m_inbufs.resize(m_num_outchans); m_file_inbuf.setSize(m_num_outchans, 3 * inbufsize); int poolsize = m_stretchers[0]->get_max_bufsize(); - for (int i = 0; i < m_num_outchans; ++i) - { - m_inbufs[i].resize(poolsize); - fill_container(m_inbufs[i],0.0f); - } - } double StretchAudioSource::getInfilePositionPercent() diff --git a/Source/PS_Source/StretchSource.h b/Source/PS_Source/StretchSource.h index 3b687cb..312a58a 100644 --- a/Source/PS_Source/StretchSource.h +++ b/Source/PS_Source/StretchSource.h @@ -107,7 +107,6 @@ private: std::unique_ptr m_inputfile; std::vector> m_stretchers; std::unique_ptr m_binaubeats; - float2dvector m_inbufs; std::function SourceEndedCallback; bool m_firstbuffer = false; bool m_output_has_begun = false;