mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-13 21:31:53 +00:00
MACOSX: Simplify detection conditions for the older CoreAudio API
The current code checked for the CPU type to determine if we were building for the older macOS releases requiring this older API, but we can just check MAC_OS_X_VERSION_MAX_ALLOWED which is clearer and more accurate. Apart from simplification, this also lets one build ScummVM for x86 again on Tiger. I haven't checked this case, though :) Note that the ComponentDescription -> AudioComponentDescription change was done in macOS 10.6 and not macOS 10.5, so this also fixes this case. Tested on macOS 10.4, 10.5, 10.5 with the 10.4 SDK, and on 12.6.
This commit is contained in:
parent
5db6e27eca
commit
4578c4a6fc
@ -26,40 +26,21 @@
|
||||
|
||||
#ifdef MACOSX
|
||||
|
||||
#include <AvailabilityMacros.h>
|
||||
#include "backends/platform/sdl/macosx/macosx-compat.h"
|
||||
|
||||
// With the release of Mac OS X 10.5 in October 2007, Apple deprecated the
|
||||
// AUGraphNewNode & AUGraphGetNodeInfo APIs in favor of the new AUGraphAddNode &
|
||||
// AUGraphNodeInfo APIs. While it is easy to switch to those, it breaks
|
||||
// compatibility with all pre-10.5 systems.
|
||||
//
|
||||
// Since 10.5 was the last system to support PowerPC, we use the old, deprecated
|
||||
// APIs on PowerPC based systems by default. On all other systems (such as macOS
|
||||
// running on Intel hardware, or iOS running on ARM), we use the new API by
|
||||
// default.
|
||||
//
|
||||
// This leaves Mac OS X 10.4 running on x86 processors as the only system
|
||||
// combination that this code will not support by default. It seems quite
|
||||
// reasonable to assume that anybody with an Intel system has since then moved
|
||||
// on to a newer macOS release. But if for some reason you absolutely need to
|
||||
// build an x86 version of this code using the old, deprecated API, you can
|
||||
// simply do so by manually enable the USE_DEPRECATED_COREAUDIO_API switch (e.g.
|
||||
// by adding setting it suitably in CPPFLAGS).
|
||||
#if !defined(USE_DEPRECATED_COREAUDIO_API)
|
||||
#if TARGET_CPU_PPC || TARGET_CPU_PPC64 || !defined(MAC_OS_X_VERSION_10_6)
|
||||
#define USE_DEPRECATED_COREAUDIO_API 1
|
||||
#else
|
||||
#define USE_DEPRECATED_COREAUDIO_API 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if USE_DEPRECATED_COREAUDIO_API
|
||||
// compatibility with 10.4, for which we need to use the older APIs.
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
||||
#define USE_DEPRECATED_COREAUDIO_API 1
|
||||
// Try to silence warnings about use of deprecated APIs
|
||||
#undef DEPRECATED_ATTRIBUTE
|
||||
#define DEPRECATED_ATTRIBUTE
|
||||
#else
|
||||
#define USE_DEPRECATED_COREAUDIO_API 0
|
||||
#endif
|
||||
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/error.h"
|
||||
#include "common/textconsole.h"
|
||||
@ -129,7 +110,7 @@ int MidiDriver_CORE::open() {
|
||||
RequireNoErr(NewAUGraph(&_auGraph));
|
||||
|
||||
AUNode outputNode, synthNode;
|
||||
#if USE_DEPRECATED_COREAUDIO_API
|
||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
|
||||
ComponentDescription desc;
|
||||
#else
|
||||
AudioComponentDescription desc;
|
||||
|
Loading…
Reference in New Issue
Block a user