coreaudio: Don't use deprecated kAudioObjectPropertyElementMaster symbol.

Fixes #6449.
This commit is contained in:
Ryan C. Gordon 2022-11-07 14:26:48 -05:00
parent db01016dd6
commit b0dc6709b9
2 changed files with 20 additions and 12 deletions

View File

@ -39,6 +39,14 @@
#include <AudioToolbox/AudioToolbox.h> #include <AudioToolbox/AudioToolbox.h>
#include <AudioUnit/AudioUnit.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 */ /* Hidden "this" pointer for the audio functions */
#define _THIS SDL_AudioDevice *this #define _THIS SDL_AudioDevice *this

View File

@ -53,7 +53,7 @@
static const AudioObjectPropertyAddress devlist_address = { static const AudioObjectPropertyAddress devlist_address = {
kAudioHardwarePropertyDevices, kAudioHardwarePropertyDevices,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
typedef void (*addDevFn)(const char *name, SDL_AudioSpec *spec, const int iscapture, AudioDeviceID devId, void *data); 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 = { const AudioObjectPropertyAddress addr = {
kAudioDevicePropertyStreamConfiguration, kAudioDevicePropertyStreamConfiguration,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
const AudioObjectPropertyAddress nameaddr = { const AudioObjectPropertyAddress nameaddr = {
kAudioObjectPropertyName, kAudioObjectPropertyName,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
const AudioObjectPropertyAddress freqaddr = { const AudioObjectPropertyAddress freqaddr = {
kAudioDevicePropertyNominalSampleRate, kAudioDevicePropertyNominalSampleRate,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size); result = AudioObjectGetPropertyDataSize(dev, &addr, 0, NULL, &size);
@ -642,7 +642,7 @@ static const AudioObjectPropertyAddress alive_address =
{ {
kAudioDevicePropertyDeviceIsAlive, kAudioDevicePropertyDeviceIsAlive,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
static OSStatus static OSStatus
@ -764,7 +764,7 @@ prepare_device(_THIS)
AudioObjectPropertyAddress addr = { AudioObjectPropertyAddress addr = {
0, 0,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
if (handle == NULL) { if (handle == NULL) {
@ -811,7 +811,7 @@ assign_device_to_audioqueue(_THIS)
const AudioObjectPropertyAddress prop = { const AudioObjectPropertyAddress prop = {
kAudioDevicePropertyDeviceUID, kAudioDevicePropertyDeviceUID,
this->iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, this->iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
OSStatus result; OSStatus result;
@ -960,7 +960,7 @@ audioqueue_thread(void *arg)
const AudioObjectPropertyAddress default_device_address = { const AudioObjectPropertyAddress default_device_address = {
this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice,
kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
if (this->handle == NULL) { /* opened the default device? Register to know if the user picks a new default. */ 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, : kAudioHardwarePropertyDefaultOutputDevice,
iscapture ? kAudioDevicePropertyScopeInput iscapture ? kAudioDevicePropertyScopeInput
: kAudioDevicePropertyScopeOutput, : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
AudioObjectPropertyAddress nameaddr = { AudioObjectPropertyAddress nameaddr = {
kAudioObjectPropertyName, kAudioObjectPropertyName,
iscapture ? kAudioDevicePropertyScopeInput iscapture ? kAudioDevicePropertyScopeInput
: kAudioDevicePropertyScopeOutput, : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
AudioObjectPropertyAddress freqaddr = { AudioObjectPropertyAddress freqaddr = {
kAudioDevicePropertyNominalSampleRate, kAudioDevicePropertyNominalSampleRate,
iscapture ? kAudioDevicePropertyScopeInput iscapture ? kAudioDevicePropertyScopeInput
: kAudioDevicePropertyScopeOutput, : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
AudioObjectPropertyAddress bufaddr = { AudioObjectPropertyAddress bufaddr = {
kAudioDevicePropertyStreamConfiguration, kAudioDevicePropertyStreamConfiguration,
iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput, iscapture ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput,
kAudioObjectPropertyElementMaster kAudioObjectPropertyElementMain
}; };
/* Get the Device ID */ /* Get the Device ID */