From a551e58737614239d3e391eb59fcc52b92fc2822 Mon Sep 17 00:00:00 2001 From: David Reid Date: Mon, 2 Jul 2018 22:20:17 +1000 Subject: [PATCH] Add notes for iOS. --- README.md | 4 ++-- mini_al.h | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7b716986..6b1d99cc 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Features Supported Platforms =================== - Windows (XP+) -- macOS +- macOS, iOS - Linux - BSD - Android @@ -35,7 +35,7 @@ Backends - WASAPI - DirectSound - WinMM -- Core Audio +- Core Audio (Apple) - ALSA - PulseAudio - JACK diff --git a/mini_al.h b/mini_al.h index a0476bb5..9d8d1d6d 100644 --- a/mini_al.h +++ b/mini_al.h @@ -55,7 +55,7 @@ // Building for macOS // ------------------ // The macOS build should compile clean without the need to download any dependencies or link to any libraries or -// frameworks. +// frameworks. The iOS build will need to link the relevant frameworks but should Just Work with Xcode. // // Building for Linux // ------------------ @@ -14121,6 +14121,12 @@ mal_result mal_device_init__coreaudio(mal_context* pContext, mal_device_type dev [pAudioSession setPreferredSampleRate:(double)pDevice->sampleRate error:nil]; bestFormat.mSampleRate = pAudioSession.sampleRate; } + + status = ((mal_AudioUnitSetProperty_proc)pContext->coreaudio.AudioUnitSetProperty)((AudioUnit)pDevice->coreaudio.audioUnit, kAudioUnitProperty_StreamFormat, formatScope, formatElement, &bestFormat, sizeof(bestFormat)); + if (status != noErr) { + ((mal_AudioComponentInstanceDispose_proc)pContext->coreaudio.AudioComponentInstanceDispose)((AudioUnit)pDevice->coreaudio.audioUnit); + return mal_result_from_OSStatus(status); + } #endif result = mal_format_from_AudioStreamBasicDescription(&bestFormat, &pDevice->internalFormat);