mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
iOS: Experiment with some improvements to automatic stream routing.
This commit is contained in:
+12
-12
@@ -25995,8 +25995,19 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
|
|||||||
case AVAudioSessionRouteChangeReasonNewDeviceAvailable:
|
case AVAudioSessionRouteChangeReasonNewDeviceAvailable:
|
||||||
{
|
{
|
||||||
#if defined(MA_DEBUG_OUTPUT)
|
#if defined(MA_DEBUG_OUTPUT)
|
||||||
printf("[Core Audio] Route Changed: AVAudioSessionRouteChangeReasonNewDeviceAvailable\n");
|
printf("[Core Audio] Route Changed: AVAudioSessionRouteChangeReasonNewDeviceAvailable. inputNumberChannels=%d; outputNumberOfChannels=%d.\n", pSession.inputNumberOfChannels, pSession.outputNumberOfChannels);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
m_pDevice->sampleRate = (ma_uint32)pSession.sampleRate;
|
||||||
|
|
||||||
|
if (m_pDevice->type == ma_device_type_capture || m_pDevice->type == ma_device_type_duplex) {
|
||||||
|
m_pDevice->capture.internalChannels = (ma_uint32)pSession.inputNumberOfChannels;
|
||||||
|
ma_device__post_init_setup(m_pDevice, ma_device_type_capture);
|
||||||
|
}
|
||||||
|
if (m_pDevice->type == ma_device_type_playback || m_pDevice->type == ma_device_type_duplex) {
|
||||||
|
m_pDevice->playback.internalChannels = (ma_uint32)pSession.outputNumberOfChannels;
|
||||||
|
ma_device__post_init_setup(m_pDevice, ma_device_type_playback);
|
||||||
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory:
|
case AVAudioSessionRouteChangeReasonNoSuitableRouteForCategory:
|
||||||
@@ -26035,17 +26046,6 @@ static ma_result ma_device__untrack__coreaudio(ma_device* pDevice)
|
|||||||
#endif
|
#endif
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pDevice->sampleRate = (ma_uint32)pSession.sampleRate;
|
|
||||||
|
|
||||||
if (m_pDevice->type == ma_device_type_capture || m_pDevice->type == ma_device_type_duplex) {
|
|
||||||
m_pDevice->capture.internalChannels = (ma_uint32)pSession.inputNumberOfChannels;
|
|
||||||
ma_device__post_init_setup(m_pDevice, ma_device_type_capture);
|
|
||||||
}
|
|
||||||
if (m_pDevice->type == ma_device_type_playback || m_pDevice->type == ma_device_type_duplex) {
|
|
||||||
m_pDevice->playback.internalChannels = (ma_uint32)pSession.outputNumberOfChannels;
|
|
||||||
ma_device__post_init_setup(m_pDevice, ma_device_type_playback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user