Skip to content

[Bug]: CoreAudio fails to build on macOS 13.x SDK — kAudioAggregateDriftCompensationHighQuality guarded with the wrong SDK version #1687

Description

@BenCello

Detailed steps on how to reproduce the bug

  1. Configure any target that uses the juce_audio_devices module.
  2. Build against a macOS SDK in the range [13.0, 14.2) — e.g. Xcode 14.2 (macOS 13.1 SDK).
  3. Compilation fails in juce_CoreAudio_mac.cpp (see stacktrace).

Cause: kAudioAggregateDriftCompensationHighQuality is guarded by JUCE_MAC_API_VERSION_CAN_BE_BUILT (13, 0) (≈ __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000, "SDK ≥ 13.0"), but that constant only exists from the macOS 14.2 SDK — it belongs to the Core Audio process-taps feature. The neighbouring AudioHardwareCreateProcessTap / …DestroyProcessTap in AudioHardwareTapping.h are API_AVAILABLE(macos(14.2)), and the kAudioAggregateDriftCompensation* enum in AudioHardware.h is a bare CF_ENUM with no availability macro — so on an older SDK it's a hard "undeclared identifier" error, not a deprecation.

What is the expected behaviour?

Compiles on SDKs < 14.2 by falling back to the existing #else branch (kAudioSubDeviceDriftCompensationHighQuality). Raising the guard from (13, 0) to (14, 2) achieves this and leaves 14.2+ builds unchanged:
--- a/modules/juce_audio_devices/native/juce_CoreAudio_mac.cpp
+++ b/modules/juce_audio_devices/native/juce_CoreAudio_mac.cpp
@@ -1216,7 +1216,7 @@
subDevice.setInt (kAudioSubDeviceDriftCompensationKey, uid != clockingDeviceUid);
subDevice.setInt (kAudioSubDeviceDriftCompensationQualityKey,

  •                         #if JUCE_MAC_API_VERSION_CAN_BE_BUILT (13, 0)
    
  •                         #if JUCE_MAC_API_VERSION_CAN_BE_BUILT (14, 2)
                             kAudioAggregateDriftCompensationHighQuality);
                            #else
                             kAudioSubDeviceDriftCompensationHighQuality);
    

Note: 14.2 is derived from Apple's API_AVAILABLE(macos(14.2)) on the adjacent process-taps API plus the shared SubTap-drift enum block; I couldn't diff a 14.0-vs-14.2 AudioHardware.h directly to confirm absence in 14.0/14.1, so the exact threshold may need a minor nudge if it landed in a different 14.x point release.

Operating systems

macOS

What versions of the operating systems?

Build host macOS 12.7.3; the determining factor is the macOS 13.1 SDK bundled with Xcode 14.2. Any SDK in [13.0, 14.2) is affected.

Architectures

Arm64/aarch64

Stacktrace

Build-time error (no runtime stacktrace):
juce_CoreAudio_mac.cpp:1220:31: error: use of undeclared identifier
'kAudioAggregateDriftCompensationHighQuality'; did you mean
'kAudioSubDeviceDriftCompensationHighQuality'?
                              kAudioAggregateDriftCompensationHighQuality);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AudioHardware.h:1645:5: note: 'kAudioSubDeviceDriftCompensationHighQuality' declared here

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

The bug is present on the develop branch

Code of Conduct

  • I agree to follow the Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions