AUGraphInitialize fails with 561015905 (AVAudioSessionErrorCodeCannotStartPlaying) when App is launched from Inter-App Audio Host

My audio app (a metronome) has Inter-App Audio support. When the app is launched, and I go to GarageBand and add it as an Inter-App Audio App, the connections are made and everything is good.


On the other hand, if the app is not running, and I go to GarageBand and add it as an Inter-App Audio App, GarageBand launches the app and and the connection is made (it claims successfully), but when I click on my app icon to go to my launched app, it cannot produce any sounds at all.


I looked at the console logs, and found that AUGraphInitialize fails with AVAudioSessionErrorCodeCannotStartPlaying in this case.


default 21:39:39.467564 -0700 Talanome AudioController::publishAsNode

default 21:39:39.468915 -0700 Talanome AudioController::addAudioUnitPropertyListener

default 21:39:39.468968 -0700 Talanome AudioController::initializeAudio: calling AUGraphInitialize

error 21:39:39.475786 -0700 Talanome AURemoteIO.cpp:1086:Initialize: failed: 561015905 (enable 2, outf< 2 ch, 44100 Hz, Int16, inter> inf< 2 ch, 0 Hz, Float32, non-inter>)

error 21:39:39.478269 -0700 Talanome AURemoteIO.cpp:1086:Initialize: failed: 561015905 (enable 2, outf< 2 ch, 44100 Hz, Int16, inter> inf< 2 ch, 0 Hz, Float32, non-inter>)

error 21:39:39.478312 -0700 Talanome ca_require_noerr: [result = destInfo->Initialize (this), 561015905] (goto gohome;)

default 21:39:39.478352 -0700 Talanome AUGraphInitialize returned 561015905


THis is what the console log looks like in the first case (when the app is launched first, and then connected to GarageBand):


default 21:42:03.817179 -0700 Talanome AudioController::initializeAudio

default 21:42:03.833656 -0700 Talanome AURemoteIO.cpp:434:AURemoteIO: AURemoteIO0x15686f240: reporterID=128849018949

error 21:42:03.833919 -0700 Talanome ca_require: SanityCheck(newDesc) InvalidFormat

default 21:42:03.833969 -0700 Talanome AudioUnitSetProperty returned -10868 for sampleRate

default 21:42:03.834093 -0700 Talanome AudioController::publishAsNode

default 21:42:03.835796 -0700 Talanome AudioController::addAudioUnitPropertyListener

default 21:42:03.835953 -0700 Talanome AudioController::initializeAudio: calling AUGraphInitialize


No Error messages were printed, which meant it finished successfully in this case.


The error massage AVAudioSessionErrorCodeCannotStartPlaying (561015905 ) says "This error type can occur if the app’s Information property list does not permit audio use, or if the app is in the background and using a category which does not allow background audio.
Clearly, my plist is ok and the category is ok too, because the app works fine if launched first. I'm wondering what might be occuring differently when the app is launched from within GarageBand and connected - from the console log, up to that point, it looks pretty much the same!
Any help or pointers would be appreciated!


Thanks,

Sridhar






Replies

What OS and version is this?