1
0
Fork 0
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:
Anthony Nicholls 2025-07-17 11:35:52 +01:00 committed by Anthony Nicholls
parent e68627c9ed
commit d0aa6d0486
8 changed files with 23 additions and 23 deletions

View file

@ -68,13 +68,13 @@ public:
private:
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);
}
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)
return true;
@ -220,7 +220,7 @@ size_t AudioWorkgroup::getMaxParallelThreadCount() const
{
#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))
return (size_t) os_workgroup_max_parallel_threads (wg, nullptr);

View file

@ -393,7 +393,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
JUCE_NSERROR_CHECK ([[AVAudioSession sharedInstance] setActive: enabled
error: &error]);
if (@available (ios 18, *))
if (@available (iOS 18, *))
{
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
// larger than the desired buffer size.
// 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 1;
@ -434,7 +434,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
// iOS requires additional effort to observe the actual buffer size
// change however, it seems the buffer size change will always work
// so instead we just assume the change will apply eventually
if (@available (ios 18, *))
if (@available (iOS 18, *))
return newBufferSize;
return getBufferSize (currentSampleRate);
@ -449,7 +449,7 @@ struct iOSAudioIODevice::Pimpl final : public AsyncUpdater
constexpr auto suggestedMin = 64;
constexpr auto suggestedMax = 4096;
if (@available (ios 18, *))
if (@available (iOS 18, *))
return std::tuple (suggestedMin, suggestedMax);
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
// 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,
// so avoid creating an AudioQueue
if (@available (ios 26, *))
if (@available (iOS 26, *))
return session.sampleRate;
return getSampleRateFromAudioQueue().value_or (session.sampleRate);

View file

@ -546,7 +546,7 @@ struct CoreMidiHelpers
std::optional<EndpointInfo> getCachedInfo (const ump::EndpointId& x) const
{
#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())
return getInfoForEndpoint (iter->second);
#endif
@ -627,7 +627,7 @@ struct CoreMidiHelpers
SharedEndpointsImplNative (MIDIClientRef c, ump::EndpointsListener& l)
: client (c), listener (l)
{
if (@available (macos 15.0, ios 18.0, *))
if (@available (macOS 15.0, iOS 18.0, *))
observers.emplace (*this);
}
@ -846,7 +846,7 @@ struct CoreMidiHelpers
static std::map<ump::EndpointId, EndpointInfo> findNativeUMPEndpoints()
{
#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;
@ -867,7 +867,7 @@ struct CoreMidiHelpers
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 (@available (macos 14, ios 17, *))
if (@available (macOS 14, iOS 17, *))
{
SInt32 bitmap{};
@ -884,7 +884,7 @@ struct CoreMidiHelpers
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 (@available (macos 14, ios 17, *))
if (@available (macOS 14, iOS 17, *))
{
SInt32 result;
if (MIDIObjectGetIntegerProperty (endpoint, kMIDIPropertyUMPCanTransmitGroupless, &result) == noErr)
@ -2385,7 +2385,7 @@ struct CoreMidiHelpers
[[maybe_unused]] ump::BlocksAreStatic areStatic) override
{
#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,
deviceName,
@ -2497,7 +2497,7 @@ struct CoreMidiHelpers
bool isVirtualMidiUmpServiceActive() const override
{
if (@available (macos 15, ios 18, *))
if (@available (macOS 15, iOS 18, *))
return true;
return false;

View file

@ -746,7 +746,7 @@ public:
if (inDataSize != sizeof (AUMIDIEventListBlock))
return kAudioUnitErr_InvalidPropertyValue;
if (@available (macos 12, *))
if (@available (macOS 12, *))
eventListOutput.setBlock (*static_cast<const AUMIDIEventListBlock*> (inData));
return noErr;

View file

@ -664,7 +664,7 @@ private:
return Trait::newFn (std::forward<Args> (args)...); \
else if constexpr (__IPHONE_OS_VERSION_MAX_ALLOWED < fullVersion) \
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)...); \
else \
return Trait::oldFn (std::forward<Args> (args)...); \

View file

@ -552,7 +552,7 @@ private:
if (isSharedWindow)
return;
if (@available (ios 13, *))
if (@available (iOS 13, *))
{
window.windowScene = windowSceneTracker->getWindowScene();
}
@ -1085,7 +1085,7 @@ static void postTraitChangeNotification (UITraitCollection* previousTraitCollect
{
[super traitCollectionDidChange: previousTraitCollection];
if (@available (ios 17, *))
if (@available (iOS 17, *))
{} // do nothing
else
postTraitChangeNotification (previousTraitCollection);
@ -1793,7 +1793,7 @@ UIViewComponentPeer::UIViewComponentPeer (Component& comp,
window = [[JuceUIWindow alloc] initWithFrame: r];
if (@available (ios 13, *))
if (@available (iOS 13, *))
{
window.windowScene = windowSceneTracker->getWindowScene();
}

View file

@ -610,7 +610,7 @@ struct TemporaryWindow
{
UIWindow* window = std::invoke ([&]
{
if (@available (ios 13, *))
if (@available (iOS 13, *))
{
SharedResourcePointer<WindowSceneTracker> windowSceneTracker;

View file

@ -1202,7 +1202,7 @@ struct CameraDevice::ViewerComponent : public UIViewComponent
static void updateOrientation (id self)
{
if (@available (ios 17, *))
if (@available (iOS 17, *))
return;
if (auto* previewLayer = getPreviewLayer (self))