mirror of
https://github.com/Ryujinx/libsoundio.git
synced 2024-12-22 08:15:37 +00:00
conditionally alias now-deprecated method
This commit is contained in:
parent
47e1756fa7
commit
cb55894da5
|
@ -9,6 +9,11 @@
|
|||
#include "soundio_private.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
|
||||
#if !defined(MAC_OS_VERSION_12_0) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_VERSION_12_0)
|
||||
#define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster
|
||||
#endif
|
||||
|
||||
static const int OUTPUT_ELEMENT = 0;
|
||||
static const int INPUT_ELEMENT = 1;
|
||||
|
@ -17,77 +22,77 @@ static AudioObjectPropertyAddress device_listen_props[] = {
|
|||
{
|
||||
kAudioDevicePropertyDeviceHasChanged,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioObjectPropertyName,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyDeviceUID,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyStreamConfiguration,
|
||||
kAudioObjectPropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyStreamConfiguration,
|
||||
kAudioObjectPropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyPreferredChannelLayout,
|
||||
kAudioObjectPropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyPreferredChannelLayout,
|
||||
kAudioObjectPropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyNominalSampleRate,
|
||||
kAudioObjectPropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyNominalSampleRate,
|
||||
kAudioObjectPropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyAvailableNominalSampleRates,
|
||||
kAudioObjectPropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyAvailableNominalSampleRates,
|
||||
kAudioObjectPropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
kAudioObjectPropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyBufferFrameSize,
|
||||
kAudioObjectPropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyBufferFrameSizeRange,
|
||||
kAudioObjectPropertyScopeInput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
{
|
||||
kAudioDevicePropertyBufferFrameSizeRange,
|
||||
kAudioObjectPropertyScopeOutput,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -141,7 +146,7 @@ static void destroy_ca(struct SoundIoPrivate *si) {
|
|||
AudioObjectPropertyAddress prop_address = {
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
};
|
||||
AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &prop_address, on_devices_changed, si);
|
||||
|
||||
|
@ -440,7 +445,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
AudioObjectPropertyAddress prop_address = {
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
};
|
||||
|
||||
if ((os_err = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
|
||||
|
@ -509,7 +514,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioObjectPropertyName;
|
||||
prop_address.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = sizeof(CFStringRef);
|
||||
if (rd.string_ref) {
|
||||
CFRelease(rd.string_ref);
|
||||
|
@ -531,7 +536,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioDevicePropertyDeviceUID;
|
||||
prop_address.mScope = kAudioObjectPropertyScopeGlobal;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = sizeof(CFStringRef);
|
||||
if (rd.string_ref) {
|
||||
CFRelease(rd.string_ref);
|
||||
|
@ -558,7 +563,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
io_size = 0;
|
||||
prop_address.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
if ((os_err = AudioObjectGetPropertyDataSize(device_id, &prop_address, 0, NULL, &io_size))) {
|
||||
deinit_refresh_devices(&rd);
|
||||
return SoundIoErrorOpeningDevice;
|
||||
|
@ -609,7 +614,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioDevicePropertyPreferredChannelLayout;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
if (!(os_err = AudioObjectGetPropertyDataSize(device_id, &prop_address,
|
||||
0, NULL, &io_size)))
|
||||
{
|
||||
|
@ -649,7 +654,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioDevicePropertyNominalSampleRate;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = sizeof(double);
|
||||
double value;
|
||||
if ((os_err = AudioObjectGetPropertyData(device_id, &prop_address, 0, NULL,
|
||||
|
@ -675,7 +680,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
} else {
|
||||
prop_address.mSelector = kAudioDevicePropertyAvailableNominalSampleRates;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
if ((os_err = AudioObjectGetPropertyDataSize(device_id, &prop_address, 0, NULL,
|
||||
&io_size)))
|
||||
{
|
||||
|
@ -721,7 +726,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioDevicePropertyBufferFrameSize;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = sizeof(UInt32);
|
||||
UInt32 buffer_frame_size;
|
||||
if ((os_err = AudioObjectGetPropertyData(device_id, &prop_address, 0, NULL,
|
||||
|
@ -735,7 +740,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioDevicePropertyBufferFrameSizeRange;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = sizeof(AudioValueRange);
|
||||
AudioValueRange avr;
|
||||
if ((os_err = AudioObjectGetPropertyData(device_id, &prop_address, 0, NULL,
|
||||
|
@ -749,7 +754,7 @@ static int refresh_devices(struct SoundIoPrivate *si) {
|
|||
|
||||
prop_address.mSelector = kAudioDevicePropertyLatency;
|
||||
prop_address.mScope = aim_to_scope(aim);
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = sizeof(UInt32);
|
||||
if ((os_err = AudioObjectGetPropertyData(device_id, &prop_address, 0, NULL,
|
||||
&io_size, &dca->latency_frames)))
|
||||
|
@ -900,7 +905,7 @@ static void outstream_destroy_ca(struct SoundIoPrivate *si, struct SoundIoOutStr
|
|||
AudioObjectPropertyAddress prop_address = {
|
||||
kAudioDeviceProcessorOverload,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
};
|
||||
AudioObjectRemovePropertyListener(dca->device_id, &prop_address, on_outstream_device_overload, os);
|
||||
|
||||
|
@ -1157,7 +1162,7 @@ static void instream_destroy_ca(struct SoundIoPrivate *si, struct SoundIoInStrea
|
|||
AudioObjectPropertyAddress prop_address = {
|
||||
kAudioDeviceProcessorOverload,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
};
|
||||
AudioObjectRemovePropertyListener(dca->device_id, &prop_address, on_instream_device_overload, is);
|
||||
|
||||
|
@ -1236,7 +1241,7 @@ static int instream_open_ca(struct SoundIoPrivate *si, struct SoundIoInStreamPri
|
|||
AudioObjectPropertyAddress prop_address;
|
||||
prop_address.mSelector = kAudioDevicePropertyStreamConfiguration;
|
||||
prop_address.mScope = kAudioObjectPropertyScopeInput;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMaster;
|
||||
prop_address.mElement = kAudioObjectPropertyElementMain;
|
||||
io_size = 0;
|
||||
if ((os_err = AudioObjectGetPropertyDataSize(dca->device_id, &prop_address,
|
||||
0, NULL, &io_size)))
|
||||
|
@ -1443,7 +1448,7 @@ int soundio_coreaudio_init(struct SoundIoPrivate *si) {
|
|||
AudioObjectPropertyAddress prop_address = {
|
||||
kAudioHardwarePropertyDevices,
|
||||
kAudioObjectPropertyScopeGlobal,
|
||||
kAudioObjectPropertyElementMaster
|
||||
kAudioObjectPropertyElementMain
|
||||
};
|
||||
if ((err = AudioObjectAddPropertyListener(kAudioObjectSystemObject, &prop_address,
|
||||
on_devices_changed, si)))
|
||||
|
|
Loading…
Reference in a new issue