Browse Source

Fixed an unexpected buffer size change after detecting available sample rates on iOS

tags/2021-05-28
tpoole 8 years ago
parent
commit
d5c019e983
1 changed files with 10 additions and 11 deletions
  1. +10
    -11
      modules/juce_audio_devices/native/juce_ios_Audio.cpp

+ 10
- 11
modules/juce_audio_devices/native/juce_ios_Audio.cpp View File

@@ -251,6 +251,8 @@ public:
Array<double> getAvailableSampleRates()
{
const ScopedLock sl (callbackLock);
Array<double> rates;
// Important: the supported audio sample rates change on the iPhone 6S
@@ -269,23 +271,20 @@ public:
{
const double supportedRate = trySampleRate (rate);
rates.addIfNotAlreadyThere (supportedRate);
if (rates.addIfNotAlreadyThere (supportedRate))
JUCE_IOS_AUDIO_LOG ("available rate = " + String (supportedRate, 0) + "Hz");
rate = jmax (rate, supportedRate);
}
trySampleRate (owner.getCurrentSampleRate());
updateCurrentBufferSize();
AudioUnitAddPropertyListener (audioUnit,
kAudioUnitProperty_StreamFormat,
handleStreamFormatChangeCallback,
this);
for (auto r : rates)
{
ignoreUnused (r);
JUCE_IOS_AUDIO_LOG ("available rate = " + String (r, 0) + "Hz");
}
return rates;
}
@@ -866,10 +865,10 @@ private:
// array in this application's .plist file.
jassert (err == noErr);
err = AudioUnitAddPropertyListener(audioUnit,
kAudioUnitProperty_IsInterAppConnected,
audioUnitPropertyChangeDispatcher,
this);
err = AudioUnitAddPropertyListener (audioUnit,
kAudioUnitProperty_IsInterAppConnected,
audioUnitPropertyChangeDispatcher,
this);
jassert (err == noErr);
#endif


Loading…
Cancel
Save