When I start our app Exult, I get the warning:
WARNING: 140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API’s in AudioComponent.h.
Since we got rid of this, I think this comes from your code.
From what I understand your CoreAudio code kept things compatible to OS X version <=10.5. Since you support only 10.7 and above you can discard some of that code and use the same code as the iOS one.
I made these changes that I need to confirm yet but from what we did in Exult and ScummVM did, this looks mostly correct.
I’m posting this first here before I do it in bugzilla, since I first need to test this. Most importantly, do you think I’m right or totally wrong?
Code:
diff --git a/src/audio/coreaudio/SDL_coreaudio.c b/src/audio/coreaudio/SDL_coreaudio.c
— a/src/audio/coreaudio/SDL_coreaudio.c
+++ b/src/audio/coreaudio/SDL_coreaudio.c
@@ -406,13 +406,7 @@
AudioUnitSetProperty(this->hidden->audioUnit,
kAudioUnitProperty_SetRenderCallback,
scope, bus, &callback, sizeof(callback));-
-
#if MACOSX_COREAUDIO
-
CloseComponent(this->hidden->audioUnit);
-
#else AudioComponentInstanceDispose(this->hidden->audioUnit);
-
#endif
-
this->hidden->audioUnitOpened = 0; } SDL_free(this->hidden->buffer);
@@ -482,13 +476,8 @@
{
OSStatus result = noErr;
AURenderCallbackStruct callback;
-#if MACOSX_COREAUDIO
- ComponentDescription desc;
- Component comp = NULL;
-#else
AudioComponentDescription desc;
AudioComponent comp = NULL;
-#endif
const AudioUnitElement output_bus = 0;
const AudioUnitElement input_bus = 1;
const AudioUnitElement bus = ((iscapture) ? input_bus : output_bus);
@@ -507,11 +496,10 @@
#if MACOSX_COREAUDIO
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
-
comp = FindNextComponent(NULL, &desc);
#else
desc.componentSubType = kAudioUnitSubType_RemoteIO;
+#endif
comp = AudioComponentFindNext(NULL, &desc);
-#endifif (comp == NULL) {
SDL_SetError(“Couldn’t find requested CoreAudio component”);
@@ -519,17 +507,12 @@
}/* Open & initialize the audio unit */
-#if MACOSX_COREAUDIO -
result = OpenAComponent(comp, &this->hidden->audioUnit);
-
CHECK_RESULT(“OpenAComponent”);
-#else
/*
AudioComponentInstanceNew only available on iPhone OS 2.0 and Mac OS X 10.6
We can’t use OpenAComponent on iPhone because it is not present
*/
result = AudioComponentInstanceNew(comp, &this->hidden->audioUnit);
CHECK_RESULT(“AudioComponentInstanceNew”);
-#endifthis->hidden->audioUnitOpened = 1;
diff --git a/src/audio/coreaudio/SDL_coreaudio.h b/src/audio/coreaudio/SDL_coreaudio.h
— a/src/audio/coreaudio/SDL_coreaudio.h
+++ b/src/audio/coreaudio/SDL_coreaudio.h
@@ -32,9 +32,9 @@
#if MACOSX_COREAUDIO
#include <CoreAudio/CoreAudio.h>
#include <CoreServices/CoreServices.h>
-#else
+#endif
#include <AudioToolbox/AudioToolbox.h>
-#endif
+
#include <AudioUnit/AudioUnit.h>