0
0

I’ve got some sounds on the Fmod on Android looping.

Interestingly, Android respects the FMOD_LOOP_OFF and FMOD_LOOP_NORMAL flags on create sound where as the IOS version doesn’t seem to. You can mark all sounds as FMOD_LOOP_OFF in IOS and they will still loop if you mark the loop counter, where as in Android they do not.

Either way though, that’s not the issue I need help on.

I’ve marked sounds as FMOD_LOOP_NORMAL, passed in a loop counter of -1, and the sounds loop just fine. Trouble is, they don’t stop playing when the app is minimised. I can minimise the app and all the loop sounds continue to play, even thought the app is not visible.

What do I do about this? Do I have to stop them myself when the OnPause function in java is called (passing that control through to the app and doing it in C++), thereby having to preserve state so when the app is started up again, all the sounds I shut down are restarted? Or is there a handy dandy FMOD api call that will suspend / resume audio playback?

Thanks

  • You must to post comments
1
0

[quote="mathew":17gqz192]When the app is minimized it is still running in the background, hence it still produces audio. You can pause or mute all playback by using System::getMasterChannelGroup, then calling ChannelGroup::setPaused or ChannelGroup::setMute on the master channel group.[/quote:17gqz192]

I’m attempting to use this approach to mute an Android app (actually an iOS app ported using apportable), but the looping sounds just keep playing. I also tried ChannelGroup::setVolume(0.0f) with the same result. This is what I’m trying:
[code:17gqz192]
void muteAll(bool mute) {
FMOD::System *system;
FMOD::ChannelGroup *channelGroup;
FMOD_RESULT result;
_eventSystem->getSystemObject(&system);
system->getMasterChannelGroup(&channelGroup);
channelGroup->setMute(muted);
}
[/code:17gqz192]

(In the real code I do verify all calls return FMOD_OK.)
I did manage to silence each sound by calling Event::setMute(true) though. What could be the problem?

  • You must to post comments
0
0

The playSound example plays drumloop.wav (which loops by default) and it sets FMOD_LOOP_OFF to make it one-shot, do you experience that example looping forever on iOS? I’ve tested here and it behaves as expected, even with setting loop count.

When the app is minimized it is still running in the background, hence it still produces audio. You can pause or mute all playback by using System::getMasterChannelGroup, then calling ChannelGroup::setPaused or ChannelGroup::setMute on the master channel group.

  • You must to post comments
0
0

To do this with the event system I would recommend using EventSystem::getCategory to get the master category, then call EventCategory::setMute.

Also, if you are using the AudioTrack output mode, you can simply call FMODAudioDevice::stop when you enter the background to halt all audio processing.

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.