#ifndef __ResampleTestPatch_hpp__
#define __ResampleTestPatch_hpp__
#include "Patch.h"
#include "Resample.h"
class ResampleTestPatch : public Patch {
public:
Resampler resampler;
FloatArray up;
FloatArray temp;
int factor;
ResampleTestPatch(){
registerParameter(PARAMETER_A, "do_resample");
registerParameter(PARAMETER_B, "gain");
registerParameter(PARAMETER_C, "master");
factor=4;
int blockSize=getBlockSize();
up=FloatArray::create(factor*blockSize);
}
~ResampleTestPatch(){
FloatArray::destroy(up);
}
void processAudio(AudioBuffer &buffer){
FloatArray samples=buffer.getSamples(0);
if(getParameterValue(PARAMETER_A)<0.5){
return;
}
resampler.upsample(samples,up);
resampler.downsample(up, samples);
}
};
#endif