Refactor getSamples to return a unique_ptr

This commit is contained in:
Mike Walters
2015-12-29 20:42:32 +00:00
parent c96f542823
commit ceac834103
7 changed files with 20 additions and 22 deletions

View File

@@ -19,10 +19,10 @@
#include "samplebuffer.h"
bool SampleBuffer::getSamples(std::complex<float> *dest, off_t start, off_t length)
std::unique_ptr<std::complex<float>[]> SampleBuffer::getSamples(off_t start, off_t length)
{
std::complex<float> buf[length];
src->getSamples(buf, start, length);
work(buf, dest, length);
return true;
auto samples = src->getSamples(start, length);
std::unique_ptr<std::complex<float>[]> dest(new std::complex<float>[length]);
work(samples.get(), dest.get(), length);
return dest;
}