ios5 - Different result when processing Audio Interrupt for audio unit -
i have searched related posts here , apple documents, without answers. apple's sample code "auriotouch", have handler this:
static void riointerruptionlistener(void *inclientdata, uint32 ininterruption) { printf("session interrupted! --- %s ---", ininterruption == kaudiosessionbegininterruption ? "begin interruption" : "end interruption"); audioobjectimpl *this = (__bridge audioobjectimpl *)inclientdata; if (ininterruption == kaudiosessionendinterruption) { // make sure again active session xthrowiferror(audiosessionsetactive(true), "couldn't set audio session active"); xthrowiferror(audiooutputunitstart(this->riounit), "couldn't start unit"); this->ininterrupt = false; } if (ininterruption == kaudiosessionbegininterruption) { xthrowiferror(audiooutputunitstop(this->riounit), "couldn't stop unit"); this->unitisrunning = false; this->ininterrupt = true; } }
audioobjectimpl owner of audio unit. xthrowiferror(action, message) macro execute 'action', , if catches exception, print 'message'. copied auriotouch sample code.
this code did work incoming call interrupt, rejecting call, interrupted audio restored. crashed when choose ring tone in "settings|general|sound|ring" .
the crash point @ ...audiosessionsetactive(true)..., why different these 2 cases? , how can works in both cases ?
Comments
Post a Comment