Buffer.getWritePointer sampleIndex argument

So am curious to what the second argument in the getWritePointer means,
Type* AudioBuffer< Type >::getWritePointer (int channelNumber, int sampleIndex)
The documentation states

`Returns a writeable pointer to one of the buffer's channels.` 

But that’s the same for the single argument version above it.

My question is, does the second argument sampleIndex mean that a single WritePointer is returned rather than an array? If so does doing something like this make sense? Does it return a one element array?

 for (int i = 0; i < bufferLength; i++)
{
    for (int channel = 0; channel < totalNumInputChannels; ++channel)
    {
        auto* channelData = buffer.getWritePointer(channel, i);
        channelData[0] *= mSliderDelayGain;
    }
}

Thanks!

Both return a pointer to a buffer. The sampleIndex makes the buffer having an offset, i.e. the channelData [0] points to the element at sampleIndex in the original buffer.

1 Like

That makes more sense thinking of it as an offset! Much appreciated.