0
0

With iOS 4 and FMOD, audio playback works fine in the background during a multitasking session until another app interrupts the audio. When my app returns to the foreground, the audio session is no longer valid and no sound is generated. Although, FMOD continues to function as if it had a valid audio session.

I don’t see any callbacks inside FMOD to inform me when the audio session has been interrupted so I know to reinitialize the next time I become active. I do see a system callback for when system audio devices have changed. Is this the callback I’m looking for? Am I missing something or do I have to do this through the iOS apis? If so, is there a way for me to get the audio session handle from FMOD?

I appreciate any help you can provide on this.

Thanks,
Tim

  • You must to post comments
0
0

How can I make solution on stable version 4.30.06?

I found ‘mixer’s restarting’ &’ waitting on 1sec’ in log of interrupt of version 4.31.05

I want make like it.

  • You must to post comments
0
0

Hi guys,

Our iPhone guy is out of the office until the 12th of July, he should be able to help you out when he returns.

-Pete

  • You must to post comments
0
0

mathew, i don’t like another hack in my multiplatform FMOD wrapper, it’s already full of "#ifdef PSP" and "#ifdef APPLE" etc.

please remove this FMOD_IPhone_RestoreAudioSession!
AFAIK you can use NSNotificationCenter to observe application events.

and by the way your solution doesn’t work for me with hardware mp3 streaming. I’m calling this function in applicationWillEnterForeground and applicationDidBecomeActive, but no luck – i can’t hear music after resume.

I’m using v4.32.00

  • You must to post comments
0
0

Matthew, in some case the FMOD_IPhone_RestoreAudioSession does not work in applicationWillEnterForeground

for example, if I press the home button, and if I start the game "topple 1" (a NON multitasking game), and then if I switch back to my game, it hangs for 3 seconds and I have no more sounds. here is the log:

FMOD: OutputCoreAudio::restoreAudioSession : Restoring audio session.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
2010-12-18 22:39:56.424 Perfect Cell[4339:307] 22:39:56.423 <0x3e088868> Stop posting message to kill mediaserverd (4300)
FMOD: OutputCoreAudio::setupAudioUnit : Cannot initialize audio device. (err: 268435459)

I tried to add AudioSessionSetActive (false) in applicationDidEnterBackground. I know it is not recommended, in some cases it is better (it can restore the audio session when it comes back in foreground), but in some cases it crashes.

I am using FMOD 4.32.06, with the SDK 4.2 and I cannot get it to work in 100% of the case, there is always an interruption case where I lose the sounds, or the mp3, or the app simply crash. Also I cannot find a single game on the App Store that always works with multitasking and sounds… it seems that Apple did something wrong.

edit: I saw the other post about v4.33.07. we really need it here, it may fix the bug. Please release it asap :)

  • You must to post comments
0
0

And ..

Add Log on Phone call interruption

FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
Current language: auto; currently objective-c
(gdb) continue
FMOD: EventI::stopInternal : 0x60760f8 1
> *Network Disconnected
FMOD: OutputCoreAudio::handleInterruption : External audio interruption has been resolved… restarting output.
FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 1
FMOD: Thread::initThread : – Stacksize 0. Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
FMOD: Thread::callback : * FMOD mixer thread started
FMOD: Thread::initThread : done.
FMOD: OutputCoreAudio::start : Cannot activate audio session. (err: 560161140)
FMOD: EventI::stopInternal : 0x60760f8 1
FMOD: EventGroupI::loadEventDataInternal : m_flags: 00000000
FMOD: EventI::start : 0x60760f8
FMOD: SoundI::getSubSound : sound 0x608cfe0. Subsound index 5 / 14
FMOD: CodecFSB::setPositionInternal : subsound 5 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done

  • You must to post comments
0
0

The implementation of CoreAudio that is in the development branch is considerably different from the implementation in the stable branch so it is currently not possible to move that change to the stable branch.

At this time I would recommend using the development branch or waiting for the currently development branch to become stable (which should be within the next week or two).

  • You must to post comments
0
0

Just posting to join the conversation. I am having the same issue, and in my application it is non-trivial to reinitialize the entire sound system, so I am hoping we can come up with a better solution.

Thanks,
Luke

  • You must to post comments
0
0

Firstly thank you for your input, I understand it isn’t desirable to have another function and behavior you need to maintain for only one platform. I will see if I can remove the requirement for a future release making internal use of the notification center.

As for the issue with hardware MP3s, this is already fixed in the next version of FMOD, it just hasn’t been released yet. It should be out this week.

  • You must to post comments
0
0

