Load binary .wav files into AudioSampleBuffer array

Just a tip: Usually you first iterate over number of channels, and inside that (for each channel) over the buffer. In your case you are jumping over channels for each sample giving a much worse memory read performance (sequential reads are faster and produce less cache misses).

About what’s wrong, I usually don’t use that aproach so I can’t tell if something’s missing. What I usually do in processblock, for simplicity, is using buffer.getWritePointer(channel) in the channel loop, and then just use it to write to your buffer. To get what I mean:


for (int ch = 0; ch < numberofChannels; ch++)
{
    auto buffer_ptr = buffer.getWritePointer(ch);
    for (int i = 0; i < bufferSize; i++)
    {
        buffer_ptr[i] = file_ptr[i]; // where file_ptr basically is another pointer to your file's respective channel
    }
}

This part is pretty straightforward so usually it’s about how are you reading the file/having a pointer to access it. Just DBG or std::cout the file_ptr indexes in the loop (i.e file_ptr[i]) as a test to see if you are actually pointing to your file. Or put breakpoints to check all the variables values to get a grasp on what’s going on.

You should also be aware on how you increase the position counter, but since you just advance as many samples as the buffer has in each block, it’s just adding that amount