From 6c7f6cd3fdbe98aa7ff03af511e7ef6d98bddbad Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 21 Dec 2019 10:26:44 +1000 Subject: [PATCH] Core Audio: Try fixing a compilation error when targeting tvOS and watchOS. Public issue #108 --- miniaudio.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/miniaudio.h b/miniaudio.h index 85210179..89f4f048 100644 --- a/miniaudio.h +++ b/miniaudio.h @@ -17938,6 +17938,12 @@ Core Audio Backend #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1 #define MA_APPLE_MOBILE + #if defined(TARGET_OS_TV) && TARGET_OS_TV == 1 + #define MA_APPLE_TV + #endif + #if defined(TARGET_OS_WATCH) && TARGET_OS_WATCH == 1 + #define MA_APPLE_WATCH + #endif #else #define MA_APPLE_DESKTOP #endif @@ -20595,11 +20601,14 @@ ma_result ma_context_init__coreaudio(const ma_context_config* pConfig, ma_contex [pAudioSession setCategory: AVAudioSessionCategoryPlayAndRecord withOptions:options error:nil]; + /* AVAudioSessionPortOverrideSpeaker is not available on Apple TV OS nor Apple Watch OS. */ + #if !defined(MA_APPLE_TV) && !defined(MA_APPLE_WATCH) /* By default we want miniaudio to use the speakers instead of the receiver. In the future this may be customizable. */ ma_bool32 useSpeakers = MA_TRUE; if (useSpeakers) { [pAudioSession overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil]; } + #endif } #endif