I am happily working through the JUCE tutorials and have a quick question about a bit of code. This is probably a C++ thing that I need to learn (I am coming from java).
In the code below, buffer is set up as a pointer (to a location/offset in bufferToFill?) but is then used as the name of an array in the for loop that creates to noise data. Is buffer a pointer or an array … or both? It compiles and runs OK so I can use as a template, but I would just like to understand how this bit of code works.
Thanks
void getNextAudioBlock (const AudioSourceChannelInfo& bufferToFill) override
{
for (int channel = 0; channel < bufferToFill.buffer->getNumChannels(); ++channel)
{
// Get a pointer to the start sample in the buffer for this audio output channel
float* const buffer = bufferToFill.buffer->getWritePointer (channel, bufferToFill.startSample);
// Fill the required number of samples with noise betweem -0.125 and +0.125
for (int sample = 0; sample < bufferToFill.numSamples; ++sample)
buffer[sample] = random.nextFloat() * 0.25f - 0.125f;
}
}

