coreaudio: Don't use deprecated kAudioObjectPropertyElementMaster symbol. Fixes #6449.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h
index b426ea4..9353046 100644
--- a/src/audio/coreaudio/SDL_coreaudio.h
+++ b/src/audio/coreaudio/SDL_coreaudio.h
@@ -39,6 +39,14 @@
#include <AudioToolbox/AudioToolbox.h>
#include <AudioUnit/AudioUnit.h>
+/* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */
+#if MACOSX_COREAUDIO
+#include <AvailabilityMacros.h>
+#ifndef MAC_OS_VERSION_12_0
+#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
+#endif
+#endif
+
/* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this
diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m
index dbd85f4..d223359 100644
--- a/src/audio/coreaudio/SDL_coreaudio.m
+++ b/src/audio/coreaudio/SDL_coreaudio.m
@@ -53,7 +53,7 @@
static const AudioObjectPropertyAddress devlist_address = {
kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
typedef void (*addDevFn)(const char *name, SDL_AudioSpec *spec, const int iscapture, AudioDeviceID devId, void *data);
@@ -131,17 +131,17 @@ build_device_list(int iscapture, addDevFn addfn, void *addfndata)
const AudioObjectPropertyAddress addr = {
kAudioDevicePropertyStreamConfiguration,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
const AudioObjectPropertyAddress nameaddr = {
kAudioObjectPropertyName,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
const AudioObjectPropertyAddress freqaddr = {
kAudioDevicePropertyNominalSampleRate,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size);
@@ -642,7 +642,7 @@ static const AudioObjectPropertyAddress alive_address =
{
kAudioDevicePropertyDeviceIsAlive,
kAudioObjectPropertyScopeGlobal,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
static OSStatus
@@ -764,7 +764,7 @@ prepare_device(_THIS)
AudioObjectPropertyAddress addr = {
0,
kAudioObjectPropertyScopeGlobal,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
if (handle == NULL) {
@@ -811,7 +811,7 @@ assign_device_to_audioqueue(_THIS)
const AudioObjectPropertyAddress prop = {
kAudioDevicePropertyDeviceUID,
this->iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
OSStatus result;
@@ -960,7 +960,7 @@ audioqueue_thread(void *arg)
const AudioObjectPropertyAddress default_device_address = {
this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyScopeGlobal,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
if (this->handle == NULL) { /* opened the default device? Register to know if the user picks a new default. */
@@ -1185,24 +1185,24 @@ COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture)
: kAudioHardwarePropertyDefaultOutputDevice,
iscapture ? kAudioDevicePropertyScopeInput
: kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
AudioObjectPropertyAddress nameaddr = {
kAudioObjectPropertyName,
iscapture ? kAudioDevicePropertyScopeInput
: kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
AudioObjectPropertyAddress freqaddr = {
kAudioDevicePropertyNominalSampleRate,
iscapture ? kAudioDevicePropertyScopeInput
: kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
AudioObjectPropertyAddress bufaddr = {
kAudioDevicePropertyStreamConfiguration,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
- kAudioObjectPropertyElementMaster
+ kAudioObjectPropertyElementMain
};
/* Get the Device ID */