Giter Site home page Giter Site logo

utopia-rise / fmod-gdextension Goto Github PK

View Code? Open in Web Editor NEW
329.0 18.0 37.0 56.21 MB

FMOD Studio integration and bindings for the Godot game engine

License: MIT License

Python 4.06% C++ 87.89% CMake 2.92% Shell 0.48% Makefile 0.66% C 3.63% Kotlin 0.36%
godot godot-engine sound music fmod fmod-api fmod-studio gdnative sound-engine godo

fmod-gdextension's People

Contributors

2shady4u avatar alessandrofama avatar bitbrain avatar cednaru avatar heraldofgargos avatar langfort avatar lentsius-bark avatar marekdomagala avatar piiertho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fmod-gdextension's Issues

Github Discussions

@piiertho Would it be possible to enable the Discussions feature for this repository? I'd have a couple of things I need clarification on and I do not want to spam issues or pull requests with it.

Support universal macOS build

Currently the libGodotFmod.osx.release.64.dylib library for macOS is only built for the x86_64 architecture and not the arm64 (apple silicon) architecture. Having a universal build will support both of these architectures.

Both FMOD and godot-cpp (3.4-stable) are built as universal and support both architectures.

The current CI process has godot-cpp tagged at 3.3.4-stable, which unfortunately does not include the universal build changes. So the CI process will need to be moved forward to 3.4-stable to support this work. I attempted to bring in the macOS universal support with #97, which should still be valid when the repo is aligned with godot-cpp version 3.4. Those changes worked for me locally because I had godot-cpp checked out to master and didn't realize the CI process was tagged at version 3.3.4.

The latest release in utopia-rise/godot-cpp is 3.3.4-stable so the 3.4-stable version is not yet available.

@piiertho or @CedNaru do you know when a 3.4-stable version of the utopia-rise/godot-cpp fork will be available? I'm happy to help with this, but not sure where to start with that piece.

Thanks for the great work on this project!

SUGGESTION: make Fmod autoload singleton a Node (Fmod.tscn)

Due to the nature of my game, I would like the Fmod autoload singleton to not be paused when I pause the game.
For example I have different sliders: master volume, music volume, sfx volume, .... that are linked to specific FMOD busses.

Currently the following happens:

  • Play some FMOD event
  • Pause the game, the event keeps playing (= ok)
  • Change the volume -> nothing happens
  • Unpause the game, the volume function finally gets called (because Fmod.gd was paused) and volume decreases

This behaviour is a bit counter-intuitive...
This happens because the Fmod autoload singleton derives from a script and not from a PackedScene.

My suggestion:
Change the Fmod.gd autoload singleton to a PackedScene instead.
This PackedScene then gets the Fmod.gd-scripts but has the added bonus of having the pause_mode-variable available and the user can either set to this to inherited or process (whatever he wants)

Error when following setup and importing demo project

I have followed the instructions in the README and installed the FMOD Windows API from here:

Capture2
I then proceeded, searching for the *.dll files and copied them over into the addons/fmod/libs/windows folder as suggested:
Capture3
However, when importing the demo project I get this nasty error:
Capture

Does anybody know what mistake I did?

I used fmod-gdnative v3.0.2 from the Releases tab and Godot v3.3.4.stable

Using a Node as a listener crashes the game without errors

According to the function definition add_listener() expects an Integer and a Node.
However, when calling the add_listener()-function and using a Node as the second argument, the game just quits/crashes?
Everything works fine if the listener is a Node2D, Spatial or Control.

Example with Node (CRASHES):
node

Example with Spatial:
spatial

In both cases the Godot console doesn't show any errors:
Capture

Also in a similar vein, when looking at the C++ source code, I can see that the addListener()-function (to which the add_listener()-function in Godot is bound) expects an Object instead of a Node? This kind of implicit casting (from Node to Object) feels dangerous? (I could be mistaken?) Also what could be the use of, for example, making a Resource (which inherits from Object) a listener? I do think all these Objects in the source code should actually just be Nodes instead?

android build error "Activity cannot be converted to Godot"

hello
when i try to build my project for android i receive an error

Task :compileDebugJavaWithJavac FAILED
project/android/fmod/src/FmodSingleton.java:32: error: incompatible types: Activity cannot be converted to Godot

i had to add implementation instead of compile() and make my build.gradle immutable or else it would change the file back and tell me that there was no compile() methods.

Suggestion: Consider changing /MD to /MT for Windows MSVC compilation

I've had a user complain to me that the library wasn't working on actively crashing the game.
After a lot of back and forth, we figured out that it was because the proper MSVC libraries weren't installed.
Godot isn't able to check this, nor is it able to install the proper VC++ redistributables.

The VCRUNTIME140-dependency as seen in DependenciesGUI:
image

What is the proper solution for this issue?

How are you guys handling this issue?

Builds are failing (The system cannot find the file specified)

