From e710f82ec67b94a08006469322b4e42aacd27ffa Mon Sep 17 00:00:00 2001 From: Tristan Grespinet Date: Tue, 27 Sep 2022 05:55:36 +0200 Subject: [PATCH 1/7] Add default callback --- demo/Script/ChangeColor.gd | 1 - demo/Script/FmodTest.gd | 1 + src/godot_fmod.cpp | 65 +++++++++++++++++++++++--------------- src/godot_fmod.h | 15 +++++++-- 4 files changed, 53 insertions(+), 29 deletions(-) diff --git a/demo/Script/ChangeColor.gd b/demo/Script/ChangeColor.gd index bdca00ea..356633ea 100644 --- a/demo/Script/ChangeColor.gd +++ b/demo/Script/ChangeColor.gd @@ -11,7 +11,6 @@ func _ready(): # warning-ignore:return_value_discarded self.connect("body_exited", self, "leave") id = Fmod.create_event_instance("event:/Music/Level 02") - Fmod.set_callback(id, Fmod.FMOD_STUDIO_EVENT_CALLBACK_ALL) Fmod.start_event(id) Fmod.set_event_paused(id, true) diff --git a/demo/Script/FmodTest.gd b/demo/Script/FmodTest.gd index 5df5b632..0d256b56 100644 --- a/demo/Script/FmodTest.gd +++ b/demo/Script/FmodTest.gd @@ -7,6 +7,7 @@ func _enter_tree(): Fmod.init(1024, Fmod.FMOD_STUDIO_INIT_LIVEUPDATE, Fmod.FMOD_INIT_NORMAL) Fmod.set_sound_3D_settings(1, 32, 1) Fmod.set_listener_number(2) + Fmod.set_default_callback(Fmod.FMOD_STUDIO_EVENT_CALLBACK_ALL) # load banks # warning-ignore:return_value_discarded diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index 977f532a..2b675475 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -143,6 +143,9 @@ void Fmod::_register_methods() { register_method("get_dsp_buffer_length", &Fmod::get_system_dsp_buffer_length); register_method("get_dsp_num_buffers", &Fmod::get_system_dsp_num_buffers); register_method("_process", &Fmod::_process); + register_method("set_callback", &Fmod::setCallback); + register_method("set_desc_callback", &Fmod::setEventDescriptionCallback); + register_method("set_default_callback", &Fmod::setDefaultCallback); register_signal("timeline_beat", "params", GODOT_VARIANT_TYPE_DICTIONARY); register_signal("timeline_marker", "params", GODOT_VARIANT_TYPE_DICTIONARY); @@ -278,7 +281,7 @@ void Fmod::_set_listener_attributes() { } for (int i = 0; i < systemListenerNumber; i++) { - Listener* listener = &listeners[i]; + Listener *listener = &listeners[i]; if (listener->listenerLock) { continue; } @@ -288,18 +291,18 @@ void Fmod::_set_listener_attributes() { continue; } - Node* node {listener->gameObj}; + Node *node{listener->gameObj}; if (!node->is_inside_tree()) { return; } - if (auto* ci {Node::cast_to(node)}) { + if (auto* ci{Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform_2d(ci->get_global_transform()); ERROR_CHECK(system->setListenerAttributes(i, &attr)); continue; } - if (auto* s {Node::cast_to(node)}) { + if (auto* s{Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform(s->get_global_transform()); ERROR_CHECK(system->setListenerAttributes(i, &attr)); continue; @@ -393,12 +396,12 @@ bool Fmod::_is_fmod_valid(Node* node) { void Fmod::_update_instance_3d_attributes(FMOD::Studio::EventInstance* instance, Node* node) { // try to set 3D attributes if (instance && _is_fmod_valid(node) && node->is_inside_tree()) { - if (auto* ci {Node::cast_to(node)}) { + if (auto* ci{Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform_2d(ci->get_global_transform()); ERROR_CHECK(instance->set3DAttributes(&attr)); return; } - if (auto* s {Node::cast_to(node)}) { + if (auto* s{Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform(s->get_global_transform()); ERROR_CHECK(instance->set3DAttributes(&attr)); return; @@ -549,7 +552,7 @@ bool Fmod::get_listener_lock(int index) { } } -Node* Fmod::get_object_attached_to_listener(int index) { +Node *Fmod::get_object_attached_to_listener(int index) { if (index < 0 || index >= systemListenerNumber) { GODOT_LOG(2, "index of listeners must be set between 0 and the number of listeners set") return nullptr; @@ -945,8 +948,7 @@ float Fmod::desc_get_sound_size(const String& eventPath) { Dictionary Fmod::desc_get_parameter_description_by_name(const String& eventPath, const String& name) { Dictionary paramDesc; FIND_AND_CHECK(eventPath, eventDescriptions, paramDesc) - FMOD_STUDIO_PARAMETER_DESCRIPTION - pDesc; + FMOD_STUDIO_PARAMETER_DESCRIPTION pDesc; if (ERROR_CHECK(instance->getParameterDescriptionByName(name.utf8().get_data(), &pDesc))) { paramDesc["name"] = String(pDesc.name); paramDesc["id_first"] = pDesc.id.data1; @@ -964,8 +966,7 @@ Dictionary Fmod::desc_get_parameter_description_by_id(const String& eventPath, c FMOD_STUDIO_PARAMETER_ID paramId; paramId.data1 = (unsigned int) idPair[0]; paramId.data2 = (unsigned int) idPair[1]; - FMOD_STUDIO_PARAMETER_DESCRIPTION - pDesc; + FMOD_STUDIO_PARAMETER_DESCRIPTION pDesc; if (ERROR_CHECK(instance->getParameterDescriptionByID(paramId, &pDesc))) { paramDesc["name"] = String(pDesc.name); paramDesc["id_first"] = pDesc.id.data1; @@ -987,8 +988,7 @@ int Fmod::desc_get_parameter_description_count(const String& eventPath) { Dictionary Fmod::desc_get_parameter_description_by_index(const String& eventPath, int index) { Dictionary paramDesc; FIND_AND_CHECK(eventPath, eventDescriptions, paramDesc) - FMOD_STUDIO_PARAMETER_DESCRIPTION - pDesc; + FMOD_STUDIO_PARAMETER_DESCRIPTION pDesc; if (ERROR_CHECK(instance->getParameterDescriptionByIndex(index, &pDesc))) { paramDesc["name"] = String(pDesc.name); paramDesc["id_first"] = pDesc.id.data1; @@ -1003,8 +1003,7 @@ Dictionary Fmod::desc_get_parameter_description_by_index(const String& eventPath Dictionary Fmod::desc_get_user_property(const String& eventPath, const String& name) { Dictionary propDesc; FIND_AND_CHECK(eventPath, eventDescriptions, propDesc) - FMOD_STUDIO_USER_PROPERTY - uProp; + FMOD_STUDIO_USER_PROPERTY uProp; if (ERROR_CHECK(instance->getUserProperty(name.utf8().get_data(), &uProp))) { FMOD_STUDIO_USER_PROPERTY_TYPE fType = uProp.type; if (fType == FMOD_STUDIO_USER_PROPERTY_TYPE_INTEGER) @@ -1029,8 +1028,7 @@ int Fmod::desc_get_user_property_count(const String& eventPath) { Dictionary Fmod::desc_user_property_by_index(const String& eventPath, int index) { Dictionary propDesc; FIND_AND_CHECK(eventPath, eventDescriptions, propDesc) - FMOD_STUDIO_USER_PROPERTY - uProp; + FMOD_STUDIO_USER_PROPERTY uProp; if (ERROR_CHECK(instance->getUserPropertyByIndex(index, &uProp))) { FMOD_STUDIO_USER_PROPERTY_TYPE fType = uProp.type; if (fType == FMOD_STUDIO_USER_PROPERTY_TYPE_INTEGER) @@ -1042,10 +1040,15 @@ Dictionary Fmod::desc_user_property_by_index(const String& eventPath, int index) else if (fType == FMOD_STUDIO_USER_PROPERTY_TYPE_STRING) propDesc[String(uProp.name)] = String(uProp.stringvalue); } - return propDesc; } +void Fmod::setEventDescriptionCallback(const String eventPath, int callbackMask) { + FIND_AND_CHECK(eventPath, eventDescriptions) + ERROR_CHECK(instance->setCallback(Callbacks::eventCallback, callbackMask)); + GODOT_LOG(0, String("Default callBack set on description event ") + eventPath) +} + bool Fmod::get_bus_mute(const String& busPath) { bool mute = false; FIND_AND_CHECK(busPath, buses, mute) @@ -1213,12 +1216,17 @@ FMOD::Studio::EventInstance* Fmod::_create_instance(const String& eventName, boo FIND_AND_CHECK(eventName, eventDescriptions, nullptr) FMOD::Studio::EventInstance* eventInstance = nullptr; ERROR_CHECK(instance->createInstance(&eventInstance)); - if (eventInstance && (!isOneShot || gameObject)) { - auto* eventInfo = new EventInfo(); - eventInfo->gameObj = gameObject; - eventInfo->isOneShot = isOneShot; - eventInstance->setUserData(eventInfo); - events.append(eventInstance); + if (eventInstance) { + if(defaultCallbackMask != 0x00000000){ + eventInstance->setCallback(Callbacks::eventCallback, defaultCallbackMask); + } + if (!isOneShot || gameObject)) { + auto* eventInfo = new EventInfo(); + eventInfo->gameObj = gameObject; + eventInfo->isOneShot = isOneShot; + eventInstance->setUserData(eventInfo); + events.append(eventInstance); + } } return eventInstance; } @@ -1299,7 +1307,7 @@ void Fmod::detach_instance_from_node(const uint64_t instanceId) { _get_event_info(instance)->gameObj = nullptr; } -Node* Fmod::get_object_attached_to_instance(uint64_t instanceId) { +Node *Fmod::get_object_attached_to_instance(uint64_t instanceId) { Node* node = nullptr; FIND_AND_CHECK(instanceId, events, node) EventInfo* eventInfo = _get_event_info(instance); @@ -1411,7 +1419,8 @@ void Fmod::load_file_as_music(const String& path) { DRIVE_PATH(path) FMOD::Sound* sound = sounds.get(path); if (!sound) { - ERROR_CHECK(coreSystem->createSound(path.alloc_c_string(), (FMOD_CREATESTREAM | FMOD_LOOP_NORMAL), nullptr, &sound)); + ERROR_CHECK(coreSystem->createSound(path.alloc_c_string(), (FMOD_CREATESTREAM | FMOD_LOOP_NORMAL), nullptr, + &sound)); if (sound) { sounds[path] << sound; Godot::print("FMOD Sound System: LOADING AS MUSIC FILE" + String(path)); @@ -1692,6 +1701,10 @@ void Fmod::set_callback(const uint64_t instanceId, int callbackMask) { GODOT_LOG(0, String("CallBack set on event ") + String::num(instanceId, 0)) } +void Fmod::setDefaultCallback(int p_callbackMask) { + defaultCallbackMask = p_callbackMask; +} + // runs on the game thread void Fmod::_run_callbacks() { std::lock_guard lk(Callbacks::callback_mut); diff --git a/src/godot_fmod.h b/src/godot_fmod.h index 873ee4f5..05301b7d 100644 --- a/src/godot_fmod.h +++ b/src/godot_fmod.h @@ -112,6 +112,8 @@ namespace godot { Listener listeners[FMOD_MAX_LISTENERS]; bool listenerWarning = true; + int defaultCallbackMask = 0x00000000; + Vector loadingBanks; Map banks; Map eventDescriptions; @@ -119,6 +121,14 @@ namespace godot { Map buses; Map VCAs; + + Vector loadingBanks; + Map banks; + Map eventDescriptions; + Map sounds; + Map buses; + Map VCAs; + Vector channels; Vector events; @@ -224,6 +234,7 @@ namespace godot { Dictionary get_event_3d_attributes(uint64_t instanceId); Dictionary get_event_2d_attributes(uint64_t instanceId); void set_event_2d_attributes(uint64_t instanceId, Transform2D position); + void setCallback(uint64_t instanceId, int callbackMask); /* event descriptions functions */ int desc_get_length(const String& eventPath); @@ -247,6 +258,7 @@ namespace godot { Dictionary desc_get_user_property(const String& eventPath, const String& name); int desc_get_user_property_count(const String& eventPath); Dictionary desc_user_property_by_index(const String& eventPath, int index); + void setEventDescriptionCallback(String eventPath, int callbackMask); /* bus functions */ bool get_bus_mute(const String& busPath); @@ -307,8 +319,7 @@ namespace godot { Dictionary get_global_parameter_desc_by_id(const Array& idPair); int get_global_parameter_desc_count(); Array get_global_parameter_desc_list(); - - void set_callback(const uint64_t instanceId, int callbackMask); + void setDefaultCallback(int p_callbackMask); }; }// namespace godot From f5b4dbe42953ef910a83c4fe79e0f8564bdff1a7 Mon Sep 17 00:00:00 2001 From: Tristan Grespinet Date: Tue, 27 Sep 2022 06:08:30 +0200 Subject: [PATCH 2/7] add new methods to singleton --- demo/addons/fmod/Fmod.gd | 6 ++++++ src/godot_fmod.cpp | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/demo/addons/fmod/Fmod.gd b/demo/addons/fmod/Fmod.gd index 70d3814f..63e57257 100644 --- a/demo/addons/fmod/Fmod.gd +++ b/demo/addons/fmod/Fmod.gd @@ -396,6 +396,12 @@ func unmute_all_events() -> void: func set_callback(instanceId: int, callbackMask: int) -> void: godot_fmod.set_callback(instanceId, callbackMask) +func set_default_callback(callbackMask: int) -> void: + godot_fmod.set_default_callback(callbackMask) + +func set_desc_callback(path: String, callbackMask: int) -> void: + godot_fmod.set_desc_callback(path, callbackMask) + ########### ###SOUND### ########### diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index 2b675475..910642b3 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -1220,7 +1220,7 @@ FMOD::Studio::EventInstance* Fmod::_create_instance(const String& eventName, boo if(defaultCallbackMask != 0x00000000){ eventInstance->setCallback(Callbacks::eventCallback, defaultCallbackMask); } - if (!isOneShot || gameObject)) { + if (!isOneShot || gameObject) { auto* eventInfo = new EventInfo(); eventInfo->gameObj = gameObject; eventInfo->isOneShot = isOneShot; From 59cf13b3273cfa1c8e73d020af94f72e22e743c5 Mon Sep 17 00:00:00 2001 From: Tristan Grespinet Date: Tue, 27 Sep 2022 06:22:31 +0200 Subject: [PATCH 3/7] fix --- src/godot_fmod.cpp | 1 - src/godot_fmod.h | 8 -------- 2 files changed, 9 deletions(-) diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index 910642b3..d627bde5 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -123,7 +123,6 @@ void Fmod::_register_methods() { register_method("get_sound_volume", &Fmod::get_sound_volume); register_method("set_sound_pitch", &Fmod::set_sound_pitch); register_method("get_sound_pitch", &Fmod::get_sound_pitch); - register_method("set_callback", &Fmod::set_callback); register_method("set_sound_3D_settings", &Fmod::set_sound_3d_settings); register_method("wait_for_all_loads", &Fmod::wait_for_all_loads); register_method("get_available_drivers", &Fmod::get_available_drivers); diff --git a/src/godot_fmod.h b/src/godot_fmod.h index 05301b7d..66856e70 100644 --- a/src/godot_fmod.h +++ b/src/godot_fmod.h @@ -121,14 +121,6 @@ namespace godot { Map buses; Map VCAs; - - Vector loadingBanks; - Map banks; - Map eventDescriptions; - Map sounds; - Map buses; - Map VCAs; - Vector channels; Vector events; From f4cdd84a2d07778dbceab526d1d95ccab00945ba Mon Sep 17 00:00:00 2001 From: Tristan Grespinet Date: Tue, 27 Sep 2022 16:37:44 +0200 Subject: [PATCH 4/7] change to snakecase --- src/godot_fmod.cpp | 10 +++++----- src/godot_fmod.h | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index d627bde5..afe4bb22 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -142,9 +142,9 @@ void Fmod::_register_methods() { register_method("get_dsp_buffer_length", &Fmod::get_system_dsp_buffer_length); register_method("get_dsp_num_buffers", &Fmod::get_system_dsp_num_buffers); register_method("_process", &Fmod::_process); - register_method("set_callback", &Fmod::setCallback); - register_method("set_desc_callback", &Fmod::setEventDescriptionCallback); - register_method("set_default_callback", &Fmod::setDefaultCallback); + register_method("set_callback", &Fmod::set_callback); + register_method("set_desc_callback", &Fmod::set_desc_callback); + register_method("set_default_callback", &Fmod::set_default_callback); register_signal("timeline_beat", "params", GODOT_VARIANT_TYPE_DICTIONARY); register_signal("timeline_marker", "params", GODOT_VARIANT_TYPE_DICTIONARY); @@ -1042,7 +1042,7 @@ Dictionary Fmod::desc_user_property_by_index(const String& eventPath, int index) return propDesc; } -void Fmod::setEventDescriptionCallback(const String eventPath, int callbackMask) { +void Fmod::set_desc_callback(String eventPath, int callbackMask) { FIND_AND_CHECK(eventPath, eventDescriptions) ERROR_CHECK(instance->setCallback(Callbacks::eventCallback, callbackMask)); GODOT_LOG(0, String("Default callBack set on description event ") + eventPath) @@ -1700,7 +1700,7 @@ void Fmod::set_callback(const uint64_t instanceId, int callbackMask) { GODOT_LOG(0, String("CallBack set on event ") + String::num(instanceId, 0)) } -void Fmod::setDefaultCallback(int p_callbackMask) { +void Fmod::set_default_callback(int p_callbackMask) { defaultCallbackMask = p_callbackMask; } diff --git a/src/godot_fmod.h b/src/godot_fmod.h index 66856e70..7d49ac0a 100644 --- a/src/godot_fmod.h +++ b/src/godot_fmod.h @@ -226,7 +226,7 @@ namespace godot { Dictionary get_event_3d_attributes(uint64_t instanceId); Dictionary get_event_2d_attributes(uint64_t instanceId); void set_event_2d_attributes(uint64_t instanceId, Transform2D position); - void setCallback(uint64_t instanceId, int callbackMask); + void set_callback(uint64_t instanceId, int callbackMask); /* event descriptions functions */ int desc_get_length(const String& eventPath); @@ -250,7 +250,7 @@ namespace godot { Dictionary desc_get_user_property(const String& eventPath, const String& name); int desc_get_user_property_count(const String& eventPath); Dictionary desc_user_property_by_index(const String& eventPath, int index); - void setEventDescriptionCallback(String eventPath, int callbackMask); + void set_desc_callback(String eventPath, int callbackMask); /* bus functions */ bool get_bus_mute(const String& busPath); @@ -311,7 +311,7 @@ namespace godot { Dictionary get_global_parameter_desc_by_id(const Array& idPair); int get_global_parameter_desc_count(); Array get_global_parameter_desc_list(); - void setDefaultCallback(int p_callbackMask); + void set_default_callback(int p_callbackMask); }; }// namespace godot From f2f1b0b27e2db2273c652d5f2e59db75a9efeeb5 Mon Sep 17 00:00:00 2001 From: Tristan Grespinet Date: Thu, 29 Sep 2022 04:18:26 +0200 Subject: [PATCH 5/7] add const reference to string --- src/godot_fmod.cpp | 2 +- src/godot_fmod.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index afe4bb22..7d4562a4 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -280,7 +280,7 @@ void Fmod::_set_listener_attributes() { } for (int i = 0; i < systemListenerNumber; i++) { - Listener *listener = &listeners[i]; + Listener* listener = &listeners[i]; if (listener->listenerLock) { continue; } diff --git a/src/godot_fmod.h b/src/godot_fmod.h index 7d49ac0a..2e30b8c4 100644 --- a/src/godot_fmod.h +++ b/src/godot_fmod.h @@ -250,7 +250,7 @@ namespace godot { Dictionary desc_get_user_property(const String& eventPath, const String& name); int desc_get_user_property_count(const String& eventPath); Dictionary desc_user_property_by_index(const String& eventPath, int index); - void set_desc_callback(String eventPath, int callbackMask); + void set_desc_callback(const String& eventPath, int callbackMask); /* bus functions */ bool get_bus_mute(const String& busPath); From cc3fd50f02e827bff3f7a1c219dd73ef369608c4 Mon Sep 17 00:00:00 2001 From: Tristan Grespinet Date: Thu, 29 Sep 2022 06:02:02 +0200 Subject: [PATCH 6/7] const string --- src/godot_fmod.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index 7d4562a4..7ccef1db 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -1042,7 +1042,7 @@ Dictionary Fmod::desc_user_property_by_index(const String& eventPath, int index) return propDesc; } -void Fmod::set_desc_callback(String eventPath, int callbackMask) { +void Fmod::set_desc_callback(const String& eventPath, int callbackMask) { FIND_AND_CHECK(eventPath, eventDescriptions) ERROR_CHECK(instance->setCallback(Callbacks::eventCallback, callbackMask)); GODOT_LOG(0, String("Default callBack set on description event ") + eventPath) From 505e0b8c99e5239241a1ccf93199e089e6454ec5 Mon Sep 17 00:00:00 2001 From: Ced Naru Date: Fri, 14 Oct 2022 18:40:07 +0200 Subject: [PATCH 7/7] Format with new clang format --- src/godot_fmod.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/godot_fmod.cpp b/src/godot_fmod.cpp index 7ccef1db..96d8e856 100644 --- a/src/godot_fmod.cpp +++ b/src/godot_fmod.cpp @@ -290,18 +290,18 @@ void Fmod::_set_listener_attributes() { continue; } - Node *node{listener->gameObj}; + Node* node {listener->gameObj}; if (!node->is_inside_tree()) { return; } - if (auto* ci{Node::cast_to(node)}) { + if (auto* ci {Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform_2d(ci->get_global_transform()); ERROR_CHECK(system->setListenerAttributes(i, &attr)); continue; } - if (auto* s{Node::cast_to(node)}) { + if (auto* s {Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform(s->get_global_transform()); ERROR_CHECK(system->setListenerAttributes(i, &attr)); continue; @@ -395,12 +395,12 @@ bool Fmod::_is_fmod_valid(Node* node) { void Fmod::_update_instance_3d_attributes(FMOD::Studio::EventInstance* instance, Node* node) { // try to set 3D attributes if (instance && _is_fmod_valid(node) && node->is_inside_tree()) { - if (auto* ci{Node::cast_to(node)}) { + if (auto* ci {Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform_2d(ci->get_global_transform()); ERROR_CHECK(instance->set3DAttributes(&attr)); return; } - if (auto* s{Node::cast_to(node)}) { + if (auto* s {Node::cast_to(node)}) { auto attr = _get_3d_attributes_from_transform(s->get_global_transform()); ERROR_CHECK(instance->set3DAttributes(&attr)); return; @@ -551,7 +551,7 @@ bool Fmod::get_listener_lock(int index) { } } -Node *Fmod::get_object_attached_to_listener(int index) { +Node* Fmod::get_object_attached_to_listener(int index) { if (index < 0 || index >= systemListenerNumber) { GODOT_LOG(2, "index of listeners must be set between 0 and the number of listeners set") return nullptr; @@ -1216,7 +1216,7 @@ FMOD::Studio::EventInstance* Fmod::_create_instance(const String& eventName, boo FMOD::Studio::EventInstance* eventInstance = nullptr; ERROR_CHECK(instance->createInstance(&eventInstance)); if (eventInstance) { - if(defaultCallbackMask != 0x00000000){ + if (defaultCallbackMask != 0x00000000) { eventInstance->setCallback(Callbacks::eventCallback, defaultCallbackMask); } if (!isOneShot || gameObject) { @@ -1306,7 +1306,7 @@ void Fmod::detach_instance_from_node(const uint64_t instanceId) { _get_event_info(instance)->gameObj = nullptr; } -Node *Fmod::get_object_attached_to_instance(uint64_t instanceId) { +Node* Fmod::get_object_attached_to_instance(uint64_t instanceId) { Node* node = nullptr; FIND_AND_CHECK(instanceId, events, node) EventInfo* eventInfo = _get_event_info(instance); @@ -1418,8 +1418,7 @@ void Fmod::load_file_as_music(const String& path) { DRIVE_PATH(path) FMOD::Sound* sound = sounds.get(path); if (!sound) { - ERROR_CHECK(coreSystem->createSound(path.alloc_c_string(), (FMOD_CREATESTREAM | FMOD_LOOP_NORMAL), nullptr, - &sound)); + ERROR_CHECK(coreSystem->createSound(path.alloc_c_string(), (FMOD_CREATESTREAM | FMOD_LOOP_NORMAL), nullptr, &sound)); if (sound) { sounds[path] << sound; Godot::print("FMOD Sound System: LOADING AS MUSIC FILE" + String(path));