-
Notifications
You must be signed in to change notification settings - Fork 83
Call mixerSuspend and mixerResume when moving to/from background on iOS
#402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Is there a reason why it's for iOS only and not enable for Android ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for calling FMOD's mixerSuspend and mixerResume functions when an iOS application moves to/from the background, addressing issue #401.
- Exposes two new methods
mixer_suspend()andmixer_resume()in the FmodServer C++ API - Integrates these methods into the GDScript bindings for use in Godot
- Implements automatic suspension/resumption in the demo FmodManager when the iOS app loses/gains focus
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/fmod_server.h | Adds public method declarations for mixer_suspend() and mixer_resume() |
| src/fmod_server.cpp | Implements the new methods as wrappers around FMOD's core system mixer functions and registers them with Godot's class binding system |
| demo/addons/fmod/FmodManager.gd | Calls the new mixer methods in response to iOS application focus notifications to properly suspend/resume audio when backgrounded |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
demo/addons/fmod/FmodManager.gd
Outdated
| func _notification(what): | ||
| FmodServer.notification(what) | ||
|
|
||
| if OS.has_feature("ios"): |
Copilot
AI
Nov 12, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to FMOD documentation, mixerSuspend() and mixerResume() should be called when the app goes to the background on mobile platforms, not just iOS. Consider also handling Android by checking for OS.has_feature("android") in addition to iOS. This would ensure proper audio handling when the app is backgrounded on all mobile platforms.
| if OS.has_feature("ios"): | |
| if OS.has_feature("ios") or OS.has_feature("android"): |
We weren't finding any issues with Android sound not returning, but I agree that this solution would be totally fine for Android too. On Android I believe the sound just continues in the background unless you choose to mute it. |
Addresses #401