On 12/2/22 16:23, Akihiko Odaki wrote:
On 2022/02/12 1:34, Philippe Mathieu-Daudé via wrote:
When building on macOS 12 we get:

   audio/coreaudio.c:50:5: error: 'kAudioObjectPropertyElementMaster' is deprecated: first deprecated in macOS 12.0 [-Werror,-Wdeprecated-declarations]
       kAudioObjectPropertyElementMaster
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       kAudioObjectPropertyElementMain
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreAudio.framework/Headers/AudioHardwareBase.h:208:5: note: 'kAudioObjectPropertyElementMaster' has been explicitly marked deprecated here        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
       ^

Replace by kAudioObjectPropertyElementMain, redefining it to
kAudioObjectPropertyElementMaster if not available.

Suggested-by: Akihiko Odaki <akihiko.od...@gmail.com>
Suggested-by: Christian Schoenebeck <qemu_...@crudebyte.com>
Suggested-by: Roman Bolshakov <ro...@roolebo.dev>
Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org>
Reviewed-by: Christian Schoenebeck <qemu_...@crudebyte.com>
---
  audio/coreaudio.c | 17 +++++++++++------
  1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index d8a21d3e50..5b3aeaced0 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -44,10 +44,15 @@ typedef struct coreaudioVoiceOut {
      bool enabled;
  } coreaudioVoiceOut;
+#if !defined(MAC_OS_VERSION_12_0) \
+    || (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_VERSION_12_0)
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif
+

Unless I have missed something, we have found MAC_OS_X_VERSION_MIN_REQUIRED is better even for a constant in the following thread:
https://lore.kernel.org/all/524515d6-2fb5-15c1-0aaf-bcda3684c...@gmail.com/

I was reading the v3 comments and missed the v2 ones.

Reply via email to