juce_AudioSampleBuffer.cpp errors

Hi Jules,

Thanks for the wonderful toolkit. You’ve made an audio programming student’s life much easier.

I recently switched from JUCE 1.53 to the current modularized git version. I updated an old project by opening it in the new Introjucer and creating new export targets.

It nearly builds, but I’m getting two main errors.

AudioSampleBuffer sampleBuffer = AudioSampleBuffer(numChannels, numSamples); sampleBuffer.clear(); sampleBuffer.readFromAudioReader(sampleReader, 0, numSamples, 0, 1, 1);

Throws the error “No member named ‘readFromAudioReader’ in ‘juce::AudioSampleBuffer’”. I checked the juce_AudioSampleBuffer.cpp file inside the Audio Basics module, and that method is, in fact, missing. The last method to show up in the file is getRMSLevel();

I’m getting one other error:

[code]if (reader != 0)
currentAudioFileSource = new AudioFormatReaderSource (reader, true);

    // ..and plug it into our transport source
    transportSource.setSource (currentAudioFileSource,
                               32768, // tells it to buffer this many samples ahead

Throws the error “Cannot initialize a parameter of type ‘juce::TimeSliceThread *’ with an lvalue of type ‘double’”. This was code from the JUCE 1.53 Demo for loading transports. How should I fix this?

Thanks for your time.

The reading from an AudioFormatReader directly from an AudioSampleBuffer has moved into the AudioFormatReader class, see AudioFormatReader::read (AudioSampleBuffer*…

AudioTransportSource now needs a user supplied TimeSliceThread and the parameter order has changed a bit, see AudioTransportSource::setSource

If you are basing code on the Juce demo and update the library, it is worth re-checking the demo as Jules normally keeps this up to date with the current code base.

Hope that helps.

Thanks! That fixed it.