mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
iOS and macOS: Use consistent capitalisation with @available syntax
This commit is contained in:
parent
e68627c9ed
commit
d0aa6d0486
8 changed files with 23 additions and 23 deletions
|
|
@ -68,13 +68,13 @@ public:
|
||||||
private:
|
private:
|
||||||
static void detach (os_workgroup_t wg, os_workgroup_join_token_s token)
|
static void detach (os_workgroup_t wg, os_workgroup_join_token_s token)
|
||||||
{
|
{
|
||||||
if (@available (macos 11.0, ios 14.0, *))
|
if (@available (macOS 11.0, iOS 14.0, *))
|
||||||
os_workgroup_leave (wg, &token);
|
os_workgroup_leave (wg, &token);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool attach (os_workgroup_t wg, os_workgroup_join_token_s& tokenOut)
|
static bool attach (os_workgroup_t wg, os_workgroup_join_token_s& tokenOut)
|
||||||
{
|
{
|
||||||
if (@available (macos 11.0, ios 14.0, *))
|
if (@available (macOS 11.0, iOS 14.0, *))
|
||||||
{
|
{
|
||||||
if (wg != nullptr && os_workgroup_join (wg, &tokenOut) == 0)
|
if (wg != nullptr && os_workgroup_join (wg, &tokenOut) == 0)
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -220,7 +220,7 @@ size_t AudioWorkgroup::getMaxParallelThreadCount() const
|
||||||
{
|
{
|
||||||
#if JUCE_AUDIOWORKGROUP_TYPES_AVAILABLE
|
#if JUCE_AUDIOWORKGROUP_TYPES_AVAILABLE
|
||||||
|
|
||||||
if (@available (macos 11.0, ios 14.0, *))
|
if (@available (macOS 11.0, iOS 14.0, *))
|
||||||
{
|
{
|
||||||
if (auto wg = WorkgroupProvider::getWorkgroup (*this))
|
if (auto wg = WorkgroupProvider::getWorkgroup (*this))
|
||||||
return (size_t) os_workgroup_max_parallel_threads (wg, nullptr);
|
return (size_t) os_workgroup_max_parallel_threads (wg, nullptr);
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
||||||
JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setActive: enabled
|
JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setActive: enabled
|
||||||
error: &error]);
|
error: &error]);
|
||||||
|
|
||||||
if (@available (ios 18, *))
|
if (@available (iOS 18, *))
|
||||||
{
|
{
|
||||||
if (enabled)
|
if (enabled)
|
||||||
{
|
{
|
||||||
|
|
@ -419,7 +419,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
||||||
// Older iOS versions (iOS 12) seem to require that the requested buffer size is a bit
|
// Older iOS versions (iOS 12) seem to require that the requested buffer size is a bit
|
||||||
// larger than the desired buffer size.
|
// larger than the desired buffer size.
|
||||||
// This breaks on iOS 18, which needs the buffer duration to be as precise as possible.
|
// This breaks on iOS 18, which needs the buffer duration to be as precise as possible.
|
||||||
if (@available (ios 18, *))
|
if (@available (iOS 18, *))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -434,7 +434,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
||||||
// iOS requires additional effort to observe the actual buffer size
|
// iOS requires additional effort to observe the actual buffer size
|
||||||
// change however, it seems the buffer size change will always work
|
// change however, it seems the buffer size change will always work
|
||||||
// so instead we just assume the change will apply eventually
|
// so instead we just assume the change will apply eventually
|
||||||
if (@available (ios 18, *))
|
if (@available (iOS 18, *))
|
||||||
return newBufferSize;
|
return newBufferSize;
|
||||||
|
|
||||||
return getBufferSize (currentSampleRate);
|
return getBufferSize (currentSampleRate);
|
||||||
|
|
@ -449,7 +449,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
||||||
constexpr auto suggestedMin = 64;
|
constexpr auto suggestedMin = 64;
|
||||||
constexpr auto suggestedMax = 4096;
|
constexpr auto suggestedMax = 4096;
|
||||||
|
|
||||||
if (@available (ios 18, *))
|
if (@available (iOS 18, *))
|
||||||
return std::tuple (suggestedMin, suggestedMax);
|
return std::tuple (suggestedMin, suggestedMax);
|
||||||
|
|
||||||
const auto min = tryBufferSize (sampleRate, suggestedMin);
|
const auto min = tryBufferSize (sampleRate, suggestedMin);
|
||||||
|
|
@ -541,11 +541,11 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
|
||||||
|
|
||||||
// On iOS 18 the AVAudioSession sample rate is not always accurate but
|
// On iOS 18 the AVAudioSession sample rate is not always accurate but
|
||||||
// probing the sample rate via an AudioQueue seems to work reliably
|
// probing the sample rate via an AudioQueue seems to work reliably
|
||||||
if (@available (ios 18, *))
|
if (@available (iOS 18, *))
|
||||||
{
|
{
|
||||||
// On iOS 26, things seem to work as expected again,
|
// On iOS 26, things seem to work as expected again,
|
||||||
// so avoid creating an AudioQueue
|
// so avoid creating an AudioQueue
|
||||||
if (@available (ios 26, *))
|
if (@available (iOS 26, *))
|
||||||
return session.sampleRate;
|
return session.sampleRate;
|
||||||
|
|
||||||
return getSampleRateFromAudioQueue().value_or (session.sampleRate);
|
return getSampleRateFromAudioQueue().value_or (session.sampleRate);
|
||||||
|
|
|
||||||
|
|
@ -546,7 +546,7 @@ struct CoreMidiHelpers
|
||||||
std::optional<EndpointInfo> getCachedInfo (const ump::EndpointId& x) const
|
std::optional<EndpointInfo> getCachedInfo (const ump::EndpointId& x) const
|
||||||
{
|
{
|
||||||
#if JUCE_COREMIDI_UMP_ENDPOINT_CAN_BE_BUILT
|
#if JUCE_COREMIDI_UMP_ENDPOINT_CAN_BE_BUILT
|
||||||
if (@available (macos 15, ios 18, *))
|
if (@available (macOS 15, iOS 18, *))
|
||||||
if (const auto iter = virtualEndpoints.find (x); iter != virtualEndpoints.end())
|
if (const auto iter = virtualEndpoints.find (x); iter != virtualEndpoints.end())
|
||||||
return getInfoForEndpoint (iter->second);
|
return getInfoForEndpoint (iter->second);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -627,7 +627,7 @@ struct CoreMidiHelpers
|
||||||
SharedEndpointsImplNative (MIDIClientRef c, ump::EndpointsListener& l)
|
SharedEndpointsImplNative (MIDIClientRef c, ump::EndpointsListener& l)
|
||||||
: client (c), listener (l)
|
: client (c), listener (l)
|
||||||
{
|
{
|
||||||
if (@available (macos 15.0, ios 18.0, *))
|
if (@available (macOS 15.0, iOS 18.0, *))
|
||||||
observers.emplace (*this);
|
observers.emplace (*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -846,7 +846,7 @@ struct CoreMidiHelpers
|
||||||
static std::map<ump::EndpointId, EndpointInfo> findNativeUMPEndpoints()
|
static std::map<ump::EndpointId, EndpointInfo> findNativeUMPEndpoints()
|
||||||
{
|
{
|
||||||
#if JUCE_COREMIDI_UMP_ENDPOINT_CAN_BE_BUILT
|
#if JUCE_COREMIDI_UMP_ENDPOINT_CAN_BE_BUILT
|
||||||
if (@available (macos 15, ios 18, *))
|
if (@available (macOS 15, iOS 18, *))
|
||||||
{
|
{
|
||||||
std::map<ump::EndpointId, EndpointInfo> result;
|
std::map<ump::EndpointId, EndpointInfo> result;
|
||||||
|
|
||||||
|
|
@ -867,7 +867,7 @@ struct CoreMidiHelpers
|
||||||
static std::optional<SInt32> getUMPActiveGroupBitmap ([[maybe_unused]] MIDIEndpointRef r)
|
static std::optional<SInt32> getUMPActiveGroupBitmap ([[maybe_unused]] MIDIEndpointRef r)
|
||||||
{
|
{
|
||||||
#if JUCE_MAC_API_VERSION_CAN_BE_BUILT (14, 0) || JUCE_IOS_API_VERSION_CAN_BE_BUILT (17, 0)
|
#if JUCE_MAC_API_VERSION_CAN_BE_BUILT (14, 0) || JUCE_IOS_API_VERSION_CAN_BE_BUILT (17, 0)
|
||||||
if (@available (macos 14, ios 17, *))
|
if (@available (macOS 14, iOS 17, *))
|
||||||
{
|
{
|
||||||
SInt32 bitmap{};
|
SInt32 bitmap{};
|
||||||
|
|
||||||
|
|
@ -884,7 +884,7 @@ struct CoreMidiHelpers
|
||||||
static bool canTransmitGroupless ([[maybe_unused]] MIDIEndpointRef endpoint)
|
static bool canTransmitGroupless ([[maybe_unused]] MIDIEndpointRef endpoint)
|
||||||
{
|
{
|
||||||
#if JUCE_MAC_API_VERSION_CAN_BE_BUILT (14, 0) || JUCE_IOS_API_VERSION_CAN_BE_BUILT (17, 0)
|
#if JUCE_MAC_API_VERSION_CAN_BE_BUILT (14, 0) || JUCE_IOS_API_VERSION_CAN_BE_BUILT (17, 0)
|
||||||
if (@available (macos 14, ios 17, *))
|
if (@available (macOS 14, iOS 17, *))
|
||||||
{
|
{
|
||||||
SInt32 result;
|
SInt32 result;
|
||||||
if (MIDIObjectGetIntegerProperty (endpoint, kMIDIPropertyUMPCanTransmitGroupless, &result) == noErr)
|
if (MIDIObjectGetIntegerProperty (endpoint, kMIDIPropertyUMPCanTransmitGroupless, &result) == noErr)
|
||||||
|
|
@ -2385,7 +2385,7 @@ struct CoreMidiHelpers
|
||||||
[[maybe_unused]] ump::BlocksAreStatic areStatic) override
|
[[maybe_unused]] ump::BlocksAreStatic areStatic) override
|
||||||
{
|
{
|
||||||
#if JUCE_COREMIDI_UMP_ENDPOINT_CAN_BE_BUILT
|
#if JUCE_COREMIDI_UMP_ENDPOINT_CAN_BE_BUILT
|
||||||
if (@available (macos 15, ios 18, *))
|
if (@available (macOS 15, iOS 18, *))
|
||||||
{
|
{
|
||||||
auto connection = VirtualEndpointImplNative::make (cachedEndpoints,
|
auto connection = VirtualEndpointImplNative::make (cachedEndpoints,
|
||||||
deviceName,
|
deviceName,
|
||||||
|
|
@ -2497,7 +2497,7 @@ struct CoreMidiHelpers
|
||||||
|
|
||||||
bool isVirtualMidiUmpServiceActive() const override
|
bool isVirtualMidiUmpServiceActive() const override
|
||||||
{
|
{
|
||||||
if (@available (macos 15, ios 18, *))
|
if (@available (macOS 15, iOS 18, *))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -746,7 +746,7 @@ public:
|
||||||
if (inDataSize != sizeof (AUMIDIEventListBlock))
|
if (inDataSize != sizeof (AUMIDIEventListBlock))
|
||||||
return kAudioUnitErr_InvalidPropertyValue;
|
return kAudioUnitErr_InvalidPropertyValue;
|
||||||
|
|
||||||
if (@available (macos 12, *))
|
if (@available (macOS 12, *))
|
||||||
eventListOutput.setBlock (*static_cast<const AUMIDIEventListBlock*> (inData));
|
eventListOutput.setBlock (*static_cast<const AUMIDIEventListBlock*> (inData));
|
||||||
|
|
||||||
return noErr;
|
return noErr;
|
||||||
|
|
|
||||||
|
|
@ -664,7 +664,7 @@ private:
|
||||||
return Trait::newFn (std::forward<Args> (args)...); \
|
return Trait::newFn (std::forward<Args> (args)...); \
|
||||||
else if constexpr (__IPHONE_OS_VERSION_MAX_ALLOWED < fullVersion) \
|
else if constexpr (__IPHONE_OS_VERSION_MAX_ALLOWED < fullVersion) \
|
||||||
return Trait::oldFn (std::forward<Args> (args)...); \
|
return Trait::oldFn (std::forward<Args> (args)...); \
|
||||||
else if (@available (ios major ## . ## minor, *)) \
|
else if (@available (iOS major ## . ## minor, *)) \
|
||||||
return Trait::newFn (std::forward<Args> (args)...); \
|
return Trait::newFn (std::forward<Args> (args)...); \
|
||||||
else \
|
else \
|
||||||
return Trait::oldFn (std::forward<Args> (args)...); \
|
return Trait::oldFn (std::forward<Args> (args)...); \
|
||||||
|
|
|
||||||
|
|
@ -552,7 +552,7 @@ private:
|
||||||
if (isSharedWindow)
|
if (isSharedWindow)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (@available (ios 13, *))
|
if (@available (iOS 13, *))
|
||||||
{
|
{
|
||||||
window.windowScene = windowSceneTracker->getWindowScene();
|
window.windowScene = windowSceneTracker->getWindowScene();
|
||||||
}
|
}
|
||||||
|
|
@ -1085,7 +1085,7 @@ static void postTraitChangeNotification (UITraitCollection* previousTraitCollect
|
||||||
{
|
{
|
||||||
[super traitCollectionDidChange: previousTraitCollection];
|
[super traitCollectionDidChange: previousTraitCollection];
|
||||||
|
|
||||||
if (@available (ios 17, *))
|
if (@available (iOS 17, *))
|
||||||
{} // do nothing
|
{} // do nothing
|
||||||
else
|
else
|
||||||
postTraitChangeNotification (previousTraitCollection);
|
postTraitChangeNotification (previousTraitCollection);
|
||||||
|
|
@ -1793,7 +1793,7 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp,
|
||||||
|
|
||||||
window = [[JuceUIWindow alloc] initWithFrame: r];
|
window = [[JuceUIWindow alloc] initWithFrame: r];
|
||||||
|
|
||||||
if (@available (ios 13, *))
|
if (@available (iOS 13, *))
|
||||||
{
|
{
|
||||||
window.windowScene = windowSceneTracker->getWindowScene();
|
window.windowScene = windowSceneTracker->getWindowScene();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -610,7 +610,7 @@ struct TemporaryWindow
|
||||||
{
|
{
|
||||||
UIWindow* window = std::invoke ([&]
|
UIWindow* window = std::invoke ([&]
|
||||||
{
|
{
|
||||||
if (@available (ios 13, *))
|
if (@available (iOS 13, *))
|
||||||
{
|
{
|
||||||
SharedResourcePointer<WindowSceneTracker> windowSceneTracker;
|
SharedResourcePointer<WindowSceneTracker> windowSceneTracker;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1202,7 +1202,7 @@ struct CameraDevice::ViewerComponent : public UIViewComponent
|
||||||
|
|
||||||
static void updateOrientation (id self)
|
static void updateOrientation (id self)
|
||||||
{
|
{
|
||||||
if (@available (ios 17, *))
|
if (@available (iOS 17, *))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (auto* previewLayer = getPreviewLayer (self))
|
if (auto* previewLayer = getPreviewLayer (self))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue