Use FrameLib_DSP::Allocator and not a context allocator for composed functioanility

This commit is contained in:
Alex Harker
2019-08-30 12:09:31 +01:00
parent b24b282f45
commit 9ee3c9e261
4 changed files with 10 additions and 10 deletions
@@ -11,7 +11,7 @@ public:
// Constructor
FrameLib_RingBuffer(FrameLib_Context context) : FrameLib_VectorSet(context), mCounter(0)
FrameLib_RingBuffer(FrameLib_DSP *owner) : FrameLib_VectorSet(owner), mCounter(0)
{}
public:
@@ -2,7 +2,7 @@
#ifndef FRAMELIB_VECTORSET_H
#define FRAMELIB_VECTORSET_H
#include "FrameLib_Context.h"
#include "FrameLib_DSP.h"
class FrameLib_VectorSet
{
@@ -11,7 +11,7 @@ public:
// Constructor
FrameLib_VectorSet(FrameLib_Context context) : mFrames(nullptr), mNumFrames(0), mFrameLength(0), mAllocator(context)
FrameLib_VectorSet(FrameLib_DSP *owner) : mFrames(nullptr), mNumFrames(0), mFrameLength(0), mAllocator(*owner)
{}
~FrameLib_VectorSet()
@@ -45,20 +45,19 @@ private:
double *allocVector(unsigned long N)
{
return reinterpret_cast<double *>(mAllocator->alloc(sizeof(double) * N));
return mAllocator.allocate<double>(N);
}
void deallocVector(double *& ptr)
{
mAllocator->dealloc(ptr);
ptr = nullptr;
mAllocator.deallocate(ptr);
}
double *mFrames;
unsigned long mNumFrames;
unsigned long mFrameLength;
FrameLib_Context::Allocator mAllocator;
FrameLib_DSP::Allocator mAllocator;
};
#endif
@@ -1,7 +1,7 @@
#include "FrameLib_Lag.h"
FrameLib_Lag::FrameLib_Lag(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy) : FrameLib_Processor(context, proxy, &sParamInfo, 2, 1), FrameLib_RingBuffer(context)
FrameLib_Lag::FrameLib_Lag(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy) : FrameLib_Processor(context, proxy, &sParamInfo, 2, 1), FrameLib_RingBuffer(this)
{
mParameters.addInt(kMaxFrames, "max_frames", 10, 0);
mParameters.setMin(1);
@@ -5,7 +5,8 @@
#include "FrameLib_RingBuffer.h"
#include "FrameLib_DSP.h"
template <class T> class FrameLib_TimeBuffer : public FrameLib_Processor, private FrameLib_RingBuffer
template <class T>
class FrameLib_TimeBuffer : public FrameLib_Processor, private FrameLib_RingBuffer
{
const int sMaxFrames = 0;
const int sNumFrames = 1;
@@ -25,7 +26,7 @@ public:
// Constructor
FrameLib_TimeBuffer(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy) : FrameLib_Processor(context, proxy, &sParamInfo, 2, 1), FrameLib_RingBuffer(context), mLastNumFrames(0)
FrameLib_TimeBuffer(FrameLib_Context context, FrameLib_Parameters::Serial *serialisedParameters, FrameLib_Proxy *proxy) : FrameLib_Processor(context, proxy, &sParamInfo, 2, 1), FrameLib_RingBuffer(this), mLastNumFrames(0)
{
mParameters.addInt(sMaxFrames, "max_frames", 10, 0);
mParameters.setMin(1);