IOS: How can i resume ipod music after sound recording with good exprience?

(huzhiyong) #1

Hi, Our project is a sound-recording capable IOS game, but also we need to compatible with ipod music in game playing. Our team manager require that when recording is done, the fmod music and ipod music(external music) need to resume playing.
this is easy to resolve if AVAudioSession is matain by ourself, but when do with fmod, we don’t know fmod do in the background, so we need to refer to the document to get the most suitable method to settle it.

But we encount a lot of problem within it:
1.we have tried this method: set the FMOD_IPHONE_SESSIONCATEGORY_PLAYANDRECORD in the extradrivedata when Init the EventSystem. also, I set the forceMixWithOthers=true and forceSpeakerOutput=false. As document says, when recording and playing at the same time, the iphone will redirect to output to ear receiver speaker, but on iphone/ipad device in practice, when recording start, (use objC mehotd: AudioQueueStart()…), fmod music and ipod music play on main speak as well,this will result in recorded sound record the playing music as well.we need to record the sound without ipod music. ipod music is playing as well when recording, so I tried to reduce ipod music when recording, the frustration is that FMOD_Iphone_DuckOtherAudio take my 1.5second to process this duck music when ipod music is playing. 1.5second is so long to depress the user’s exprience.

so, how can I do with it more properily to let ipod music to stop(or low the volume), and record, then resume ipod music after recording?

Very appreciated!

(Mathew Block) #2

Have you tried using AVAudioSessionCategoryOptionDuckOthers directly instead of FMOD_Iphone_DuckOtherAudio?

(huzhiyong) #3

use AVAudioSessionCategoryOptionDuckOthers with VAudioSeesion setCategory method doesn’t work, it seems fmod takeover the control of the AVAudioSession behavour.

(Mathew Block) #4

Okay, yes doing custom AudioSession code can be difficult with FMOD 4 because it handles sessions internally. Please note that with FMOD 5 (FMOD Studio) all AudioSession handling has been removed, so the developer is free to use any session API alongside FMOD. I’d highly recommend upgrading if possible for your project.

(huzhiyong) #5

Finally, we compromise to the DuckOtherAudio, just has 1.5 seconds glith…use a pic to display this transition step;