I’m working on an audio plugin that plays back a large amount of samples. I’m including about 800 wav files using BinaryData.
I’m playing back about 48 samples at the same time (overlapping voices, different mic positions being played back in parallel etc) , and for every “cluster” there’s always a new set of samples (due to velocity layers, round robins etc). I’ve got it working, but I’m hitting the DSP meter in the host DAW big-time…
My current approach is to use MemoryInputStream–>AudioFormatReader–>AudioFormatReaderSource–>AudioTransportSource. Additionally I’m using resampling in the AudioTransportSource.
This means that every time I “load” a sample (i e reconfigure a voice to play a different sample) I have to allocate three new stream objects, since you can’t for example point an existing MemoryInputStream to a different memory block… So the only object I can reuse are the AudioTransportSources in each voice.
I’m wondering if there’s a more efficient approach I can take to accomplish all this, preferably without having to allocate any heap memory during processing? Maybe there’s some API or technique that I’ve overlooked?