mirror of https://github.com/AxioDL/boo.git
LtRtProcessing: Simplify allocations in LtRtProcessing constructor
We can use std::make_unique, which provides the same behavior as zeroing out the buffer. Now we can remove the use of memset here.
This commit is contained in:
parent
f8e827fcd4
commit
f4fafbcb26
|
@ -239,19 +239,16 @@ LtRtProcessing::LtRtProcessing(int _5msFrames, const AudioVoiceEngineMixInfo& mi
|
|||
m_inMixInfo.m_channelMap.m_channels[3] = AudioChannel::RearLeft;
|
||||
m_inMixInfo.m_channelMap.m_channels[4] = AudioChannel::RearRight;
|
||||
|
||||
int samples = m_windowFrames * (5 * 2 + 2 * 2);
|
||||
const int samples = m_windowFrames * (5 * 2 + 2 * 2);
|
||||
switch (mixInfo.m_sampleFormat) {
|
||||
case SOXR_INT16_I:
|
||||
m_16Buffer.reset(new int16_t[samples]);
|
||||
memset(m_16Buffer.get(), 0, sizeof(int16_t) * samples);
|
||||
m_16Buffer = std::make_unique<int16_t[]>(samples);
|
||||
break;
|
||||
case SOXR_INT32_I:
|
||||
m_32Buffer.reset(new int32_t[samples]);
|
||||
memset(m_32Buffer.get(), 0, sizeof(int32_t) * samples);
|
||||
m_32Buffer = std::make_unique<int32_t[]>(samples);
|
||||
break;
|
||||
case SOXR_FLOAT32_I:
|
||||
m_fltBuffer.reset(new float[samples]);
|
||||
memset(m_fltBuffer.get(), 0, sizeof(float) * samples);
|
||||
m_fltBuffer = std::make_unique<float[]>(samples);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue