mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 00:34:03 +02:00
iOS: Try fixing a bug with stereo headphone output.
This commit is contained in:
+11
@@ -19890,6 +19890,17 @@ ma_result ma_device_init_internal__coreaudio(ma_context* pContext, ma_device_typ
|
||||
|
||||
[pAudioSession setPreferredSampleRate:(double)pData->sampleRateIn error:nil];
|
||||
bestFormat.mSampleRate = pAudioSession.sampleRate;
|
||||
|
||||
/*
|
||||
I've had a report that the channel count returned by AudioUnitGetProperty above is inconsistent with
|
||||
AVAudioSession outputNumberOfChannels. I'm going to try using the AVAudioSession values instead.
|
||||
*/
|
||||
if (deviceType == ma_device_type_playback) {
|
||||
bestFormat.mChannelsPerFrame = pAudioSession.outputNumberOfChannels;
|
||||
}
|
||||
if (deviceType == ma_device_type_capture) {
|
||||
bestFormat.mChannelsPerFrame = pAudioSession.inputNumberOfChannels;
|
||||
}
|
||||
}
|
||||
|
||||
status = ((ma_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)(pData->audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat));
|
||||
|
||||
Reference in New Issue
Block a user