AudioFormatReader::read(float *const * destChannels

I am working on a 7.1 multichannel plugin and I want to read the audiofiles for each channel and store them in a buffer.
The first AudioFormatReader::read function allows you to do that, but I’m having some issues with the first argument:

*bool AudioFormatReader::read(float *const * destChannels,

. Description says: an array of float buffers into which the sample data for each channel will be written.
Would be very helpful to get advice on how to declare this!

Link to the function documentation:
(JUCE: AudioFormatReader Class Reference)

You could use an AudioBuffer<float> with the correct length and number of channels, then pass buffer.getArrayOfWritePointers() to AudioFormatReader::read.

Thank you, that works!

Also, I am currently iterating over each Binary file and attempting to place them in the corresponding channel in the storage buffer. In order to use AudioFormatReader::read for multiple channels, it seems as though I would need to have a multichannel inputStream. Do you have any advice on how to achieve this?
(I guess I could potentially have multiples calls to AudioFormatReader::read into a temporary buffer for each channel instead, and then copy that to each channel in the multichannel buffer, but would prefer to avoid that initial step).

Probably easier to explain attaching my code:

        int BinaryDataSize;
        
        for (int i = 0; i < 8; ++i) {
            storageBuffer = BinaryData::getNamedResource(BinaryData::namedResourceList[i], BinaryDataSize);
            auto* inputStream = new MemoryInputStream (storageBuffer, binaryDataSize, false);
            WavAudioFormat format;
            reader = format.createReaderFor (inputStream, true);
        }
        
        reader->read(storageBuffer.getArrayOfWritePointers(), 8, 0, reader->lengthInSamples);

You could do something like (untested):

const auto numChannels = 8;

AudioBuffer<float> storage (numChannels, 0);

for (auto i = 0; i < numChannels; ++i)
{
    auto size = 0;
    auto resource = BinaryData::getNamedResource (BinaryData::namedResourceList[i], size);
    auto inputStream = std::make_unique<MemoryInputStream> (resource, size, false);
    auto reader = rawToUniquePtr (WavAudioFormat().createReaderFor (inputStream.release(), true));
    storage.setSize (storage.getNumChannels(), jmax (storage.getNumSamples(), readder->lengthInSamples), true, true);
    reader->read (storage.getArrayOfWritePointers() + i, 1, 0, reader->lengthInSamples);
}