Block size and sample rate bug in JuceVSTWrapper


JuceVSTWrapper overides setBlockSize() and set the size in bufferSize

void setBlockSize (long newSize)
bufferSize = newSize;

but then does not use the saved value in bufferSize but rather use the one in the AudioEffect

void resume()

sampleRate = getSampleRate();
bufferSize = getBlockSize();

    filter->prepareToPlay (sampleRate, bufferSize);

the result is that the plugin gets wrong block size (always 1024 in my case) and sometimes crashes if the audio driver uses buffers longer than 1024 (in my case when I used the diretx and not asio so it was confusing)

it took me long time to track :idea:

anyway isn’t it better just to drop the setBlockSize/setSampleRate from JuceVSTWrapper, I did it here and the bug is gone


Thanks for that! Silly bug on my part there.

I’m really busy right now, no time to post a new version, but you’re right - if you chop out the setBlockSize() and setSampleRate() methods it should work ok.