Hello, I wanted to ask a question regarding a problem that came up while using the fmod in the android studio.
First, playing music with the fmod in the Activity and using other apps at the same time can be done just like in the Service. Could you explain how this can happen?
Second, I would like the next music to play automatically after the previous one, so is there a method that can point the ending of the music?
If you want to play audio in a background you have to use a service.
If you’re using studio you can find out when an instance has stopped playing using EventInstance::getPlaybackState, or by adding a callback with EventInstance::setCallback and waiting for FMOD_STUDIO_EVENT_CALLBACK_STOPPED. If you’re using the lowlevel you can query Channel::isPlaying() or use a callback passed the Channel::setCallback and wait for FMOD_CHANNELCONTROL_CALLBACK_END.
Thanks for your reply. i understood second question’s reply. but in first quetion, i already knew that i have to use a service to play audio in a background. but when i play audio using activity, audio was also played in a background just like in the service. so i wondered how this can happen.
Audio will play in the background regardless of service vs activity.
For this reason we have System::mixerSuspend and System::mixerResume to stop this from happening. So if you want to play music in the background, simply don’t call suspend.