Yeah there are many niche cases where the OS fails to report interruptions correctly and falls over. The latest fix catches a few different notifications from the OS in hopes to try and recover as best as possible. I believe we are planning to release either today or tomorrow so I’m looking forward to seeing if the new fixes solve your issue.

  • You must to post comments
0
0

That is quite strange, I have tested here using the same FMOD version, same phone, same OS version using the playstream example and I cannot reproduce the issues you are having.

Have you tried testing on another device?

  • You must to post comments
0
0

I still have issues with iOS4 on iPhone 4. (I tried with 4.31.04, 4.31.05 before)

What I did:

  • I downloaded the last stable version (4.32.00).
  • I build and start the example "playstream" on the iPhone 4 (OS 4.0).
  • I hear the music, then I click the home button to "quit"
  • I click on the icon to bring playstream in foreground
  • I hear a little glitch (coming from the music), and then no more sound!
  • I wait a few seconds, sound came back when a loop is completed

The same happen in my game. The only difference is that "playstream" use software decoder, and I want to use hardware decoder, but none worked

I tried to use FMOD_Iphone_RestoreAudioSession() in ApplicationWillEnterForeground with no success. Any help is welcome

  • You must to post comments
0
0

Audio playback should be automagically reinitialized by FMOD after an interruption occurs. That being said, we have not tested with iOS 4.0 yet as I have been on leave.

I will be addressing this issue this week, and will report back when I have a solution.

  • You must to post comments
0
0

Is a long time.
In Northern Hemisphere, Raining is calling autumn. :)

I tried test New iphone FMOD SDK. (v4.32 and v 4.33)
I’m Sorry, I found error.

Error is that I can not hear sound after phone call.
but This error is not made by calling sound interruption.

I copy FMOD debug message to following.
1) I can hear Sound : calling Sound Interruption. -> application is resumed
FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
FMOD: EventI::stopInternal : 0x8ae810 1
FMOD: OutputCoreAudio::handleInterruption : External audio interruption has been resolved… restarting output.
FMOD: OutputCoreAudio::setupAudioSession : Cannot activate audio session. Waiting 1s then retrying…
FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 1
FMOD: Thread::initThread : – Stacksize 32768. Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
FMOD: Thread::callback : * FMOD mixer thread started
FMOD: Thread::initThread : done.
FMOD: EventI::stopInternal : 0x8ae810 1
FMOD: EventGroupI::loadEventDataInternal : m_flags: 00000000
FMOD: EventI::start : 0x8ae810
FMOD: SoundI::getSubSound : sound 0x664640. Subsound index 7 / 8
FMOD: SoundI::getSubSound : sound 0x664640. Subsound index 7 / 8
FMOD: CodecFSB::setPositionInternal : subsound 7 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done

2) I can not hear sound : After phone call -> application is resumed
FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
FMOD: EventI::stopInternal : 0x8ae810 1
FMOD: OutputCoreAudio::handleRouteChange : Audio route has change from ‘Speaker’ to ‘Speaker’ (Reason 3).
FMOD: EventI::stopInternal : 0x8ae810 1
FMOD: EventGroupI::loadEventDataInternal : m_flags: 00000000
FMOD: EventI::start : 0x8ae810
FMOD: SoundI::getSubSound : sound 0x664640. Subsound index 7 / 8
FMOD: SoundI::getSubSound : sound 0x664640. Subsound index 7 / 8
FMOD: CodecFSB::setPositionInternal : subsound 7 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done

Could you help me for this error situation?

  • You must to post comments
0
0

Looking forward to that; I’m another one where calling FMOD_IPhone_RestoreAudioSession from applicationWillEnterForeground does squat. Calling it from applicationDidBecomeActive hasn’t failed yet, though I understand I shouldn’t be doing that. :) Looking forward to an official fix because this has been dogging me a while …

  • You must to post comments
0
0

I retry it On 1/07/10 4.30.05 – Stable branch update
So downgrade FMOD SDK…

Then Critical error situation is removed 😀

but After Phone Call an reject ..
No Sound output

then.. I copy Log …

FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
FMOD: OutputCoreAudio::handleInterruption : External audio interruption has been resolved… restarting output.
FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 1
FMOD: Thread::initThread : – Stacksize 0. Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
FMOD: Thread::callback : * FMOD mixer thread started
FMOD: Thread::initThread : done.
FMOD: OutputCoreAudio::start : Cannot activate audio session. (err: 560161140)

.

  • You must to post comments
0
0

Can you post the TTY output from the playstream example?

  • You must to post comments
0
0

