# VST2: multiple calls to setLatencySamples()

**URL:** <https://forum.juce.com/t/vst2-multiple-calls-to-setlatencysamples/39088>\
**Category:** Audio Plugins\
**Created:** [April 29, 2020, 2:05pm UTC](https://forum.juce.com/t/vst2-multiple-calls-to-setlatencysamples/39088 "2020-04-29T14:05:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mqtthiqs](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/mqtthiqs/32/14729_2.png) [@mqtthiqs](https://forum.juce.com/u/mqtthiqs)\
**Post date:** [April 29, 2020, 2:05pm UTC](https://forum.juce.com/t/vst2-multiple-calls-to-setlatencysamples/39088/1 "2020-04-29T14:05:43Z")

</div>

Hi there, first post here.

I am running into what seems like bug, specific to Reaper’s VST2 interface. I’d like confirmation that I’m respecting JUCE’s API before reporting it to Cockos.

From a vanilla project, compiled as a VST2 (Legacy) plugin, I put this in my `prepareToPlay`:

```
void EssaiAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) {
    setLatencySamples(0);
    setLatencySamples(1024);
}

```

I know it’s not necessary to put these two calls, but is it correct/supposed to run as expected, as far as JUCE is concerned? It crashes Reaper in certain conditions (offline bounce with ffmpeg backend).

Thanks in advance!
