macOS: fixed some other deprecates

This commit is contained in:
Martin Pulec
2023-06-05 13:25:22 +02:00
parent ac837924d8
commit 45cbd8dd06
3 changed files with 9 additions and 4 deletions

View File

@@ -239,7 +239,7 @@ static void * audio_cap_ca_init(struct module *parent, const char *cfg)
AudioObjectPropertyAddress propertyAddress;
propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
propertyAddress.mElement = kAudioObjectPropertyElementMain;
if ((ret = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size, &device)) != 0) {
log_msg(LOG_LEVEL_ERROR, "Error finding default input device: %s.\n", get_ca_error_str(ret));
return NULL;
@@ -263,7 +263,7 @@ static void * audio_cap_ca_init(struct module *parent, const char *cfg)
AudioObjectPropertyAddress propertyAddress;
propertyAddress.mSelector = kAudioDevicePropertyNominalSampleRate;
propertyAddress.mScope = kAudioDevicePropertyScopeInput;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
propertyAddress.mElement = kAudioObjectPropertyElementMain;
ret = AudioObjectGetPropertyData(device, &propertyAddress, 0, NULL, &size, &rate);
if (ret != noErr || rate == 0.0) {
log_msg(LOG_LEVEL_ERROR, MOD_NAME "Unable to get sample rate: %s. Wrong device index?\n", get_ca_error_str(ret));

View File

@@ -298,7 +298,7 @@ void audio_ca_probe(struct device_info **available_devices, int *count, int dir)
propertyAddress.mSelector = kAudioHardwarePropertyDevices;
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
propertyAddress.mElement = kAudioObjectPropertyElementMain;
ret = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size);
if (ret) {
goto error;
@@ -429,7 +429,7 @@ static void * audio_play_ca_init(const char *cfg)
UInt32 size = sizeof device;
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
propertyAddress.mElement = kAudioObjectPropertyElementMain;
ret = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &size, &device);
if(ret) goto error;

View File

@@ -52,5 +52,10 @@ const char *get_ca_error_str(OSStatus err);
}
#endif
#include <Availability.h>
#ifndef __MAC_12_0
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
#endif
/* vim: set expandtab sw=8: */