When accepting a phone call the application is backgrounded, so when the call is complete the application isn’t notified. To solve this new issues with iOS 4.0 I have added the function FMOD_IPhone_RestoreAudioSession() which should be called from applicationWillEnterForeground to ensure FMOD is alive and well when the app starts up again.

This new function will be available in our next release.

  • You must to post comments
0
0

I find new FMOD SDK v4.32.01

and go to test.

but I find same situation defore.

follow text is from debug console>

1) No Error : suspend/resume by homekey press
[i:3w5afyas]FMOD: EventI::stopInternal : 0x606b750 1
FMOD: EventI::stopInternal : 0x606b750 1
FMOD: EventGroupI::loadEventDataInternal : m_flags: 00000000
FMOD: EventI::start : 0x606b750
FMOD: SoundI::getSubSound : sound 0x6083380. Subsound index 13 / 14
FMOD: SoundI::getSubSound : sound 0x6083380. Subsound index 13 / 14
FMOD: CodecFSB::setPositionInternal : subsound 13 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done
FMOD: EventGroupI::freeEventDataInternal : eventgroup [SE] 0x440001
FMOD: EventI::release : [Hit_Wall]
FMOD: EventI::stopInternal : 0x606b380 1
FMOD: EventI::release : done
FMOD: SoundI::release : Hit_Wall.wav (0x607fd68)
FMOD: SoundI::release : free this. (0x607fd68)
FMOD: SoundI::release : done (0x607fd68)
FMOD: SoundI::release : Probaseball_bank01.fsb (0x607fae8)
FMOD: SoundI::release : release codec. (0x607fae8)
FMOD: Codec::release :
FMOD: CodecFSB::closeInternal :
FMOD: Codec::release :
FMOD: Plugin::release : (0x606d7c8)
FMOD: Plugin::release : done
FMOD: Codec::release : done
FMOD: CodecFSB::closeInternal : done
FMOD: Plugin::release : (0x606c038)
FMOD: Plugin::release : done
FMOD: Codec::release : done
FMOD: SoundI::release : free this. (0x607fae8)
FMOD: SoundI::release : done (0x607fae8)
FMOD: EventGroupI::freeEventDataInternal : done
FMOD: EventI::stopInternal : 0x606b380 1
FMOD: EventGroupI::loadEventDataInternal : m_flags: 00000000
FMOD: SystemI::createSoundInternal : filename = /var/mobile/Applications/041B5F33-494D-453F-9B78-00BF1D2774FB/Template.app/Probaseball_bank01.fsb : mode 00000202
FMOD: SystemI::createSoundInternal : exinfo->cbsize = 124
FMOD: SystemI::createSoundInternal : exinfo->inclusionlist = 0x2fffd29c
FMOD: SystemI::createSoundInternal : exinfo->inclusionlistnum = 1
FMOD: SystemI::createSoundInternal : exinfo->suggestedsoundtype = 8
FMOD: SystemI::createSoundInternal : 17 codecs found. Scan all until one succeeds
FMOD: CodecFSB::openInternal : attempting to open as FSB..
FMOD: CodecFSB::openInternal : found FSB4
FMOD: CodecFSB::openInternal : FSB contains 51 sounds
FMOD: CodecFSB::openInternal : done.
FMOD: SystemI::createSoundInternal : Format has 51 subsounds.
FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESAMPLE
FMOD: SystemI::createSoundInternal : Multi-sample sound (51 subsounds), create a sample container.
FMOD: SystemI::createSoundInternal : creating subsound 2/51
FMOD: SystemI::createSample : mode 00000202 length 20672 samples, lengthbytes 11648
FMOD: SystemI::createSample : subsamples = 1, channels = 1
FMOD: SystemI::createSample : subsample 0. output = 0x6014708
FMOD: SystemI::createSample : mSoftware = 0x6014708
FMOD: OutputSoftware::createSample : lengthpcm 20672, lengthbytes 11648, channels 1, format 7, mode 0000024a
FMOD: OutputSoftware::createSample : done
FMOD: SystemI::createSample : done
FMOD: CodecFSB::setPositionInternal : subsound 2 position 0 postype 8
FMOD: CodecFSB::setPositionInternal : done
FMOD: SystemI::createSoundInternal : No name found in file, use filename.
FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.
[/i:3w5afyas]

