An issue regarding the buffer size on iOS was identified and fixed in this thread : Block Size on iOS 8
The correction is available in juce 4.3. This bug fix has a side effect on the mix with other app audio feature.
I’ve made the following test using the AppAppExample available in juce 4.3:
activated the background mode for Audio,Airplay,… and uses bluetooth LE accessories
modified the prepareToPlay method so that the App starts immediately to play a sound
frequency = 400.0;
amplitude = 0.9;
phaseDelta = (float) (2.0 * double_Pi * frequency / sampleRate);
compiled and deploy the app on my ipod touch (iOS 9.3.2)
the App start to play a 400 Hz sound,
I switch to the Music App, the sound is still here,
I start a music, the sinusoid stops and shouldn’t
I stop the music, the sinusoid starts again.
Now I remove the bug fix introduced in juce 4.3 regarding the buffer size in the juce_ios_Audio.cpp (see code above)
the mixing behavior of the App is now back to normal, I can hear both the music from Music App and the sinusoid BUT the bufferSize is back to 1156.
I can’t go further to identify what is wrong with the bug fix regarding the bufferSize.
Thanks for your help
/* AudioUnitInitialize (audioUnit);
AudioUnitSetProperty (audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Global, 0, &actualBufferSize, sizeof (actualBufferSize));
if (AudioUnitGetProperty (audioUnit, kAudioUnitProperty_MaximumFramesPerSlice,
kAudioUnitScope_Global, 0, &framesPerSlice, &dataSize) == noErr
&& dataSize == sizeof (framesPerSlice) && static_cast (framesPerSlice) != actualBufferSize)
actualBufferSize = static_cast (framesPerSlice);
// line restored AudioUnitInitialize (audioUnit);