System ERROR:
The system cannot find the file specified.
Move-Item: D:\a\_temp\8234de5a-32ac-4b41-9d09-10b338[45](https://github.com/utopia-rise/fmod-gdnative/runs/7386126362?check_suite_focus=true#step:5:46)9fd1.ps1:7
Line |
   7 | mv api/ windows
     |  ~~~~~~~~~~~~~~~
     | Cannot find path 'D:\a\fmod-gdnative\libs\fmod\api\' because it does not exist.
Error: Process completed with exit code 1.

Example: https://github.com/utopia-rise/fmod-gdnative/runs/7386126362?check_suite_focus=true

Android build is failing

Run cp -r godot-cpp ../godot-cpp
scons: Reading SConscript files ...
src/gen: File exists
src/gen: File exists
scons: done reading SConscript files.
scons: Building targets ...
/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o src/core/Transform.o -c --target=armv7a-linux-androideabi18 -march=armv7-a -fPIC -mfpu=neon -O3 -I. -Igodot-headers -Iinclude -Iinclude/gen -Iinclude/core src/core/Transform.cpp
sh: 1: /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o src/core/NodePath.o -c --target=armv7a-linux-androideabi18 -march=armv7-a -fPIC -mfpu=neon -O3 -I. -Igodot-headers -Iinclude -Iinclude/gen -Iinclude/core src/core/NodePath.cpp
sh: 1: /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o src/core/Quat.o -c --target=armv7a-linux-androideabi18 -march=armv7-a -fPIC -mfpu=neon -O3 -I. -Igodot-headers -Iinclude -Iinclude/gen -Iinclude/core src/core/Quat.cpp
sh: 1: /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
scons: *** [src/core/Transform.o] Error 127
scons: *** [src/core/NodePath.o] Error 127
scons: *** [src/core/Quat.o] Error 127
/usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ -o src/core/GodotGlobal.o -c --target=armv7a-linux-androideabi18 -march=armv7-a -fPIC -mfpu=neon -O3 -I. -Igodot-headers -Iinclude -Iinclude/gen -Iinclude/core src/core/GodotGlobal.cpp
sh: 1: /usr/local/lib/android/sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++: not found
scons: *** [src/core/GodotGlobal.o] Error 127
scons: building terminated because of errors.
Error: Process completed with exit code 2.

This happens on the master branch for some reason.

Cannot load sounds or banks on windows x64

Application using GDNative crash when calling loadSound or loadBank methods.
The only information printed in console is : drivers/unix/net_socket_posix.cpp:190 - Socket error: 10054.
In godot-issue-27444 it is said that this error appears when debugger drop unexpectedly the app.
So for now we have no info about what is causing the bug.
We need to investigate what is crashing the app in the called methods.

Demo project throws errors in Godot v3.3 RC8

If opening the demo-project in Godot v3.3 RC8, you get swamped with errors:

ERROR: Request for nonexistent InputMap action 'kill_event'.
   At: main/input_default.cpp:110
ERROR: Request for nonexistent InputMap action 'rotate_right'.
   At: main/input_default.cpp:102
ERROR: Request for nonexistent InputMap action 'rotate_left'.

Opening in Godot v3.2.3:
version3 2 3

Opening in Godot v3.3 RC8:
version3 3

Seems that these actions either have to be properly defined OR the relevant input code that calls these actions has to be removed.
Are these missing actions, leftovers that have to be removed? or are they just missing?

Memory leakage when not initializing Fmod

I'm getting some memory leakage in my project, but only when I don't call Fmod.init()

image

This happens because the Fmod GDNative instance is created on _ready(), but not freed automatically when Fmod.gd exists the tree.

A possible solution:
Free the fmod_godot variable (containing the GDNative instance) in an _exit_tree()-function as such:
image

This seems to get rid of the memory leakage.

NOTE: I haven't thoroughly tested this! There might be issues when you are actually using Fmod! (This could be solved by adding an if-loop that checks if the fmod_godot variable is null or not)

How to replicate:
Just add the FMOD addons folder and set verbose_output to true in the ProjectSettings. Running the game and then quitting it (by pressing the X button) will nag about memory leakage.

SegFault when a lot of Nodes are freed.

This one is a tricky issue.

When nodes have been freed from memory, our plugin just automatically detects when it happens and detaches the listeners/events. by the mean of is_instance_valid.
Usually it's enough, but when a big chunk of memory has been freed, we literally no longer can access the address to the node and get a segfault.

The simple solution for it, should to connect to the signal tree_exited so we can detach node at this moment instead of checking the pointer.

FmodNative signals not firing?

Hello! For some reason, I can't receive any signals from the FmodNative class ("sound_played," "sound_stopped," etc).

External scripts haven't received the signal from the Fmod singleton. I tried editing the singleton's script to make sure the _on_sound_stopped() function was being called in the first place, but it never seemed to fire.

I re-downloaded the latest release (v3.1.1), created a new Godot 3.5 project, and made a simple script to play a one-shot sound. The script also connects to the sound_played and sound_stopped signals, and should print the name of the signal once called. It never receives the signals.

It's possible this is a Godot 3.5-specific issue - I haven't had the chance to try a new 3.4 project.
Is this a bug, or am I doing something wrong?

Fix compilation flags for Linux

Linux compiled library is HUGE (40MB 😱 ) in comparison to other platforms.
Seems like this is due to the fact that some flags are missing/wrong

Here's the relevant part of a modified SConstruct that creates library with smaller sizes:
image
(As found here)

Differences are:

  • We dont have the LINKFLAG -s
  • We have an additional CCFLAG in release mode -g

Implementing these changes should give a linux library that is a bit lesser in size...

Fmod compatibility matrix is wrong for driver 3.1.1

Using Fmod API 2.01.16 with driver 3.1.1 produces these errors on launching the project (and every time it's minimized and then maximized)

33
2

Translation: "Could not find procedure entry point..."

This is even before adding sound banks and initializing Fmod through a script. (Steps to reproduce: create Godot v3.4.4 project, add driver 3.1.1, add API libraries from 2.01.06, launch the project)

Through trial and error, I found that API 2.02.03 and 2.02.07 both work, so it looks like the Fmod compatibility matrix should read 2.02.xx for driver 3.x.x

Make builds pass from fork pull requests

Currently, builds are failing from pull requests made by forks due to a limitation where secrets are not accessible for some reason. Investigate a way to make forks pass. For example, merge the fork branch into a temporary branch from master and run the tests on this repository.

Missing sound bank when exporting game

I noticed that when exporting the demo project, it is unable to export the sound banks for some reason:

Godot Engine v3.3.4.stable.official.faf3f883d - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce GTX 1080/PCIe/SSE2
OpenGL ES Batching: ON
 
Fmod Gdnative interface managed by a GDScript wrapper
FMOD Sound System: Successfully initialized
FMOD Sound System: Live update enabled!
FMOD Sound System: Successfully set global 3D settings
ERROR: class godot::String __cdecl godot::Fmod::loadBank(class godot::String,unsigned int): File not found.
   At: src\godot_fmod.cpp:554
ERROR: class godot::String __cdecl godot::Fmod::loadBank(class godot::String,unsigned int): File not found.
   At: src\godot_fmod.cpp:554
ERROR: class godot::String __cdecl godot::Fmod::loadBank(class godot::String,unsigned int): File not found.
   At: src\godot_fmod.cpp:554
ERROR: class godot::String __cdecl godot::Fmod::loadBank(class godot::String,unsigned int): File not found.
   At: src\godot_fmod.cpp:554
Fmod initialised.
ERROR: class FMOD::Studio::EventInstance *__cdecl godot::Fmod::createInstance(class godot::String,bool,class godot::Object *): FMOD Sound System: cannot find event:/Vehicles/Car Engine in ##cont collection.
   At: src\godot_fmod.cpp:1195
ERROR: void __cdecl godot::Fmod::attachInstanceToNode(unsigned __int64,class godot::Object *): FMOD Sound System: cannot find  in ##cont collection.
   At: src\godot_fmod.cpp:1275
ERROR: void __cdecl godot::Fmod::setEventParameterByName(unsigned __int64,class godot::String,float): FMOD Sound System: cannot find  in ##cont collection.
   At: src\godot_fmod.cpp:636
ERROR: void __cdecl godot::Fmod::setEventVolume(unsigned __int64,float): FMOD Sound System: cannot find  in ##cont collection.
   At: src\godot_fmod.cpp:727
ERROR: void __cdecl godot::Fmod::startEvent(unsigned __int64): FMOD Sound System: cannot find  in ##cont collection.
   At: src\godot_fmod.cpp:674
Event Started.
Listener set.
ERROR: void __cdecl godot::Fmod::loadFileAsSound(class godot::String): File not found.
   At: src\godot_fmod.cpp:1352
ERROR: void __cdecl godot::Fmod::loadFileAsSound(class godot::String): File not found.
   At: src\godot_fmod.cpp:1352
ERROR: class FMOD::Studio::EventInstance *__cdecl godot::Fmod::createInstance(class godot::String,bool,class godot::Object *): FMOD Sound System: cannot find event:/Music/Level 02 in ##cont collection.
   At: src\godot_fmod.cpp:1195
ERROR: void __cdecl godot::Fmod::setCallback(unsigned __int64,int): FMOD Sound System: cannot find  in ##cont collection.    
   At: src\godot_fmod.cpp:1639
ERROR: void __cdecl godot::Fmod::startEvent(unsigned __int64): FMOD Sound System: cannot find  in ##cont collection.
   At: src\godot_fmod.cpp:674
ERROR: void __cdecl godot::Fmod::setEventPaused(unsigned __int64,bool): FMOD Sound System: cannot find  in ##cont collection.
   At: src\godot_fmod.cpp:703
ERROR: void __cdecl godot::Fmod::loadFileAsMusic(class godot::String): File not found.
   At: src\godot_fmod.cpp:1
364

I have not modified the demo project in any way. This is the default configuration:

Capture

Those are the files:
Capture

No nativescript_init in libGodotFmod.windows.dll

Hello,

I'm a total noob in GDNative so please tell me if I'm wrong opening this issue, first time for me. I tried to use the fmod-gdnative library you did, but I get this error when trying to run your demo project, here's what I did:

  • Added the addons folders and all the subfolders to an existing project
  • added libGodotFmod.windows.dll from the release tab, v2.0.2 in addons\fmod\lib\windows folder
    (I got also those for osx and linux)
  • removed some lines in the gdnlib file because I don't have this many platform to manage:
[general]

singleton=false
load_once=true
symbol_prefix="fmod_"
reloadable=true

[entry]

OSX.64="res://addons/fmod/libs/osx/libGodotFmod.osx.dylib"
Windows.64="res://addons/fmod/libs/windows/libGodotFmod.windows.dll"
X11.64="res://addons/fmod/libs/linux/libGodotFmod.linux.so"

[dependencies]

OSX.64=[  ]
Windows.64=[ "res://addons/fmod/libs/windows/libfmod.dll", "res://addons/fmod/libs/windows/libfmodstudio.dll" ]
X11.64=[  ]
  • added the fmod API library file (took me a while to figure which one were needed, I took the dlls for x64 platform for my test, both core and studio, which are fmod.dll and fmodstudio.dll)
    -copied the folders "scenes", "scripts" and "assets" from the demo project
    Then I opened one of the two scenes and tried to run it. I tried both and I get the following error message every time:
ERROR: Can't open dynamic library: D:/GameDev/repo/test_3D/addons/fmod/libs/windows/libGodotFmod.windows.dll. Error: Error 126: Le module spécifié est introuvable.
   At: platform/windows/os_windows.cpp:2082
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
   At: modules/gdnative/gdnative.cpp:488
ERROR: init_library: No nativescript_init in "res://addons/fmod/libs/windows/libGodotFmod.windows.dll" found
   At: modules/gdnative/nativescript/nativescript.cpp:1505

I checked through the source code and found this in gdlibrary.cpp:

extern "C" void GDN_EXPORT fmod_nativescript_init(void *handle){
    Godot::nativescript_init(handle);
    register_class<Fmod>();
}

and the symbol_prefix is set to "fmod_" in the gdnlib file so I don't see what's wrong, do you have a clue?

Timeline and beats callbacks

Hello! There is a little issue I wanna ask about. I'm subscribing on a Beat markers event, but because signals are fired only when _process in the game is called I'm getting a lag between an actual music beat and event. And that really troubles me. So the question - Is there some specific reason why signals are handled this way but not called right in the moment Fmod sends events?
Thanks!

Multiple issues with GUT test

Some of these errors might be GUT related and not fmod related.
Also some of them might be deliberate issues...
Since I currently don't know the distinction, I'm just adding them all for now.

get_bank_loading_state() returns an error if bank is not loaded

Relevant part is in test_bank.gd:
image

get_bank_loading_state() should return -1, but it crashes instead 🤷‍♂️

image

Multiple failures to set ratio of range

Most likely an issue with GUT, but after every test, following errors appears:
image

Memory leakage on exit

image

Again no idea if this is GUT or fmod related since there were several issues with leakage previously in fmod (that have since been patched? or maybe not?)

getting fmod's .fspro file for demo project ?

Hello,
I'm trying the fmod integration in Godot.
Demo project works great on my system (Linux 64)
Many thanks for your work !!
Would it be possible to get the fmod project (.fspro) you used to generate the bank used in Godot.
I would like to learn and experiment the "live update" feature

Playback delay

There seems to be a slight delay when playing sounds for me. I did some googling and a possible problem might be the buffer size configured (see Unity forum)

  • what is the current default buffer size configured when using this plugin?

Within fmod.h I found this signature:

FMOD_RESULT F_API FMOD_System_SetDSPBufferSize  (FMOD_SYSTEM *system, unsigned int bufferlength, int numbuffers);
FMOD_RESULT F_API FMOD_System_GetDSPBufferSize  (FMOD_SYSTEM *system, unsigned int *bufferlength, int *numbuffers);

I might raise a PR to support those two methods, so we can call them from within Godot.

Exported project cannot find banks, oggs and events?

OS: Windows 10
Godot: v3.2.3
Fmod: 2.00.14

I'm playing around with the demo project and tried to export it to an EXE.
In the editor everything works fine without any issue, but when I run my exported build I get these errors:

error

I checked my .PCK with the godot-unpacker and found that indeed the necessary files are available, as shown here:
image

I'm using the demo-project included inside of this repo and I'm using the latest release DLL for windows x64. Also I'm using the 2.00 version of both fmod.DLL and fmodstudio.DLL.

How do I make an exported build work properly?

User property get functions are missing arguments

In the Fmod autoload the functions desc_get_user_property (get property by name) & desc_user_property_by_index are missing 2nd arguments for the actual name and index.

in FmodNative:
Dictionary desc_get_user_property(const String& eventPath, const String& name);

so instead of
func desc_get_user_property(event_path: String) -> Dictionary:
return godot_fmod.desc_get_user_property(event_path)
we'd have
func desc_get_user_property(event_path: String, property_name: String) -> Dictionary:
return godot_fmod.desc_get_user_property(event_path, property_name)

& the same for desc_user_property_by_index with a new int argument.

Can't get the addon working on Windows, Error: "Can't open dynamic library"

OS: Windows 10
Godot: 3.2.3-stable
Driver: v3.0.2
Fmod API: 2.00.15
Minimal project: fmod-test.zip

Output:

modules/gdnative/gdnative.cpp:501 - No valid library handle, can't get symbol from GDNative object
modules/gdnative/gdnative.cpp:406 - No valid library handle, can't terminate GDNative object
Can't open dynamic library: D:/Godot/fmod-test/addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll, error: Error 193: %1 is not a valid Win32 application.

Debugger:

E 0:00:00.306 open_dynamic_library: Can't open dynamic library: D:/Godot/fmod-test/addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll, error: Error 193: %1 is not a valid Win32 application.
.
<C++ Error> Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
<C++ Source> platform/windows/os_windows.cpp:2395 @ open_dynamic_library()

E 0:00:00.309 get_symbol: No valid library handle, can't get symbol from GDNative object
<C++ Source> modules/gdnative/gdnative.cpp:501 @ get_symbol()

E 0:00:00.313 init_library: No nativescript_init in "res://addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll" found
<C++ Source> modules/gdnative/nativescript/nativescript.cpp:1506 @ init_library()

Investigate steps required to become the official FMOD plugin for Godot

Unity is already featured on the FMOD page: https://www.fmod.com/resources/documentation-unity?version=2.02&page=welcome.html

Investigate what we'd need to do to transform this project into an official FMOD plugin for Godot.

This could allow us to legally access the FMOD binaries and sign them, for example, and then bundle that up for people to use. This repository here would not contain the bundle but instead, the plugin would be available on the FMOD asset store.

No nativescript_init in "res://addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll" found

Hello,

While I don't have this issue on linux anymore, I still have it on windows.
Here is what I did, and the versions I used:

fmod version : 2.00.08 (Because someone said this one worked in the other nativescript issue. I also tried the latest version)
Godot version: 3.2.3
fmod-gdnative version: 13213a4

In windows 10:

I generated the api.json file, as detailed in the godot-cpp documentation.
I went into godot-cpp and built it with this command:
scons platform=windows generate_bindings=yes use_custom_api_file=yes custom_api_file=api.json target=release

Modified the Sconstruct file to remove the expected _vc suffix from the libraries, since this suffix wasnt present in my files.
I went into fmod-gdnative and built it with this command:
scons platform=windows target=release bits=64

Copied all the files to addons/fmod/libs/windows
Here is my folder:
windows.zip
I did not find librairies named fmod64 and fmodstudio64 as said in issue #41, so I guess the naming scheme changed since then. Those libraries are from the x64 folder of fmod librairies.

When trying to run the project, I have those errors (edited to remove my name, but otherwise as is):

Godot Engine v3.2.3.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce GTX 1080/PCIe/SSE2

Running project: C:/Users/<name>/Desktop/dev/limbic_island (C:::Users::<name>::Desktop::dev::limbic_island)
Godot Engine v3.2.3.stable.official - https://godotengine.org
OpenGL ES 3.0 Renderer: GeForce GTX 1080/PCIe/SSE2

ERROR: Can't open dynamic library: C:/Users/<name>/Desktop/dev/limbic_island/addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll, error: Error 126: The specified module could not be found.
.
   At: platform/windows/os_windows.cpp:2395
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
   At: modules/gdnative/gdnative.cpp:501
ERROR: init_library: No nativescript_init in "res://addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll" found
   At: modules/gdnative/nativescript/nativescript.cpp:1506
SCRIPT ERROR: _init: Attempt to call function 'new' in base 'NativeScript' on a null instance.
          At: res://addons/fmod/Fmod.gd:122
SCRIPT ERROR: set_software_format: Invalid call. Nonexistent function 'set_software_format' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:155
SCRIPT ERROR: init: Invalid call. Nonexistent function 'init' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:142
SCRIPT ERROR: load_bank: Invalid call. Nonexistent function 'load_bank' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:246
SCRIPT ERROR: load_bank: Invalid call. Nonexistent function 'load_bank' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:246
### here
[Node:1184]
SCRIPT ERROR: add_listener: Invalid call. Nonexistent function 'add_listener' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:205
SCRIPT ERROR: create_event_instance: Invalid call. Nonexistent function 'create_event_instance' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:286
SCRIPT ERROR: _ready: Invalid type in function 'start_event' in base 'Node (Fmod.gd)'. Cannot convert argument 1 from Nil to int.
          At: res://global_scripts/global.gd:38
SCRIPT ERROR: _notification: Invalid call. Nonexistent function 'free' in base 'Nil'.
          At: res://addons/fmod/Fmod.gd:133
ERROR: get_symbol: No valid library handle, can't get symbol from GDNative object
   At: modules/gdnative/gdnative.cpp:501
ERROR: terminate: No valid library handle, can't terminate GDNative object
   At: modules/gdnative/gdnative.cpp:406

Is there something I am doing wrong ?
Thank you

FMOD_ADVANCEDSETTINGS not exposed in integration

Hi,

thank you for providing this great FMOD integration for Godot <3.

Would it be possible in future releases to expose the FMOD_ADVANCEDSETTINGS and getter/setter [1]?
This would allow to set the randomSeed which defaults to 0, which means every randomized parameter/instrument etc. starts with the same value/sound when you re-start a game using FMOD.

There are some cases where this is not ideal - i.e. randomized music events.

Thanks for all your hard work,
Michael

[1] https://www.fmod.com/resources/documentation-api?version=2.02&page=core-api-system.html#fmod_advancedsettings

need video tutorial

Hello, can you do a teaching video to demonstrate how Fmod and Godot interact? I'm new to both of them. I downloaded the demo, but I can't open the project file in the demo folder with Godot. I really want to learn Fmod and Godot integration, but I can't practice it. Thank you for your answer.

Some way to access individual track properties

(This might already exist, but I can't find it due to lack of proper docs)

It surprised me that there is no way to access data about tracks themselves inside of an event - only the event itself
User parameters can be used to work around but it's super tedious to create a new parameter for every single parameter you want to edit. Also, it requires you to hard-code each track parameter as there's no "get list of tracks in event" function (or in general a method way to get that list) either (afaik)
-i.e. useful for the case where you want to reset volumes of all tracks "for track in get_tracks_in_event: track.volume = 1.0"

Fading in & out tracks as per the image below is one example of a very common feature that this would be useful for
image

Cannot open sound files in exported Godot project

This is not exactly a FMOD issue.
Ressource files in godot ( so it also applies to textures) are imported and converted in a format that Godot can internally use.
When working in the editor, you basically have the same file in two different directories:
The original one and the imported/converted one in the .import directory (rename with its MD5 checksum as a suffix).

When exported, only the imported/converted remains, so we got two issues:
-Fmod doesn't work with Godot filesystem so "res:/whateveryouwant" doesn't work and the real relative path of the original files doesn't work either since it doesn't exist anymore.
-The file has been converted so Fmod can't read it anymore, even with the correct path.

In the editor, you can choose what file format you want to export but this only works on files Godot cannot import.
The only workaround I can think of is to put every sound file in a Fmod Bank but it means we can only use Fmod Studio, not the low level API.

BANK COULDN'T BE LOADED. Path incorrect or MasterBank not loaded yet.

Hello! I've set up Fmod Studio 2.02.05 on openSUSE 15.3, Godot 3.4.2 and fmod-gdnative 3.1.1 (binary from github releases).

Playing a music as per low-level example in readme works great, however when it comes to loading banks as in the following example:

# set up FMOD
Fmod.set_software_format(0, Fmod.FMOD_SPEAKERMODE_STEREO, 0)
Fmod.init(1024, Fmod.FMOD_STUDIO_INIT_LIVEUPDATE, Fmod.FMOD_INIT_NORMAL)

# load banks
Fmod.load_bank("res://audio/fmod/Master.bank", Fmod.FMOD_STUDIO_LOAD_BANK_NORMAL)
Fmod.load_bank("res://audio/fmod/Master.strings.bank", Fmod.FMOD_STUDIO_LOAD_BANK_NORMAL)

I'm getting an error:

--- Debugging process started ---
Godot Engine v3.4.2.stable.official.45eaa2daf - https://godotengine.org
OpenGL ES 3.0 Renderer: NVIDIA GeForce GTX 660/PCIe/SSE2
OpenGL ES Batching: ON
 
Fmod Gdnative interface managed by a GDScript wrapper
FMOD Sound System: Successfully initialized
FMOD Sound System: Live update enabled!
Custom File System enabled.
FMOD Sound System: LOADING BANK res://audio/fmod/Master.bank
FMOD Sound System: BANK  COULDN'T BE LOADED. Path incorrect or MasterBank not loaded yet.
FMOD Sound System: LOADING BANK res://audio/fmod/Master.strings.bank
FMOD Sound System: BANK bank:/Master.strings LOADED
FMOD Sound System: System released
--- Debugging process stopped ---

Now I'm having a hard time trying to figure out what's wrong. I've tried to build the Master bank with and without an event assigned to it, and I've checked that Master bank is marked as the master bank. And I've checked that the bank file changes its size depending if it has an event assigned.

But I'm always getting this message...

Can you help me please?

Example Project: libGodotFmod.windows.dll missing + play (F5) crashing

When you launch the project, these errors appear:
(Nie moᅤᄐna odnaleᅤ챠ヌ okreᅤロlonego moduᅤツu. = "Could not find procedure entry point...")

1

After adding the file from release 3.1.1 to lib/windows and reloading the project, the same errors appear

Adding libraries from Fmod API 2.02.03 doesn't help, the same error appears.

When selecting FmodTest.tscn as the main scene, and running the build (F5), these warnings/errors appear:

2

E 0:00:00.318   open_dynamic_library: Can't open dynamic library: G:/MUZYKA/BAZA/Muzyka/Zlecenia + Konkursy + Reszta/Projekty/(2022_07) FMOD + Godot Integration Video/UTOPIA-RISE EXAMPLE PROJECT/fmod-gndative-godot-example-project/lib/windows/libGodotFmod.windows.dll, error: Error 126: Nie moᅤᄐna odnaleᅤ챠ヌ okreᅤロlonego moduᅤツu.
.
  <C++ Error>   Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
  <C++ Source>  platform/windows/os_windows.cpp:2353 @ open_dynamic_library()
  <Stack Trace> Fmod.gd:3 @ _init()

Add option to suppress console output

Currently my Godot console gets drowned in output from the myriad of plugins and other nonsense I'm running for my game.
For most of them, there's some way to suppress it, but for the current implementation for the FMOD plugin there's no such thing.

Thus it would be nice to have a user-controlled option to enable/disable console logging.
This can be as simplistic/easy as this:

#define GODOT_LOG(level, message)\
    switch (level) {\
        case 0:\
            if (verbose_mode){\
            Godot::print(message);}\
            break;\
        case 1:\
            Godot::print_warning(message, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__);\
            break;\
        case 2:\
            Godot::print_error(message, BOOST_CURRENT_FUNCTION, __FILE__, __LINE__);\
            break;\
    }\

With verbose_mode being a public variable that can be toggled from inside of Godot.

Probably there a lot of other ways to do this and I'm sure you guys already have something in mind 😄

Noob-friendly how-to

Hi,

First of all, thank you for the work you've done on this project. I'm very interested in integrating Fmod in my current Godot project but I'm having a hard time achieving anything with the current README instructions. I feel like they are written for people with prior experience with Godot submodules and GDNative. Would you consider writing noob-friendly, step-by-step instructions?

Is setup (wiki) outdated?

Following the current wiki, I encounter an error with GDNative:

E 0:00:00.814 open_dynamic_library: Can't open dynamic library: C:/Users/Stefan/source/godot/fmod-intergration/addons/fmod/libs/windows/libGodotFmod.windows.release.64.dll, error: Error 127: The specified procedure could not be found.

.
<C++ Error> Condition "!p_library_handle" is true. Returned: ERR_CANT_OPEN
<C++ Source> platform/windows/os_windows.cpp:2269 @ open_dynamic_library()

I've tried following the guide given in the readme, but I suppose it's a bit over my head trying to built the C++ bindings. But alas, the guide in the wiki seem to indicate building bindings etc. is uneeded, but it does not seem to work.

Nullptr Bug

I got a bug that occurs after using FMOD.shutdown() and later reinitializing it. The functionality stops working and this error is printed:

ERROR: void __cdecl godot::Fmod::_process(float): A socket error occurred. This is a catch-all for socket-related errors not listed elsewhere.

I looked into the shutdown implementation and the following seemed odd:

In godot_fmod.cpp shouldn't:

system = nullptr;
coreSystem = nullptr;
ERROR_CHECK(system->unloadAll());
ERROR_CHECK(system->release());

be this:

ERROR_CHECK(system->unloadAll());
ERROR_CHECK(system->release());
coreSystem = nullptr;
system = nullptr;

I recompiled the libraries and the error spam stopped, so it seems like it fixed something.

OSX Travis CI error

As on godot-cpp repository, travis ci on osx is running out of time.
Switching to github actions was already planned, but we will need it sooner than expected.
This issue can be considered as an emergency as it block release and PR checks.

Reference to freed memory crash on listener game object deletion

I have a solution for this, so this is primarily to provide documentation for the next person who encounters this. I experienced this on macOS, mainly from within the editor (the exported game didn't seem to experience this issue, but I'm honestly not sure why it was behaving any differently unless it was simply a matter of runtime safety checks not being active on the exported build).

In game, the Player scene's _ready function calls Fmod.add_listener. Changing to the next room in the level didn't cause any problems, but when trying to return to the main menu, the game would consistently freeze and silently crash in the editor whenever it tried to free the scene. I ran it from the command line and found that it appeared to be something in the fmod integration whenever the scene tree was unpaused. I tried leaving the game scene loaded alongside the main menu and I didn't experience the crash. Knowing that it was related to the game scene disappearing, I discovered that the problem occurs when the object attached to an fmod listener has been freed, because the fmod library doesn't seem to check that it still has a valid instance. To fix this, you need to explicitly call remove_listener whenever the scene was clearing.

The problem didn't occur when switching to the next room because even though the Player object was freed, a new one was immediately created and attached to the same listener slot.

I added the following to my Player.gd and the problem appears to be resolved:

func _notification(what: int) -> void:
    if what == NOTIFICATION_PREDELETE:
        if Fmod.get_object_attached_to_listener(fmod_player_listener) == self:
            Fmod.remove_listener(fmod_player_listener)

This is the error message that I was seeing when the game would crash at the loading screen:

CameraController _on_Events_room_reset
emitting scene_loaded
_on_BackgroundLoader_scene_loaded
_on_Animation_animation_changed
got scene
grandparent exists
parent Chapter0 grandparent root
freeing stuff
fading out
all done
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] 1   libsystem_platform.dylib            0x00007fff20354d7d _sigtramp + 29
[2] 2   Cocoa                               0x00007fffc0d0da48 CocoaVersionNumber + 2346220112
[3] godot::Fmod::setListenerAttributes()
[4] godot::Fmod::_process(float)
[5] godot_variant godot::__wrapped_method<godot::Fmod, void, float>(void*, void*, void*, int, godot_variant**)
[6] NativeScriptInstance::call(StringName const&, Variant const**, int, Variant::CallError&) (in Godot) + 401
[7] Object::call(StringName const&, Variant const**, int, Variant::CallError&) (in Godot) + 144
[8] Variant::call_ptr(StringName const&, Variant const**, int, Variant*, Variant::CallError&) (in Godot) + 111
[9] GDScriptFunction::call(GDScriptInstance*, Variant const**, int, Variant::CallError&, GDScriptFunction::CallState*) (in Godot) + 146479
[10] GDScriptInstance::call_multilevel(StringName const&, Variant const**, int) (in Godot) + 183
[11] Node::_notification(int) (in Godot) + 1589
[12] Object::notification(int, bool) (in Godot) + 19
[13] SceneTree::_notify_group_pause(StringName const&, int) (in Godot) + 2074
[14] SceneTree::idle(float) (in Godot) + 599
[15] Main::iteration() (in Godot) + 817
[16] OS_OSX::run() (in Godot) + 391
[17] main (in Godot) + 529
[18] 18  libdyld.dylib                       0x00007fff2032b621 start + 1
[19] 19  ???                                 0x0000000000000003 0x0 + 3
-- END OF BACKTRACE --

Supporting both 32bit and 64bit architecture

Given I built the bindings for both 32bit and 64bit systems, where would I need to put them?

This is my current setup (64bit)
Capture

However, all three files are 64bit bindings and would not usually work on a 32bit system. Is there a way somehow to support both, 32bit and 64bit bindings?

For example:

/addons/fmod/libs/windows/x64/
   |_ put 64bit files here
/addons/fmod/libs/windows/x86/
   |_ put 32bit files here

Upgrade to Godot 4.0 (GDExtension)

fmod-gdextension-logo

This ticket is to track anything we might need to consider when upgrading to 4.0. A few initial thoughts:

  • surely, we want to keep the 3.x compability - perhaps we might want to introduce a complete new repository for this (as 3.x is built on gdnative, while the 4.x version should utilise the GDExtension system)
  • by using GDExtension, we might be able to finally tackle #50 as with gdnative this is rather difficult (due to its inflexibility)
  • we might want to try to "just update" this repository first to 4.x to see what happens or what breaks and document it as some form of "PoC PR"
  • how are we going to maintain both 3.x and 4.x in parallel? We might need to consider some sort of cherrypick mechanism like Godot has (they do it via labels and cherry-pick squash commits onto their branches)

Any feedback or ideas welcome how we can ideally introduce FMOD support for Godot 4!

TODOs

  • initial upgrade from GDNative -> GDExtension #123
  • re-introduce passing GUT tests (insert PR link)
  • run GUT tests as part of CI builds (insert PR link)
  • re-introduce support for MacOS (exports currently broken, insert PR link)
  • re-introduce support for Linux (insert PR link)
  • re-introduce support for Android (insert PR link)
  • re-introduce support for iOS (insert PR link)
  • 🍒 cherry-pick #136 onto godot-4.x
  • 🍒 cherry-pick #140 onto godot-4.x
  • 🍒 cherry-pick #145 onto godot-4.x
  • 🍒 cherry-pick #142 onto godot-4.x
  • extend documentation with how to build the GDExtension (insert PR link)
  • change architecture for Godot 4 -> #138
  • rename current master branch to godot-3.x and make godot-4.x the new default branch (only after everything else is done!)
  • rename repository to godot-fmod

Code signing of .dylib files for MacOS

On MacOS it is not possible to either open or run games that are using this extension, as the loaded .dylib files are considered insecure by the latest MacOS security policies. To work around this issue, the dylib files need to be manually approved within the security section of the operating system, however, this is not an acceptable solution when trying to bundle the game for people to play. Also, it makes it difficult for collaborators to clone your game and try it out on their MacOS, as they will face the same issue.

Possible solution

The solution to this problem is to use codesign https://stackoverflow.com/a/61176509 where the artifacts need to be signed. We should document this issue on the README and include steps for people to circumvent that by code signing their artifacts (including the FMOD dylibs)

Please note that M1 laptops might require special treatment here as the security on them has been tightened by Apple!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.