2) Error : I do not hear sound after phone call
[i:3w5afyas]FMOD: CodecFSB::setPositionInternal : subsound 13 position 0 postype 2
FMOD: CodecFSB::setPositionInternal : done
FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
FMOD: EventGroupI::freeEventDataInternal : eventgroup [SE] 0x440001
FMOD: EventI::release : [Hit_Wall]
FMOD: EventI::stopInternal : 0x606b380 1
FMOD: EventI::release : done
FMOD: SoundI::release : Hit_Wall.wav (0x606d488)
FMOD: SoundI::release : free this. (0x606d488)
FMOD: SoundI::release : done (0x606d488)
FMOD: SoundI::release : Probaseball_bank01.fsb (0x606d208)
FMOD: SoundI::release : release codec. (0x606d208)
FMOD: Codec::release :
FMOD: CodecFSB::closeInternal :
FMOD: Codec::release :
FMOD: Plugin::release : (0x606cd80)
FMOD: Plugin::release : done
FMOD: Codec::release : done
FMOD: CodecFSB::closeInternal : done
FMOD: Plugin::release : (0x606cab0)
FMOD: Plugin::release : done
FMOD: Codec::release : done
FMOD: SoundI::release : free this. (0x606d208)
FMOD: SoundI::release : done (0x606d208)
FMOD: EventGroupI::freeEventDataInternal : done
FMOD: OutputCoreAudio::handleRouteChange : Audio route has change from ‘Speaker’ to ‘Speaker’ (Reason 3).
FMOD: EventI::stopInternal : 0x606b380 1
FMOD: EventGroupI::loadEventDataInternal : m_flags: 00000000
FMOD: SystemI::createSoundInternal : filename = /var/mobile/Applications/041B5F33-494D-453F-9B78-00BF1D2774FB/Template.app/Probaseball_bank01.fsb : mode 00000202
FMOD: SystemI::createSoundInternal : exinfo->cbsize = 124
FMOD: SystemI::createSoundInternal : exinfo->inclusionlist = 0x2fffd29c
FMOD: SystemI::createSoundInternal : exinfo->inclusionlistnum = 1
FMOD: SystemI::createSoundInternal : exinfo->suggestedsoundtype = 8
FMOD: SystemI::createSoundInternal : 17 codecs found. Scan all until one succeeds
FMOD: CodecFSB::openInternal : attempting to open as FSB..
FMOD: CodecFSB::openInternal : found FSB4
FMOD: CodecFSB::openInternal : FSB contains 51 sounds
FMOD: CodecFSB::openInternal : done.
FMOD: SystemI::createSoundInternal : Format has 51 subsounds.
FMOD: SystemI::createSoundInternal : Create as FMOD_CREATESAMPLE
FMOD: SystemI::createSoundInternal : Multi-sample sound (51 subsounds), create a sample container.
FMOD: SystemI::createSoundInternal : creating subsound 2/51
FMOD: SystemI::createSample : mode 00000202 length 20672 samples, lengthbytes 11648
FMOD: SystemI::createSample : subsamples = 1, channels = 1
FMOD: SystemI::createSample : subsample 0. output = 0x6014708
FMOD: SystemI::createSample : mSoftware = 0x6014708
FMOD: OutputSoftware::createSample : lengthpcm 20672, lengthbytes 11648, channels 1, format 7, mode 0000024a
FMOD: OutputSoftware::createSample : done
FMOD: SystemI::createSample : done
FMOD: CodecFSB::setPositionInternal : subsound 2 position 0 postype 8
FMOD: CodecFSB::setPositionInternal : done
FMOD: SystemI::createSoundInternal : No name found in file, use filename.
FMOD: SystemI::createSoundInternal : done. OpenState now = FMOD_OPENSTATE_READY.[/i:3w5afyas]

  • You must to post comments
0
0

I wish it will fix all issues too. don’t worry if it does not come before Xmas, we can wait, and happy hollidays Mathew.

  • You must to post comments
0
0

And Test on alram trigger
I can hear Sound.

FMOD: OutputCoreAudio::handleInterruption : Audio has been interrupted by an external event… stopping output.
FMOD: Thread::callback : * FMOD mixer thread finished
FMOD: Thread::close : FMOD mixer thread thread destroyed
FMOD: OutputCoreAudio::handleInterruption : External audio interruption has been resolved… restarting output.
FMOD: Thread::initThread : Initializing FMOD mixer thread. priority 1
FMOD: Thread::initThread : – Stacksize 0. Stack pointer 0x0 : usesemaphore = 1 : sleeptime = 0
FMOD: Thread::callback : * FMOD mixer thread started
FMOD: Thread::initThread : done.
FMOD: OutputCoreAudio::start : Hardware buffer size: 1024 samples, hardware sample rate: 24000Hz.

  • You must to post comments
Showing 1 - 20 of 48 results
Your Answer

Please first to submit.