Fill a buffer from a wave file data

I'm trying to fill a buffer with a wav file data, but I can get any samples. I don't get any compilation or debugger errors so I don´t know why it dont works.

This is the code I`m using:


if (chooser.browseForFileToOpen()) {
            File file (chooser.getResult());
            buffer=new AudioSampleBuffer(1,formatManager.createReaderFor (file)->lengthInSamples);
            formatManager.createReaderFor (file)->read(buffer,0,formatManager.createReaderFor (file)->lengthInSamples,0,false,true);

Thanks for your help!!

How are you checking if the samples have been loaded to the buffer? And is there a reason why you have "useReaderLeftChan" set to false?

You're also failing to check for null pointers, and you're leaking reader objects.. Maybe start by tightening up your basic c++ and it might become clearer what's wrong.

Yes I don´t need the data from the left channel, and when I get sample count I get a 0;

Ok maybe that´s a good idea thanks jules.