Only set Core Audio session category for iOS targets Fixes a crash in the latest UAT desktop editor(s) on macOS by targeting setting iOS session category to mixing only for iOS / iPadOS / Catalyst targets. The desktop editor is _not_ any of these targets, so the code changes are not compiled. See [here](https://github.com/rive-app/rive/pull/7555/files#r1680306818) for more discussion. Diffs= 6c5c79b75 Only set Core Audio session category for iOS targets (#7624) Co-authored-by: David Skuza <david@rive.app>
diff --git a/.rive_head b/.rive_head index b46f69f..fb5018f 100644 --- a/.rive_head +++ b/.rive_head
@@ -1 +1 @@ -8e1be1223161ced9cfb80c0ec3671ffd25ee5cfb +6c5c79b751c50fa4393fb0e44624635861bc3f3b
diff --git a/src/audio/audio_engine.cpp b/src/audio/audio_engine.cpp index da48702..0bdd9f9 100644 --- a/src/audio/audio_engine.cpp +++ b/src/audio/audio_engine.cpp
@@ -166,7 +166,8 @@ // I _think_ MA_NO_DEVICE_IO is defined when building for Unity; otherwise, it seems to pass // "standard" building When defined, pContext is unavailable, which causes build errors when // building Unity for iOS. - David -#if defined(MA_HAS_COREAUDIO) && !defined(MA_NO_DEVICE_IO) +#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_MACCATALYST || TARGET_OS_IPHONE) && \ + !defined(MA_NO_DEVICE_IO) // Used for configuration only, and isn't referenced past the usage of ma_context_init; thus, // can be locally scoped. Uses the "logical" defaults from miniaudio, and updates only what we // need. This should automatically set available backends in priority order based on the target @@ -190,7 +191,8 @@ engineConfig.channels = numChannels; engineConfig.sampleRate = sampleRate; -#if defined(MA_HAS_COREAUDIO) && !defined(MA_NO_DEVICE_IO) +#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_MACCATALYST || TARGET_OS_IPHONE) && \ + !defined(MA_NO_DEVICE_IO) if (context != nullptr) { engineConfig.pContext = context; @@ -205,7 +207,8 @@ if (ma_engine_init(&engineConfig, engine) != MA_SUCCESS) { -#if defined(MA_HAS_COREAUDIO) && !defined(MA_NO_DEVICE_IO) +#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_MACCATALYST || TARGET_OS_IPHONE) && \ + !defined(MA_NO_DEVICE_IO) if (context != nullptr) { ma_context_uninit(context); @@ -405,7 +408,8 @@ } m_completedSounds.clear(); -#if defined(MA_HAS_COREAUDIO) && !defined(MA_NO_DEVICE_IO) +#if (TARGET_IPHONE_SIMULATOR || TARGET_OS_MACCATALYST || TARGET_OS_IPHONE) && \ + !defined(MA_NO_DEVICE_IO) // m_context is only set when Core Audio is available if (m_context != nullptr) {