Problem : collection of multiple AudioBuffer<float>, each one with a different size

Hi everyone,
i want to make clear that i’m pretty new to Juce and i have still a lot to learn.

I’m currently building a vst reverb and the idea was to use multiple delay lines (AudioBuffer), each one with a different size.

I can’t figure out how to create an array or data structure to actually store, these delay lines and set each one’s size with " .setSize(getTotalNumInputChannels(), x * sampleRate); ", where x stands for a different multiplier for each delayLine.

Actually seems like in c++ arrays and vectors require each object to have the same exact size so i thought about creating an array of AudioBuffer each one with a max size and then create an array to store the real size of each delay line, but i don’t really want to make things complicate.

My objective is to end up with a data structure where i can access my delay lines with a simple “dataStructure[i]”.

Is it possible to create such a thing? I have read about OwnedArrays but i can’t figure out how to use them properly.

Thanks in advance for every possibile answer.
Best regards.

That’s true, but the size of an AudioBuffer object is constant; the audio data lives in a different bit of memory that the AudioBuffer references.

Try something like this:

std::vector<AudioBuffer<float>> vec;
vec.emplace_back (numChannels, 1 * numSamples);
vec.emplace_back (numChannels, 2 * numSamples);
vec.emplace_back (numChannels, 3 * numSamples);
vec.emplace_back (numChannels, 4 * numSamples);
1 Like

Thank you very much! It seems to work.