Got rid of unnecessary buffers. There may have at some point been some reason to do it like that though...

This commit is contained in:
xenakios 2017-12-27 17:57:00 +02:00
parent 7dcf9831f2
commit 22aaaeb836
2 changed files with 2 additions and 18 deletions

View File

@ -219,15 +219,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
{ {
readed = m_inputfile->readNextBlock(m_file_inbuf, readsize, m_num_outchans); readed = m_inputfile->readNextBlock(m_file_inbuf, readsize, m_num_outchans);
} }
auto inbufptrs = m_file_inbuf.getArrayOfReadPointers(); auto inbufptrs = m_file_inbuf.getArrayOfWritePointers();
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];
}
}
REALTYPE onset_max = std::numeric_limits<REALTYPE>::min(); REALTYPE onset_max = std::numeric_limits<REALTYPE>::min();
#ifdef USE_PPL_TO_PROCESS_STRETCHERS #ifdef USE_PPL_TO_PROCESS_STRETCHERS
std::array<REALTYPE, 16> onset_values_arr; std::array<REALTYPE, 16> onset_values_arr;
@ -241,7 +233,7 @@ void StretchAudioSource::getNextAudioBlock(const AudioSourceChannelInfo & buffer
#else #else
for (int i = 0; i < m_stretchers.size(); ++i) 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); onset_max = std::max(onset_max, onset_l);
} }
#endif #endif
@ -442,15 +434,8 @@ void StretchAudioSource::initObjects()
fill_container(m_stretchers[i]->out_buf, 0.0f); fill_container(m_stretchers[i]->out_buf, 0.0f);
m_stretchers[i]->m_spectrum_processes = m_specproc_order; m_stretchers[i]->m_spectrum_processes = m_specproc_order;
} }
m_inbufs.resize(m_num_outchans);
m_file_inbuf.setSize(m_num_outchans, 3 * inbufsize); m_file_inbuf.setSize(m_num_outchans, 3 * inbufsize);
int poolsize = m_stretchers[0]->get_max_bufsize(); 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() double StretchAudioSource::getInfilePositionPercent()

View File

@ -107,7 +107,6 @@ private:
std::unique_ptr<AInputS> m_inputfile; std::unique_ptr<AInputS> m_inputfile;
std::vector<std::shared_ptr<ProcessedStretch>> m_stretchers; std::vector<std::shared_ptr<ProcessedStretch>> m_stretchers;
std::unique_ptr<BinauralBeats> m_binaubeats; std::unique_ptr<BinauralBeats> m_binaubeats;
float2dvector m_inbufs;
std::function<void(StretchAudioSource*)> SourceEndedCallback; std::function<void(StretchAudioSource*)> SourceEndedCallback;
bool m_firstbuffer = false; bool m_firstbuffer = false;
bool m_output_has_begun = false; bool m_output_has_begun = false;