Whats up with juce::dsp::Gain?

Isnt it a horrible idea that the dsp::Gain class allocates a numSamples * sizeof(SampleType) amount of memory every time the processblock is getting called?

Am I missing something?

Edit: *when there is more than one channel

Hi!
It’s using alloca, so memory is allocated on the stack, not on the heap. This should be practically free and efficient as long as your buffers don’t get too large. It’s debatable whether this is really good practice.

1 Like

thats what I was thinking about, since its very usual to have a buffer size of 2048