Synth rendering blocks of size 0

Hey guys -

Stellar job with all the new changes lately.

Just updated to 4.21 though, and noticed that the synth class is occasionally rendering blocks with 0 samples.

Basically, if it sees a midi event at sample 0, it tries to render the first frame.

See the attached stack trace.

Sounds like this could be an effect of this change which was a result of this discussion.

Definitely, and the new function is great.

I have it set at the default (32 samples), and whatever the setting it clearly shouldn’t be rendering a block with 0 samples.

Probably there just needs to be a check in there somewhere that makes sure the block is at least as big as the minimum.

OK… for some reason it was hard work to figure out the correct logic in that seemingly simple loop, but I’ve pushed something to develop now that I think is now correct!