Question on ResamplingAudioSource::prepareToPlay



I am just wondering, why the ResamplingAudioSource::prepareToPlay() function just passes the sampleRate parameter to the input

void ResamplingAudioSource::prepareToPlay (int samplesPerBlockExpected,  double sampleRate)

    input->prepareToPlay (samplesPerBlockExpected, sampleRate);



The documentation of that function says:

sampleRate: the sample rate that the output will be used at - this is needed by sources such as tone generators.


So shouldn't the input's prepareToPlay() be called like this?

    input->prepareToPlay (roundToInt(samplesPerBlockExpected * ratio), sampleRate * ratio);

Or should ResamplingAudioSource::prepareToPlay() be called with the samplerate of the input?


Best Regards,






Sorry, just spotted this post. Yes, sounds like you might be right, I'll have a look at that!