prepareToPlay numSamples different from getNextAudioBlock buffer size


#1

I got the latest juce code from GitHub yesterday, and the audio handling (on iOS) seems to have been broken.

In my prepareToPlay function, samplesPerBlockExpected is 128,

but the callback from juce_AudioDeviceManager (audioDeviceIOCallback) has numSamples set to 512.

This used to work with Juce 4.0 (haven't checked 4.1 yet)

Is this a work in progress? 


#2

prepareToPlay is a method of AudioProcessor, not AudioDeviceIOCallback, so what mechanism are you using to connect the device manager to your plugin class?


#3

here's a partial call stack


#1    0x0000000106fab0b6 in juce::AudioSourcePlayer::prepareToPlay(double, int) at

#2    0x0000000106fab037 in juce::AudioSourcePlayer::audioDeviceAboutToStart(juce::AudioIODevice*) 

#3    0x0000000106fa7db6 in juce::AudioDeviceManager::audioDeviceAboutToStartInt(juce::AudioIODevice*) 

#4    0x0000000106fafb01 in juce::AudioDeviceManager::CallbackHandler::audioDeviceAboutToStart(juce::AudioIODevice*)

 

basically, when AudioDeviceManager::audioDeviceAboutToStartInt calls audioDeviceAboutToStart, it's device parameter's actualBufferSize member is 128

 

does this help? 


#4

This is a strange one. It seems that the iOS audio classes just always make the callback using a 512 byte buffer, regardless of the buffer size that the device is using.. Really not sure what can be done about that, the buffer size is definitely set correctly.

(BTW in looking into it just now I spotted and fixed another bug where it seemed to fail to set the correct buffer size)