About Synthesiser and Rubberband

Hello, I want to use Rubberband benefits in a Synthesiser class that has 4 sound and voices. I want to apply the same amount of stretching to the 4 samples at the same time.

I have been able to use a Synthesizer with 4 voices and 4 sounds playing at the same time, all are looping (I had to implement custom SamplerSound and SamplerVoice classes to achieve this). Also, I have been able to use Rubberband Library with audioTransportSource. This is an extract of the implementation:

void AudioPlayerPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock)
    {
        transportSource.prepareToPlay(samplesPerBlock, sampleRate);
        
        //RUBBERBAND
        mTempBuffer.setSize(getTotalNumOutputChannels(), samplesPerBlock);
        rb = std::make_unique<RubberBand::RubberBandStretcher> (sampleRate, getTotalNumOutputChannels(), RubberBand::RubberBandStretcher::Option::OptionProcessRealTime, 1, 1);
        rb->reset();
    }

    void AudioPlayerPluginAudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
    {
        ScopedNoDenormals noDenormals;
        auto totalNumInputChannels  = getTotalNumInputChannels();
        auto totalNumOutputChannels = getTotalNumOutputChannels();

        for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
            buffer.clear (i, 0, buffer.getNumSamples());
        
        if (params.getParameterAsValue("Play") == true)
        {
            if (audioFileSource != nullptr)
            {
                transportSource.start();
            }
        }
        else
        {
            transportSource.stop();
            transportSource.setPosition(0.0);
        }
        
        //RUBBERBAND
        auto outputBufferSamples = buffer.getNumSamples();
        auto readPointers = mTempBuffer.getArrayOfReadPointers();
        auto writePointers = buffer.getArrayOfWritePointers();
        auto samplesAvailable = rb->available();
        
        while(samplesAvailable < outputBufferSamples)
        {
            transportSource.getNextAudioBlock (AudioSourceChannelInfo(mTempBuffer));
            rb->process(readPointers, mTempBuffer.getNumSamples(), false);
            samplesAvailable = rb->available();
        }
        
        rb->retrieve(writePointers, buffer.getNumSamples());
    }

Anyone can give me an idea about how can implement rubberband using synthesiser.renderNextBlock, samplerVoice.renderNextBlock or something like that? I haven’t been able to figure out a solution about this…

Thanks in advance!