[Scummvm-cvs-logs] scummvm master -> 85c8bd6e655b42dfa84bc7c909a500917c48468a

vinterstum oystein at geheb.com
Sat Jan 14 23:01:03 CET 2012


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ad1c2a45f1 MACOSX: Default to new CoreAudio API on x86, and to old on PowerPC
f57b66e984 MACOSX: Replace use of a 10.4 only API by one available since 10.0
85c8bd6e65 Merge pull request #157 from fingolfin/coreaudio


Commit: ad1c2a45f12bb5401ae5c0d73ef948dea734c467
    https://github.com/scummvm/scummvm/commit/ad1c2a45f12bb5401ae5c0d73ef948dea734c467
Author: Max Horn (max at quendi.de)
Date: 2012-01-14T10:36:24-08:00

Commit Message:
MACOSX: Default to new CoreAudio API on x86, and to old on PowerPC

The new API has been present since Mac OS X 10.5 (released four years ago,
in October 2007), and also since iOS 2.0 (thus, the iOS port may be able to
use it, too). Moreover, 10.5 was the last system to support PowerPC.

Changed paths:
    backends/midi/coreaudio.cpp



diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 4b707ea..0c251a2 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));


Commit: f57b66e9845586a8457f68b52436ecbc97f80607
    https://github.com/scummvm/scummvm/commit/f57b66e9845586a8457f68b52436ecbc97f80607
Author: Max Horn (max at quendi.de)
Date: 2012-01-14T11:13:50-08:00

Commit Message:
MACOSX: Replace use of a 10.4 only API by one available since 10.0

Changed paths:
    gui/browser_osx.mm



diff --git a/gui/browser_osx.mm b/gui/browser_osx.mm
index 017b31b..b8aa7c5 100644
--- a/gui/browser_osx.mm
+++ b/gui/browser_osx.mm
@@ -62,11 +62,7 @@ int BrowserDialog::runModal() {
 	NSOpenPanel * panel = [NSOpenPanel openPanel];
 	[panel setCanChooseDirectories:YES];
 	if ([panel runModalForTypes:nil] == NSOKButton) {
-#ifdef __POWERPC__
-		const char *filename = [[panel filename] cString];
-#else
-		const char *filename = [[panel filename] cStringUsingEncoding:NSUTF8StringEncoding];
-#endif
+		const char *filename = [[panel filename] UTF8String];
 		_choice = Common::FSNode(filename);
 		choiceMade = true;
 	}


Commit: 85c8bd6e655b42dfa84bc7c909a500917c48468a
    https://github.com/scummvm/scummvm/commit/85c8bd6e655b42dfa84bc7c909a500917c48468a
Author: Oystein Eftevaag (oystein at geheb.com)
Date: 2012-01-14T14:00:40-08:00

Commit Message:
Merge pull request #157 from fingolfin/coreaudio

MACOSX: Use modern CoreAudio API on modern systems by default, cleanup

Changed paths:
    backends/midi/coreaudio.cpp
    gui/browser_osx.mm









More information about the Scummvm-git-logs mailing list