Update its to buggy to do with out properly buffering in a synth voice so i just did sample by sample
void MySamplerVoice::renderNextBlock(AudioBuffer<float>& outputBuffer, int startSample, int numSamples) {
if(auto* sound = static_cast<MySamplerSound*> (getCurrentlyPlayingSound().get())) {
auto& data = *sound->odata;
float* outL = outputBuffer.getWritePointer (0, startSample);
float* outR = outputBuffer.getNumChannels() > 1 ? outputBuffer.getWritePointer (1, startSample) : nullptr;
while(--numSamples >= 0) {
const float* const inL = data.getReadPointer (0, sourceSamplePosition);
const float* const inR = data.getNumChannels() > 1 ? data.getReadPointer (1,sourceSamplePosition) : nullptr;
float tl[1] = {0.0};
float tr[1] = {0.0};
float l = ResamplerL.process(pitchRatio, inL, tl, 1);
float r = 0.0;
if(outR != nullptr) {
r = ResamplerR.process(pitchRatio, inR, tr, 1);
*outL++ = tl[0];
*outR++ = tr[0];
}else{
*outL++ = (tl[0] + tr[0]) * 0.5;
}
sourceSamplePosition += pitchRatio;
if(sourceSamplePosition > sound->length) {
sourceSamplePosition = 0;
stopNote(0.0, false);
}
}
}
}