[SOLVED] AudioFormatReader causing fifoIndex to go out of range

Hello friends.

Bit of a weird one for me.

I am using pushNextSampleIntoFifo (float sample) method in my project and it was working just fine.

I created a method to read a .wav file into an array:

AudioFormatManager formatManager;
        formatManager.registerBasicFormats();
   AudioBuffer<float> bassdrumBuffer;

File appLocation = File::getSpecialLocation (File::SpecialLocationType::currentExecutableFile);

std::unique_ptr<juce::AudioFormatReader> bassdrumReader (formatManager.createReaderFor (appLocation.getSiblingFile("bassdrum.wav")));

if(bassdrumReader != nullptr)
{
 bassdrumBuffer.setSize ((int) bassdrumReader->numChannels, (int) bassdrumReader->lengthInSamples); 
            bassdrumReader->read(&bassdrumBuffer, 0, (int) bassdrumReader->lengthInSamples, 0, true, true);
            //auto* bassdrumData = bassdrumBuffer.getWritePointer (0, 0);
            auto* bassdrumData = bassdrumBuffer.getWritePointer (0, 0);
}

When bassdrumReader returns a null pointer the app works normally but when it actually points to the file the fifoIndex variable in the pushNextSampleIntoFifo (float sample) method jumps to the value 1146929063.

This may have something to do with channels but I am stuck. Any insight would be most appreciated.

Silly me This line was writing to channel zero which was the same channel being used by pushNextSampleIntoFifo.