Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions demo/addons/fmod/FmodManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ func _process(delta):

func _notification(what):
FmodServer.notification(what)

if OS.has_feature("mobile"):
match what:
NOTIFICATION_APPLICATION_FOCUS_OUT: FmodServer.mixer_suspend()
NOTIFICATION_APPLICATION_FOCUS_IN: FmodServer.mixer_resume()
10 changes: 10 additions & 0 deletions src/fmod_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ void FmodServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("unpause_all_events"), &FmodServer::unpause_all_events);
ClassDB::bind_method(D_METHOD("mute_all_events"), &FmodServer::mute_all_events);
ClassDB::bind_method(D_METHOD("unmute_all_events"), &FmodServer::unmute_all_events);
ClassDB::bind_method(D_METHOD("mixer_suspend"), &FmodServer::mixer_suspend);
ClassDB::bind_method(D_METHOD("mixer_resume"), &FmodServer::mixer_resume);

ClassDB::bind_method(D_METHOD("create_sound_instance", "path"), &FmodServer::create_sound_instance);
REGISTER_ALL_CONSTANTS
Expand Down Expand Up @@ -842,6 +844,14 @@ void FmodServer::unmute_all_events() {
}
}

void FmodServer::mixer_suspend() {
ERROR_CHECK(coreSystem->mixerSuspend());
}

void FmodServer::mixer_resume() {
ERROR_CHECK(coreSystem->mixerResume());
}

Ref<FmodFile> FmodServer::load_file_as_sound(const String& path) {
if (cache->has_file(path)) {
GODOT_LOG_WARNING("FMOD Sound System: FILE ALREADY LOADED AS SOUND" + String(path))
Expand Down
2 changes: 2 additions & 0 deletions src/fmod_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@ namespace godot {
void unpause_all_events();
void mute_all_events();
void unmute_all_events();
void mixer_suspend();
void mixer_resume();
void wait_for_all_loads();

protected:
Expand Down
Loading