Skip to content

Commit

Permalink
Remove unused return type for load_bank() (#142)
Browse files Browse the repository at this point in the history
* Remove unused return type for load_bank()
* Don't shut down Fmod if already initialize when Fmod.ready() is called.
  • Loading branch information
CedNaru authored Dec 1, 2022
1 parent e4160ac commit 4743749
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
5 changes: 5 additions & 0 deletions demo/Script/FmodTest.gd
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
extends Node

func _enter_tree():
Fmod.load_configuration("res://fmod/fmod_config.cfg")




7 changes: 4 additions & 3 deletions demo/addons/fmod/Fmod.gd
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ func _notification(what):

func _ready():
###SETUP FMOD###
load_configuration("res://fmod/fmod_config.cfg", true)
if not started:
load_configuration("res://fmod/fmod_config.cfg", true)

func _process(delta):
if started:
Expand Down Expand Up @@ -297,8 +298,8 @@ func get_object_attached_to_listener(index: int) -> Node:
##########
###BANK###
##########
func load_bank(pathTo_bank: String, load_bankFlag: int) -> String:
return godot_fmod.load_bank(pathTo_bank, load_bankFlag)
func load_bank(pathTo_bank: String, load_bankFlag: int) -> void:
godot_fmod.load_bank(pathTo_bank, load_bankFlag)

func unload_bank(pathTo_bank: String) -> void:
godot_fmod.unload_bank(pathTo_bank)
Expand Down
2 changes: 1 addition & 1 deletion demo/fmod/fmod_config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NumChannels=16
NumListeners=2
DSPBufferSize=1048
ShowDebug=true
LoadFMODOnStart=true
LoadFMODOnStart=false

[Banks]

Expand Down
2 changes: 1 addition & 1 deletion demo/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://addons/fmod/nodes/FmodEventEmitter.gd"
}, {
"base": "Node",
"base": "",
"class": "FmodNative",
"language": "NativeScript",
"path": "res://addons/fmod/Fmod.gdns"
Expand Down
5 changes: 2 additions & 3 deletions src/godot_fmod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ void Fmod::set_software_format(int sampleRate, const int speakerMode, int numRaw
ERROR_CHECK(coreSystem->setSoftwareFormat(sampleRate, static_cast<FMOD_SPEAKERMODE>(speakerMode), numRawSpeakers));
}

String Fmod::load_bank(const String& pathToBank, unsigned int flag) {
void Fmod::load_bank(const String& pathToBank, unsigned int flag) {
DRIVE_PATH(pathToBank)
if (banks.has(pathToBank)) return pathToBank;// bank is already loaded
if (banks.has(pathToBank)) return;// bank is already loaded
FMOD::Studio::Bank* bank = nullptr;
ERROR_CHECK(system->loadBankFile(pathToBank.alloc_c_string(), flag, &bank));
if (bank) {
Expand All @@ -588,7 +588,6 @@ String Fmod::load_bank(const String& pathToBank, unsigned int flag) {
loadingBanks.append(loadingBank);
}
}
return pathToBank;
}

void Fmod::unload_bank(const String& pathToBank) {
Expand Down
2 changes: 1 addition & 1 deletion src/godot_fmod.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ namespace godot {
int get_system_dsp_num_buffers();
Array get_system_dsp_buffer_size();

String load_bank(const String& pathToBank, unsigned int flag);
void load_bank(const String& pathToBank, unsigned int flag);
void unload_bank(const String& pathToBank);
bool check_vca_path(const String& vcaPath);
bool check_bus_path(const String& busPath);
Expand Down

0 comments on commit 4743749

Please sign in to comment.