mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 08:14:04 +02:00
Core Audio: Fix a bug with device tracking for auto stream routing.
This commit is contained in:
+14
-14
@@ -24314,15 +24314,8 @@ static ma_result ma_context__uninit_device_tracking__coreaudio(ma_context* pCont
|
|||||||
|
|
||||||
static ma_result ma_device__track__coreaudio(ma_device* pDevice)
|
static ma_result ma_device__track__coreaudio(ma_device* pDevice)
|
||||||
{
|
{
|
||||||
ma_result result;
|
|
||||||
|
|
||||||
MA_ASSERT(pDevice != NULL);
|
MA_ASSERT(pDevice != NULL);
|
||||||
|
|
||||||
result = ma_context__init_device_tracking__coreaudio(pDevice->pContext);
|
|
||||||
if (result != MA_SUCCESS) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
ma_mutex_lock(&g_DeviceTrackingMutex_CoreAudio);
|
ma_mutex_lock(&g_DeviceTrackingMutex_CoreAudio);
|
||||||
{
|
{
|
||||||
/* Allocate memory if required. */
|
/* Allocate memory if required. */
|
||||||
@@ -24357,8 +24350,6 @@ static ma_result ma_device__track__coreaudio(ma_device* pDevice)
|
|||||||
|
|
||||||
static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
|
static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
|
||||||
{
|
{
|
||||||
ma_result result;
|
|
||||||
|
|
||||||
MA_ASSERT(pDevice != NULL);
|
MA_ASSERT(pDevice != NULL);
|
||||||
|
|
||||||
ma_mutex_lock(&g_DeviceTrackingMutex_CoreAudio);
|
ma_mutex_lock(&g_DeviceTrackingMutex_CoreAudio);
|
||||||
@@ -24387,11 +24378,6 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
|
|||||||
}
|
}
|
||||||
ma_mutex_unlock(&g_DeviceTrackingMutex_CoreAudio);
|
ma_mutex_unlock(&g_DeviceTrackingMutex_CoreAudio);
|
||||||
|
|
||||||
result = ma_context__uninit_device_tracking__coreaudio(pDevice->pContext);
|
|
||||||
if (result != MA_SUCCESS) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return MA_SUCCESS;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -25234,6 +25220,8 @@ static ma_result ma_context_uninit__coreaudio(ma_context* pContext)
|
|||||||
ma_dlclose(pContext, pContext->coreaudio.hCoreFoundation);
|
ma_dlclose(pContext, pContext->coreaudio.hCoreFoundation);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ma_context__init_device_tracking__coreaudio(pContext);
|
||||||
|
|
||||||
(void)pContext;
|
(void)pContext;
|
||||||
return MA_SUCCESS;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
@@ -25261,6 +25249,8 @@ static AVAudioSessionCategory ma_to_AVAudioSessionCategory(ma_ios_session_catego
|
|||||||
|
|
||||||
static ma_result ma_context_init__coreaudio(const ma_context_config* pConfig, ma_context* pContext)
|
static ma_result ma_context_init__coreaudio(const ma_context_config* pConfig, ma_context* pContext)
|
||||||
{
|
{
|
||||||
|
ma_result result;
|
||||||
|
|
||||||
MA_ASSERT(pConfig != NULL);
|
MA_ASSERT(pConfig != NULL);
|
||||||
MA_ASSERT(pContext != NULL);
|
MA_ASSERT(pContext != NULL);
|
||||||
|
|
||||||
@@ -25416,6 +25406,16 @@ static ma_result ma_context_init__coreaudio(const ma_context_config* pConfig, ma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result = ma_context__init_device_tracking__coreaudio(pContext);
|
||||||
|
if (result != MA_SUCCESS) {
|
||||||
|
#if !defined(MA_NO_RUNTIME_LINKING) && !defined(MA_APPLE_MOBILE)
|
||||||
|
ma_dlclose(pContext, pContext->coreaudio.hAudioUnit);
|
||||||
|
ma_dlclose(pContext, pContext->coreaudio.hCoreAudio);
|
||||||
|
ma_dlclose(pContext, pContext->coreaudio.hCoreFoundation);
|
||||||
|
#endif
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
return MA_SUCCESS;
|
return MA_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif /* Core Audio */
|
#endif /* Core Audio */
|
||||||
|
|||||||
Reference in New Issue
Block a user