0
0

Hi there, I’m trying to record with fmod and play movies with MPMoviePlayerController (not at the same time but switching fast). I also output other sounds through fmod.

I want to initialize fmod with the PLAYANDRECORD audio session category. This allows for smooth and fast starting and stopping of recording.

If I initialize with any other audio session category fmod will automatically switch to PLAYANDRECORD when we start or stop recording. An audible lag will be heard in the sound output during the switch.

So adding extradriverdata to the System::init():
[code:1lfa5slr]extradriverdata.sessionCategory = FMOD_IPHONE_SESSIONCATEGORY_PLAYANDRECORD;[/code:1lfa5slr]

Now when I play a movie via MPMoviePlayerController recording stops but sound output continues. When the movie is done and we want to record again, it seems the recording engine has crashed or lost connection with the input.

The recording input has the same status as before the movie but the position is stuck. System responds to record calls but nothing happens.

Can I set the AudioSessionCategory manually or prepare the recording input in some way so it can recover?

Is there a way to stop audio from MPMoviePlayerController?

Any input is appreciated. I really need a solution on this issue.

  • You must to post comments
0
0

[quote:1asjusrt]Now when I play a movie via MPMoviePlayerController recording stops but sound output continues.[/quote:1asjusrt]
Is it possible for you to call recordStop before starting the movie to avoid this problem?

[quote:1asjusrt]Can I set the AudioSessionCategory manually or prepare the recording input in some way so it can recover?[/quote:1asjusrt]
Setting AudioSessionCategory manually is dangerous, FMOD needs to keep track of that stuff.

[quote:1asjusrt]Is there a way to stop audio from MPMoviePlayerController?[/quote:1asjusrt]
Not that I am aware of, however I haven’t looked at the API for that in some time.

If you link with the logging version of FMOD you should be able to get an idea of what is happening when the movie starts. If you could report that log it might help diagnose the issue further.

  • You must to post comments
0
0

[quote:czh0rusa]Is it possible for you to call recordStop before starting the movie to avoid this problem?[/quote:czh0rusa]

Sadly no, as soon as I play a movie after initializing fmod (with PlayAndRecord) I lose connection to the recording input. Does not matter if I recordStop before playing the movie or if I have not recorded at all before the movie has started. The movie interrupts the session and recording does not return to fmod.

When the movie is done it seems like fmod is not aware that it has lost the recording input. The system responds normally to startRecord and stopRecord and the recording status changes. But the recording position does not update and nothing is recorded. The logging from startRecord and stopRecord are as normal, I get no errors.

When the movie is started, fmod logs:

[code:czh0rusa]
FMOD: OutputCoreAudio::handleRouteChange : Audio route has change from ‘SpeakerAndMicrophone’ to ‘SpeakerAndMicrophone’ (Reason 3).
FMOD: OutputCoreAudio::handleRouteChange : Audio route has change from ‘Speaker’ to ‘SpeakerAndMicrophone’ (Reason 4).
[/code:czh0rusa]

This route change is never executed again, it only happens the first time we play a movie after initializing fmod.

  • You must to post comments
0
0

Are you able to playback audio through FMOD during or after playback of the movie?

  • You must to post comments
0
0

Yes, both during and after.

  • You must to post comments
0
0

I can reproduce what you are experiencing, recording seems to be disabled by the OS while a movie is playing if the movie is sharing the audio session with the application.

I have noticed however, if you init FMOD with play-and-record, set force-mix-with-others to true and set movie player useApplicationAudioSession to no recording is not interrupted. Is this an option for you?

  • You must to post comments
0
0

Yes, this works, great!

I tried separately forceMixWithOthers:true or useApplicationAudioSession:no without effect, but applying both together runs smoothly.

Apple’s AudioSessions confuse me, but this documentation helped gives a good idea of what’s going on:
http://developer.apple.com/library/iOS/ … ovies.html

Thank you for all the help mathew.

  • You must to post comments
0
0

Excellent, I’m glad it’s working for you now.

The audio session API can be pretty confusing, and doesn’t always work as advertised. Sometimes we need to be a bit creative with its use to make things work.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.