jpcima / ensemble-chorus

Digital model of electronic string ensemble chorus
Boost Software License 1.0
33 stars 2 forks source link

Safe use of buffer size setting #6

Closed jpcima closed 6 years ago

jpcima commented 6 years ago

I must not trust the buffer size to give a maximum dimension to the internal buffers.

According to documentation of class juce::AudioProcessor

The maximumExpectedSamplesPerBlock value is a strong hint about the maximum number of samples that will be provided in each block. You may want to use this value to resize internal buffers. You should program defensively in case a buggy host exceeds this value. The actual block sizes that the host uses may be different each time the callback happens: completely variable block sizes can be expected from some hosts.

Which means, current code is going to crash the stupid hosts. As solution, I can divide processing into smaller individual chunks equal of smaller to buffer size.