iOS: bug setting buffer size


#1

Jules,

There's a bug in juce_ios_Audio.cpp which prevents apps from changing audio latency:

125:  setSessionFloat64Property (kAudioSessionProperty_PreferredHardwareIOBufferDuration, preferredBufferSize / sampleRate);

The property is a Float32 not a Float64, so changing line 125 for this fixes the problem:

Float32 sz = preferredBufferSize/sampleRate;

OSStatus err = AudioSessionSetProperty(
                  kAudioSessionProperty_PreferredHardwareIOBufferDuration, 
                  sizeof(sz), 
                  &sz);

if (noErr!=err)
    DBG("Failed to set preferred audio buffer duration");

Dave.


#2

Ah, good one, thanks!


#3

Thanks from me too - I've been struggling with this for a while