aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorMatthew Hoops2013-02-01 16:48:38 -0500
committerMatthew Hoops2013-02-01 16:48:38 -0500
commit31252e10950ee5ab6f2f812ddc64c9c59697be75 (patch)
tree2687be9ade585df4ec2781b4f00ba51f4bba3404 /backends
parent412ac740aa04428251a94073357f5458ed217f3f (diff)
downloadscummvm-rg350-31252e10950ee5ab6f2f812ddc64c9c59697be75.tar.gz
scummvm-rg350-31252e10950ee5ab6f2f812ddc64c9c59697be75.tar.bz2
scummvm-rg350-31252e10950ee5ab6f2f812ddc64c9c59697be75.zip
MACOSX: Fix compilation with the 10.2.8 SDK
This is a pretty bad hack of not using the kMusicDeviceProperty_SoundBankFSRef symbol and using its value instead. It felt wrong breaking 10.2.8 support just because of Soundfonts.
Diffstat (limited to 'backends')
-rw-r--r--backends/midi/coreaudio.cpp58
1 files changed, 32 insertions, 26 deletions
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 317268ae87..e42b8ca313 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -209,35 +209,41 @@ void MidiDriver_CORE::loadSoundFont(const char *soundfont) {
FSRef fsref;
err = FSPathMakeRef((const byte *)soundfont, &fsref, NULL);
-#ifdef MAC_OS_X_VERSION_10_5
- // Use kMusicDeviceProperty_SoundBankFSRef if we know it's available
- // (This became available in 10.3, but the 10.2 SDK has 10.3/10.4 defines)
+ SInt32 version;
+ err = Gestalt(gestaltSystemVersion, &version);
if (err == noErr) {
- err = AudioUnitSetProperty(
- _synth,
- kMusicDeviceProperty_SoundBankFSRef, kAudioUnitScope_Global,
- 0,
- &fsref, sizeof(fsref)
- );
- }
-#else
- // Otherwise, we know kMusicDeviceProperty_SoundBankFSSpec is available
- FSSpec fsSpec;
-
- if (err == noErr)
- err = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, &fsSpec, NULL);
-
- if (err == noErr) {
- err = AudioUnitSetProperty(
- _synth,
- kMusicDeviceProperty_SoundBankFSSpec, kAudioUnitScope_Global,
- 0,
- &fsSpec, sizeof(fsSpec)
- );
+ if (version >= 0x1030) {
+ // Use kMusicDeviceProperty_SoundBankFSRef in >= 10.3
+
+ // HACK HACK HACK HACK SUPER HACK: Using the value of 1012 instead of
+ // kMusicDeviceProperty_SoundBankFSRef so this compiles with the 10.2
+ // SDK (which does not have that symbol).
+ if (err == noErr) {
+ err = AudioUnitSetProperty(
+ _synth,
+ /*kMusicDeviceProperty_SoundBankFSRef*/ 1012, kAudioUnitScope_Global,
+ 0,
+ &fsref, sizeof(fsref)
+ );
+ }
+ } else {
+ // In 10.2, only kMusicDeviceProperty_SoundBankFSSpec is available
+ FSSpec fsSpec;
+
+ if (err == noErr)
+ err = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, NULL, &fsSpec, NULL);
+
+ if (err == noErr) {
+ err = AudioUnitSetProperty(
+ _synth,
+ kMusicDeviceProperty_SoundBankFSSpec, kAudioUnitScope_Global,
+ 0,
+ &fsSpec, sizeof(fsSpec)
+ );
+ }
+ }
}
-#endif // MAC_OS_X_VERSION_10_5
-
#else
// kMusicDeviceProperty_SoundBankURL was added in 10.5 as a replacement
// In addition, the File Manager API became deprecated starting in 10.8