getSampledata usage?


I’m unclear on how to use this function, the demo vst example applies a gain to a block of samples using a build function applygain, if I want to write my own dsp function I’m guessing I can use getSampleData however do I need to increment the pointer for each sample. eg

for all samples in the audio buffer do:

float *mysample = output.getSampleData(channel,samplenumber); *mysample++ *= gain; //here the pointer is incremented do i need to do this?
I guess my question is what is the best way to iterate over all the samples in the audiobuffer to apply my own process. The applygain function in juce accesses each sample with the channel command, why not with the getSampleData?

getSampleData() just returns a pointer to the block of samples in one of the buffer’s channels. Iterating them is just basic c++ - it’s up to you how you do that.