utopia-rise / fmod-gdextension

FMOD Studio GDExtension bindings for the Godot game engine
MIT License
385 stars 42 forks source link

Plugin Window Created To Take Initialisation Outside of Code #140

Closed ManInBlue917 closed 1 year ago

ManInBlue917 commented 1 year ago

image

To simplify the setup of the plugin, I added a _ready() function to the singleton that calls on the functions needed to initialise FMOD. set_software_format(), set_dsp_buffer_size(), init(), set_sound_3D_settings(), and set_listener_number() are all run by the the singleton using data loaded from a .cfg file. This file is edited in the new plugin window to make setup and understanding of each option simpler.

The singleton will also autoload specified banks with options to automatically add all banks, or to clear them for custom loading.

As a small extra to this, I also created a simple debug panel that can be toggled on or off in the plugin window to show memory and CPU usage by FMOD.

image

The readme has been updated to reflect the change this would have on the set-up of FMOD.

CedNaru commented 1 year ago

What I would suggest to add:

CedNaru commented 1 year ago

Nevermind what I said about the debug window, I thought you created it as part of the demo but it's a standalone thing.

CedNaru commented 1 year ago

Adding that, the reasoning for having the configuration file outside the addon directory is to avoid overwriting it when the plugin is updated. It should be part of the project itself, not some external dependency. Like I suggested on Discord, I see 2 ways of doing it:

ManInBlue917 commented 1 year ago

I've followed the simpler approach of having the config file be what FMOD reads from and moved that into it's own directory. I do think I'm going to look at the FMODEnvironment node idea also as I feel like it can be built on top of the current implementation, with the config file still being used, but as a resource for the new node to allow for an FMOD Environment to be saved and reused.

For now though, I think keeping it simple is for the best.

ManInBlue917 commented 1 year ago

Incorrect bank location checks and ensuring that the master bank is the first to load has been resolved at the start of the load_bank_names() function. image

Selecting bank location from a FolderDialog node has also been added. image

Autogeneration of the file is handled by fmod_singleton.gd and fmod_config_window.gd. The FMOD singleton script creates a directory called fmod if the directory doesn't exists, and then the config window script writes a default file to the new directory.

image image

CedNaru commented 1 year ago
image

When you click "clear banks", you still get Master saved in the config when it's supposed to mean you don't want to load any bank at start.