Closed cubeleo closed 2 years ago
Thanks for this! I think this would fix this issue from a while ago which I've been exceptionally slack on getting to: https://github.com/mackron/miniaudio/issues/462.
In that bug report, a user mentioned the use of the __is_identifier()
, but I can't think of a reason why your change with MAC_OS_VERSION_12_0
and __IPHONE_15_0
wouldn't work. I'll merge this soon.
Great! Very glad to contribute. Caveats: I looked around for a while to find guidance from Apple on how treat deprecations like this where we want the code to be able to compile on older and newer systems, but I only found older versions of an Availability.h header in their open source stuff that defines these macros. Also, I only tested on macOS, not iOS, and only the latest macOS.
Yeah, that's no worries. I'm not an Apple user so I'm unsure on how to approach backwards compatibility myself to be honest. When I get to merging this, I'll test the build on my Macbook and then just let the community report any compatibility issues as they come up.
Just something I thought of while writing this - kAudioObjectPropertyElementMain
and kAudioObjectPropertyElementMaster
have the same value, right? As in, they're just an alias?
Actually, with a bit more testing and reading how JUCE did this, I think the check can be made better. We need to check for the allowed OS version. I pushed what I believe is the better check:
(defined(__IPHONE_15_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_15_0)
Just something I thought of while writing this -
kAudioObjectPropertyElementMain
andkAudioObjectPropertyElementMaster
have the same value, right? As in, they're just an alias?
Yeah, they are given the same value, in the way Apple tends to deprecate things. They use a macro to suggest the replacement for the deprecated symbol and the OS versions that apply. Here is the actual entry for kAudioObjectPropertyElementMaster in the enum, showing the deprecation and replacement. Notice at the end of this line they've assigned the value kAudioObjectPropertyElementMain to kAudioObjectPropertyElementMaster: kAudioObjectPropertyElementMaster API_DEPRECATED_WITH_REPLACEMENT("kAudioObjectPropertyElementMain", macos(10.0, 12.0), ios(2.0, 15.0), watchos(1.0, 8.0), tvos(9.0, 15.0)) = kAudioObjectPropertyElementMain
OK, that's good. I'll go ahead and merge this soon.
I was finally able to dig out my MacBook and give this a try. It seems to work no problems on my machine which I believe uses the old naming for this token. This has been merged into the dev branch and will be released soon.
Great news! Thanks for the merge.
kAudioObjectPropertyElementMaster was deprecated in macOS 12.0 and iOS 15.0 and replaced with kAudioObjectPropertyElementMain.