Commit ffe5f2cd authored by cubeleo's avatar cubeleo Committed by David Reid

CoreAudio: Updated a deprecated symbol.

kAudioObjectPropertyElementMaster was deprecated in macOS 12.0 and iOS 15.0 and replaced with kAudioObjectPropertyElementMain.
parent 40a85d18
...@@ -30746,7 +30746,7 @@ structure with three variables and is used to identify which property you are ge ...@@ -30746,7 +30746,7 @@ structure with three variables and is used to identify which property you are ge
which is basically the specific property that you're wanting to retrieve or set. The second is the "scope", which is which is basically the specific property that you're wanting to retrieve or set. The second is the "scope", which is
typically set to kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput for input-specific properties and typically set to kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyScopeInput for input-specific properties and
kAudioObjectPropertyScopeOutput for output-specific properties. The last is the "element" which is always set to kAudioObjectPropertyScopeOutput for output-specific properties. The last is the "element" which is always set to
kAudioObjectPropertyElementMaster in miniaudio's case. I don't know of any cases where this would be set to anything different. kAudioObjectPropertyElementMain in miniaudio's case. I don't know of any cases where this would be set to anything different.
Back to the earlier issue of device retrieval, you first use the AudioObjectGetPropertyDataSize() API to retrieve the size Back to the earlier issue of device retrieval, you first use the AudioObjectGetPropertyDataSize() API to retrieve the size
of the raw data which is just a list of AudioDeviceID's. You use the kAudioObjectSystemObject AudioObjectID, and a property of the raw data which is just a list of AudioDeviceID's. You use the kAudioObjectSystemObject AudioObjectID, and a property
...@@ -31050,6 +31050,13 @@ static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout* ...@@ -31050,6 +31050,13 @@ static ma_result ma_get_channel_map_from_AudioChannelLayout(AudioChannelLayout*
return MA_SUCCESS; return MA_SUCCESS;
} }
#if defined(MAC_OS_VERSION_12_0) || defined(__IPHONE_15_0)
#define AUDIO_OBJECT_PROPERTY_ELEMENT kAudioObjectPropertyElementMain
#else
/* kAudioObjectPropertyElementMaster is deprecated. */
#define AUDIO_OBJECT_PROPERTY_ELEMENT kAudioObjectPropertyElementMaster
#endif
static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt32* pDeviceCount, AudioObjectID** ppDeviceObjectIDs) /* NOTE: Free the returned buffer with ma_free(). */ static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt32* pDeviceCount, AudioObjectID** ppDeviceObjectIDs) /* NOTE: Free the returned buffer with ma_free(). */
{ {
AudioObjectPropertyAddress propAddressDevices; AudioObjectPropertyAddress propAddressDevices;
...@@ -31067,7 +31074,7 @@ static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt3 ...@@ -31067,7 +31074,7 @@ static ma_result ma_get_device_object_ids__coreaudio(ma_context* pContext, UInt3
propAddressDevices.mSelector = kAudioHardwarePropertyDevices; propAddressDevices.mSelector = kAudioHardwarePropertyDevices;
propAddressDevices.mScope = kAudioObjectPropertyScopeGlobal; propAddressDevices.mScope = kAudioObjectPropertyScopeGlobal;
propAddressDevices.mElement = kAudioObjectPropertyElementMaster; propAddressDevices.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(kAudioObjectSystemObject, &propAddressDevices, 0, NULL, &deviceObjectsDataSize); status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(kAudioObjectSystemObject, &propAddressDevices, 0, NULL, &deviceObjectsDataSize);
if (status != noErr) { if (status != noErr) {
...@@ -31101,7 +31108,7 @@ static ma_result ma_get_AudioObject_uid_as_CFStringRef(ma_context* pContext, Aud ...@@ -31101,7 +31108,7 @@ static ma_result ma_get_AudioObject_uid_as_CFStringRef(ma_context* pContext, Aud
propAddress.mSelector = kAudioDevicePropertyDeviceUID; propAddress.mSelector = kAudioDevicePropertyDeviceUID;
propAddress.mScope = kAudioObjectPropertyScopeGlobal; propAddress.mScope = kAudioObjectPropertyScopeGlobal;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
dataSize = sizeof(*pUID); dataSize = sizeof(*pUID);
status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, NULL, &dataSize, pUID); status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, NULL, &dataSize, pUID);
...@@ -31143,7 +31150,7 @@ static ma_result ma_get_AudioObject_name(ma_context* pContext, AudioObjectID obj ...@@ -31143,7 +31150,7 @@ static ma_result ma_get_AudioObject_name(ma_context* pContext, AudioObjectID obj
propAddress.mSelector = kAudioDevicePropertyDeviceNameCFString; propAddress.mSelector = kAudioDevicePropertyDeviceNameCFString;
propAddress.mScope = kAudioObjectPropertyScopeGlobal; propAddress.mScope = kAudioObjectPropertyScopeGlobal;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
dataSize = sizeof(deviceName); dataSize = sizeof(deviceName);
status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, NULL, &dataSize, &deviceName); status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(objectID, &propAddress, 0, NULL, &dataSize, &deviceName);
...@@ -31172,7 +31179,7 @@ static ma_bool32 ma_does_AudioObject_support_scope(ma_context* pContext, AudioOb ...@@ -31172,7 +31179,7 @@ static ma_bool32 ma_does_AudioObject_support_scope(ma_context* pContext, AudioOb
/* To know whether or not a device is an input device we need ot look at the stream configuration. If it has an output channel it's a playback device. */ /* To know whether or not a device is an input device we need ot look at the stream configuration. If it has an output channel it's a playback device. */
propAddress.mSelector = kAudioDevicePropertyStreamConfiguration; propAddress.mSelector = kAudioDevicePropertyStreamConfiguration;
propAddress.mScope = scope; propAddress.mScope = scope;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize);
if (status != noErr) { if (status != noErr) {
...@@ -31227,7 +31234,7 @@ static ma_result ma_get_AudioObject_stream_descriptions(ma_context* pContext, Au ...@@ -31227,7 +31234,7 @@ static ma_result ma_get_AudioObject_stream_descriptions(ma_context* pContext, Au
*/ */
propAddress.mSelector = kAudioStreamPropertyAvailableVirtualFormats; /*kAudioStreamPropertyAvailablePhysicalFormats;*/ propAddress.mSelector = kAudioStreamPropertyAvailableVirtualFormats; /*kAudioStreamPropertyAvailablePhysicalFormats;*/
propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize);
if (status != noErr) { if (status != noErr) {
...@@ -31265,7 +31272,7 @@ static ma_result ma_get_AudioObject_channel_layout(ma_context* pContext, AudioOb ...@@ -31265,7 +31272,7 @@ static ma_result ma_get_AudioObject_channel_layout(ma_context* pContext, AudioOb
propAddress.mSelector = kAudioDevicePropertyPreferredChannelLayout; propAddress.mSelector = kAudioDevicePropertyPreferredChannelLayout;
propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize);
if (status != noErr) { if (status != noErr) {
...@@ -31355,7 +31362,7 @@ static ma_result ma_get_AudioObject_sample_rates(ma_context* pContext, AudioObje ...@@ -31355,7 +31362,7 @@ static ma_result ma_get_AudioObject_sample_rates(ma_context* pContext, AudioObje
propAddress.mSelector = kAudioDevicePropertyAvailableNominalSampleRates; propAddress.mSelector = kAudioDevicePropertyAvailableNominalSampleRates;
propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize); status = ((ma_AudioObjectGetPropertyDataSize_proc)pContext->coreaudio.AudioObjectGetPropertyDataSize)(deviceObjectID, &propAddress, 0, NULL, &dataSize);
if (status != noErr) { if (status != noErr) {
...@@ -31477,7 +31484,7 @@ static ma_result ma_get_AudioObject_closest_buffer_size_in_frames(ma_context* pC ...@@ -31477,7 +31484,7 @@ static ma_result ma_get_AudioObject_closest_buffer_size_in_frames(ma_context* pC
propAddress.mSelector = kAudioDevicePropertyBufferFrameSizeRange; propAddress.mSelector = kAudioDevicePropertyBufferFrameSizeRange;
propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
dataSize = sizeof(bufferSizeRange); dataSize = sizeof(bufferSizeRange);
status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, &bufferSizeRange); status = ((ma_AudioObjectGetPropertyData_proc)pContext->coreaudio.AudioObjectGetPropertyData)(deviceObjectID, &propAddress, 0, NULL, &dataSize, &bufferSizeRange);
...@@ -31515,7 +31522,7 @@ static ma_result ma_set_AudioObject_buffer_size_in_frames(ma_context* pContext, ...@@ -31515,7 +31522,7 @@ static ma_result ma_set_AudioObject_buffer_size_in_frames(ma_context* pContext,
/* Try setting the size of the buffer... If this fails we just use whatever is currently set. */ /* Try setting the size of the buffer... If this fails we just use whatever is currently set. */
propAddress.mSelector = kAudioDevicePropertyBufferFrameSize; propAddress.mSelector = kAudioDevicePropertyBufferFrameSize;
propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, NULL, sizeof(chosenBufferSizeInFrames), &chosenBufferSizeInFrames); ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, NULL, sizeof(chosenBufferSizeInFrames), &chosenBufferSizeInFrames);
...@@ -31544,7 +31551,7 @@ static ma_result ma_find_default_AudioObjectID(ma_context* pContext, ma_device_t ...@@ -31544,7 +31551,7 @@ static ma_result ma_find_default_AudioObjectID(ma_context* pContext, ma_device_t
*pDeviceObjectID = 0; *pDeviceObjectID = 0;
propAddressDefaultDevice.mScope = kAudioObjectPropertyScopeGlobal; propAddressDefaultDevice.mScope = kAudioObjectPropertyScopeGlobal;
propAddressDefaultDevice.mElement = kAudioObjectPropertyElementMaster; propAddressDefaultDevice.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
if (deviceType == ma_device_type_playback) { if (deviceType == ma_device_type_playback) {
propAddressDefaultDevice.mSelector = kAudioHardwarePropertyDefaultOutputDevice; propAddressDefaultDevice.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
} else { } else {
...@@ -32617,7 +32624,7 @@ static ma_result ma_context__init_device_tracking__coreaudio(ma_context* pContex ...@@ -32617,7 +32624,7 @@ static ma_result ma_context__init_device_tracking__coreaudio(ma_context* pContex
if (g_DeviceTrackingInitCounter_CoreAudio == 0) { if (g_DeviceTrackingInitCounter_CoreAudio == 0) {
AudioObjectPropertyAddress propAddress; AudioObjectPropertyAddress propAddress;
propAddress.mScope = kAudioObjectPropertyScopeGlobal; propAddress.mScope = kAudioObjectPropertyScopeGlobal;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
ma_mutex_init(&g_DeviceTrackingMutex_CoreAudio); ma_mutex_init(&g_DeviceTrackingMutex_CoreAudio);
...@@ -32647,7 +32654,7 @@ static ma_result ma_context__uninit_device_tracking__coreaudio(ma_context* pCont ...@@ -32647,7 +32654,7 @@ static ma_result ma_context__uninit_device_tracking__coreaudio(ma_context* pCont
if (g_DeviceTrackingInitCounter_CoreAudio == 0) { if (g_DeviceTrackingInitCounter_CoreAudio == 0) {
AudioObjectPropertyAddress propAddress; AudioObjectPropertyAddress propAddress;
propAddress.mScope = kAudioObjectPropertyScopeGlobal; propAddress.mScope = kAudioObjectPropertyScopeGlobal;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
propAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; propAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
((ma_AudioObjectRemovePropertyListener_proc)pContext->coreaudio.AudioObjectRemovePropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, NULL); ((ma_AudioObjectRemovePropertyListener_proc)pContext->coreaudio.AudioObjectRemovePropertyListener)(kAudioObjectSystemObject, &propAddress, &ma_default_device_changed__coreaudio, NULL);
...@@ -33098,7 +33105,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev ...@@ -33098,7 +33105,7 @@ static ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_dev
propAddress.mSelector = kAudioDevicePropertyNominalSampleRate; propAddress.mSelector = kAudioDevicePropertyNominalSampleRate;
propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput; propAddress.mScope = (deviceType == ma_device_type_playback) ? kAudioObjectPropertyScopeOutput : kAudioObjectPropertyScopeInput;
propAddress.mElement = kAudioObjectPropertyElementMaster; propAddress.mElement = AUDIO_OBJECT_PROPERTY_ELEMENT;
status = ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, NULL, sizeof(sampleRateRange), &sampleRateRange); status = ((ma_AudioObjectSetPropertyData_proc)pContext->coreaudio.AudioObjectSetPropertyData)(deviceObjectID, &propAddress, 0, NULL, sizeof(sampleRateRange), &sampleRateRange);
if (status != noErr) { if (status != noErr) {
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment