# Question on ResamplingAudioSource::prepareToPlay

**URL:** <https://forum.juce.com/t/question-on-resamplingaudiosource-preparetoplay/14282>\
**Category:** General JUCE discussion\
**Created:** [February 9, 2015, 3:06pm UTC](https://forum.juce.com/t/question-on-resamplingaudiosource-preparetoplay/14282 "2015-02-09T15:06:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gphofa](https://avatars.discourse-cdn.com/v4/letter/g/3ec8ea/32.png) [@gphofa](https://forum.juce.com/u/gphofa)\
**Post date:** [February 9, 2015, 3:06pm UTC](https://forum.juce.com/t/question-on-resamplingaudiosource-preparetoplay/14282/1 "2015-02-09T15:06:07Z")

</div>

Hi

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.

&nbsp;

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

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

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

&nbsp;

Best Regards,

Gregor

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 24, 2015, 12:42pm UTC](https://forum.juce.com/t/question-on-resamplingaudiosource-preparetoplay/14282/2 "2015-02-24T12:42:27Z")

</div>

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