mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
iOS Audio: Allow specifying a fixed set of preferred sample rates
By defining JUCE_IOS_AUDIO_EXPLICIT_SAMPLERATES, the iOS audio device will always use the requested samplerates instead of querying the current audio device for the samplerates it supports. This is useful because certain hardware (such as the Focusrite iTrack Dock) takes a long time to set new samplerates, which can end up freezing the main thread for significant lengths of time. This approach is inspired by the AUM app for iOS, which appears to provide a fixed list of "allowed" samplerates, rather than querying the device for its allowed samplerates.
This commit is contained in:
parent
3f5862cf17
commit
fd87195941
1 changed files with 13 additions and 1 deletions
|
|
@ -25,7 +25,13 @@ namespace juce
|
|||
|
||||
class iOSAudioIODevice;
|
||||
|
||||
static const char* const iOSAudioDeviceName = "iOS Audio";
|
||||
constexpr const char* const iOSAudioDeviceName = "iOS Audio";
|
||||
|
||||
#ifndef JUCE_IOS_AUDIO_EXPLICIT_SAMPLERATES
|
||||
#define JUCE_IOS_AUDIO_EXPLICIT_SAMPLERATES
|
||||
#endif
|
||||
|
||||
constexpr std::initializer_list<double> iOSExplicitSampleRates { JUCE_IOS_AUDIO_EXPLICIT_SAMPLERATES };
|
||||
|
||||
//==============================================================================
|
||||
struct AudioSessionHolder
|
||||
|
|
@ -356,6 +362,12 @@ struct iOSAudioIODevice::Pimpl : public AudioPlayHead,
|
|||
// depending on whether the headphones are plugged in or not!
|
||||
void updateAvailableSampleRates()
|
||||
{
|
||||
if (iOSExplicitSampleRates.size() != 0)
|
||||
{
|
||||
availableSampleRates = Array<double> (iOSExplicitSampleRates);
|
||||
return;
|
||||
}
|
||||
|
||||
availableSampleRates.clear();
|
||||
|
||||
AudioUnitRemovePropertyListenerWithUserData (audioUnit,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue