I'm new to C/C++ and JUCE, and am struggling with simply getting data out of a WAV file and into a vector. Related topics in the forum appear to offer solutions that have since been deprecated.
I've tested whether or not all the pieces appear to be in place: the JUCE::File, AudioFormatManager, AudioFormatReader, and FileInputStream all check out in terms of the metadata of my dummy file (number of samples, sample rate, channels, etc.), and they appear to be talking to each other just fine. I'm at the point where I've created an AudioSampleBuffer for reading from the FileInputStream, but I can't figure out what's going wrong with how I'm implementing FileInputStream->read. I've posted a snippet of code below; happy to post more if it'll help.
//Creates sample buffer for one channel and 1 second of samples
AudioSampleBuffer buffer(1, 48000);
//Loads 1 second of samples into buffer
if (mInputStream->getTotalLength()> 0)
I've also tried:
mAudioReader->read(&buffer, 1, 0, 48000, true, true);
In both cases, when I iterate through samples in the buffer, every value is 0.0. Can anybody help by telling me what I'm doing wrong, and how to do it right?