aboutsummaryrefslogtreecommitdiff
path: root/backends/midi
diff options
context:
space:
mode:
authorD G Turner2012-10-12 17:03:32 +0100
committerD G Turner2012-10-12 17:03:32 +0100
commit151b7beb47ec4b964862d6779bd48e3a33482bbd (patch)
tree867717c5266d0908d95edd82560599be20a4ede9 /backends/midi
parent80af0e239473f85c49cc2da3c848dfcde41d4a37 (diff)
parent2b55837650c4229dc3d75b660cecfc7a3292e5e0 (diff)
downloadscummvm-rg350-151b7beb47ec4b964862d6779bd48e3a33482bbd.tar.gz
scummvm-rg350-151b7beb47ec4b964862d6779bd48e3a33482bbd.tar.bz2
scummvm-rg350-151b7beb47ec4b964862d6779bd48e3a33482bbd.zip
Merge branch 'master' into teenagentRefactor
Conflicts: engines/teenagent/callbacks.cpp
Diffstat (limited to 'backends/midi')
-rw-r--r--backends/midi/coreaudio.cpp31
-rw-r--r--backends/midi/sndio.cpp4
2 files changed, 28 insertions, 7 deletions
diff --git a/backends/midi/coreaudio.cpp b/backends/midi/coreaudio.cpp
index 43c801287d..94262d0d92 100644
--- a/backends/midi/coreaudio.cpp
+++ b/backends/midi/coreaudio.cpp
@@ -172,10 +172,15 @@ int MidiDriver_CORE::open() {
// Load custom soundfont, if specified
if (ConfMan.hasKey("soundfont")) {
- FSRef fsref;
- FSSpec fsSpec;
const char *soundfont = ConfMan.get("soundfont").c_str();
+ // TODO: We should really check whether the file contains an
+ // actual soundfont...
+
+#if USE_DEPRECATED_COREAUDIO_API
+ // Before 10.5, we need to use kMusicDeviceProperty_SoundBankFSSpec
+ FSRef fsref;
+ FSSpec fsSpec;
err = FSPathMakeRef ((const byte *)soundfont, &fsref, NULL);
if (err == noErr) {
@@ -183,8 +188,6 @@ int MidiDriver_CORE::open() {
}
if (err == noErr) {
- // TODO: We should really check here whether the file contains an
- // actual soundfont...
err = AudioUnitSetProperty (
_synth,
kMusicDeviceProperty_SoundBankFSSpec, kAudioUnitScope_Global,
@@ -192,9 +195,27 @@ int MidiDriver_CORE::open() {
&fsSpec, sizeof(fsSpec)
);
}
+#else
+ // kMusicDeviceProperty_SoundBankFSSpec is present on 10.6+, but broken
+ // kMusicDeviceProperty_SoundBankURL was added in 10.5 as a replacement
+ CFURLRef url = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (const UInt8 *)soundfont, strlen(soundfont), false);
+
+ if (url) {
+ err = AudioUnitSetProperty (
+ _synth,
+ kMusicDeviceProperty_SoundBankURL, kAudioUnitScope_Global,
+ 0,
+ &url, sizeof(url)
+ );
+
+ CFRelease(url);
+ } else {
+ warning("Failed to allocate CFURLRef from '%s'", soundfont);
+ }
+#endif
if (err != noErr)
- warning("Failed loading custom sound font '%s' (error %ld)\n", soundfont, (long)err);
+ error("Failed loading custom sound font '%s' (error %ld)", soundfont, (long)err);
}
#ifdef COREAUDIO_DISABLE_REVERB
diff --git a/backends/midi/sndio.cpp b/backends/midi/sndio.cpp
index 21c9ea4fec..a065a658e1 100644
--- a/backends/midi/sndio.cpp
+++ b/backends/midi/sndio.cpp
@@ -81,7 +81,7 @@ void MidiDriver_Sndio::send(uint32 b) {
if (!hdl)
return;
- buf[0] = b & 0xff;
+ buf[0] = b & 0xff;
buf[1] = (b >> 8) & 0xff;
buf[2] = (b >> 16) & 0xff;
buf[3] = (b >> 24) & 0xff;
@@ -101,7 +101,7 @@ void MidiDriver_Sndio::send(uint32 b) {
void MidiDriver_Sndio::sysEx(const byte *msg, uint16 length) {
if (!hdl)
return;
-
+
unsigned char buf[266];
assert(length + 2 <= ARRAYSIZE(buf));