mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
iOS Audio: Ensure current sampleRate and bufferSize are always updated after querying sample rates
The code added in 6f20de5434 was only
executed when no explicit sample rates were set.
Now, the sample rate is always updated after querying available sample
rates and before querying available buffer sizes, so that the buffer
size check is guaranteed to use an up-to-date samplerate value.
This commit is contained in:
parent
9de56d0aab
commit
55fb6dbe62
1 changed files with 7 additions and 4 deletions
|
|
@ -518,10 +518,6 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
|||
|
||||
availableSampleRates.addIfNotAlreadyThere (highestRate);
|
||||
|
||||
// Reset sample rate back to the original, so that we don't end up stuck on the highest rate
|
||||
sampleRate = trySampleRate (sampleRate);
|
||||
bufferSize = getBufferSize (sampleRate);
|
||||
|
||||
AudioUnitAddPropertyListener (audioUnit,
|
||||
kAudioUnitProperty_StreamFormat,
|
||||
dispatchAudioUnitPropertyChange,
|
||||
|
|
@ -553,6 +549,13 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
|||
JUCE_IOS_AUDIO_LOG ("Updating hardware info");
|
||||
|
||||
updateAvailableSampleRates();
|
||||
|
||||
// The sample rate and buffer size may have been affected by
|
||||
// updateAvailableSampleRates(), so try restoring the last good
|
||||
// sample rate
|
||||
sampleRate = trySampleRate (sampleRate);
|
||||
bufferSize = getBufferSize (sampleRate);
|
||||
|
||||
updateAvailableBufferSizes();
|
||||
|
||||
if (deviceType != nullptr)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue