diff options
Diffstat (limited to 'backends/midi')
-rw-r--r-- | backends/midi/coreaudio.cpp | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp index 4b707eace6..0c251a2d8d 100644 --- a/backends/midi/coreaudio.cpp +++ b/backends/midi/coreaudio.cpp @@ -27,22 +27,36 @@ #ifdef MACOSX -// HACK to disable deprecated warnings under Mac OS X 10.5. Apple deprecated the +// 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. -// If you want to retain compatibility with old systems, enable the following -// switch. But Apple will eventually remove these APIs, at which point the -// switch needs to be disabled. // -// Also note that only the new API is available on the iPhone! -#define USE_DEPRECATED_COREAUDIO_API - +// 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 Mac +// OS X 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 Mac OS X 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 + #define USE_DEPRECATED_COREAUDIO_API 1 + #else + #define USE_DEPRECATED_COREAUDIO_API 0 + #endif +#endif -#ifdef USE_DEPRECATED_COREAUDIO_API -#include <AvailabilityMacros.h> -#undef DEPRECATED_ATTRIBUTE -#define DEPRECATED_ATTRIBUTE +#if USE_DEPRECATED_COREAUDIO_API + #include <AvailabilityMacros.h> + // Try to silence warnings about use of deprecated APIs + #undef DEPRECATED_ATTRIBUTE + #define DEPRECATED_ATTRIBUTE #endif @@ -114,7 +128,7 @@ int MidiDriver_CORE::open() { RequireNoErr(NewAUGraph(&_auGraph)); AUNode outputNode, synthNode; -#ifdef USE_DEPRECATED_COREAUDIO_API +#if USE_DEPRECATED_COREAUDIO_API ComponentDescription desc; #else AudioComponentDescription desc; @@ -126,7 +140,7 @@ int MidiDriver_CORE::open() { desc.componentManufacturer = kAudioUnitManufacturer_Apple; desc.componentFlags = 0; desc.componentFlagsMask = 0; -#ifdef USE_DEPRECATED_COREAUDIO_API +#if USE_DEPRECATED_COREAUDIO_API RequireNoErr(AUGraphNewNode(_auGraph, &desc, 0, NULL, &outputNode)); #else RequireNoErr(AUGraphAddNode(_auGraph, &desc, &outputNode)); @@ -136,7 +150,7 @@ int MidiDriver_CORE::open() { desc.componentType = kAudioUnitType_MusicDevice; desc.componentSubType = kAudioUnitSubType_DLSSynth; desc.componentManufacturer = kAudioUnitManufacturer_Apple; -#ifdef USE_DEPRECATED_COREAUDIO_API +#if USE_DEPRECATED_COREAUDIO_API RequireNoErr(AUGraphNewNode(_auGraph, &desc, 0, NULL, &synthNode)); #else RequireNoErr(AUGraphAddNode(_auGraph, &desc, &synthNode)); @@ -150,7 +164,7 @@ int MidiDriver_CORE::open() { RequireNoErr(AUGraphInitialize(_auGraph)); // Get the music device from the graph. -#ifdef USE_DEPRECATED_COREAUDIO_API +#if USE_DEPRECATED_COREAUDIO_API RequireNoErr(AUGraphGetNodeInfo(_auGraph, synthNode, NULL, NULL, NULL, &_synth)); #else RequireNoErr(AUGraphNodeInfo(_auGraph, synthNode, NULL, &_synth)); |