Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting parameters not working #248

Open
Dodoveloper opened this issue Sep 5, 2024 · 4 comments
Open

Setting parameters not working #248

Dodoveloper opened this issue Sep 5, 2024 · 4 comments

Comments

@Dodoveloper
Copy link

Dodoveloper commented Sep 5, 2024

Hey there!

I'm using the latest version of the addon with Godot 4.3 stable.

I created a custom resource to be edited in the inspector, similarly to what you get with the "Fmod event" property in the FmodEventEmitter2D node.
The resource holds the selected event's GUID and path. Plus, it fetches parameters and puts them in an event_parameters dictionary with the following structure:

{
    "parameter_name": {
        "id": param_id,
        "value": param_value,
    },
   # other parameters...
}

I later use them to instance an event and set its parameters in code:

var event: FmodEvent = FmodServer.create_event_instance_with_guid(resource.event_guid)

for key: String in resource.event_parameters.keys():
    var param: Dictionary = resource.event_parameters[key]
    # the parameter is continuous
    event.set_parameter_by_id(param.id, param.value)
    # always prints default value
    print(event.get_parameter_by_id(param.id))

The issue is that the event's parameter doesn't seem to be set.
Indeed the debugger shows the following error:

An invalid parameter was passed to this function.void godot::FmodEvent::set_parameter_by_fmod_id(const FMOD_STUDIO_PARAMETER_ID&, float) constsrc/studio/fmod_event.cpp82

I checked the parameter ID and it is the right one, also if the types are correct and they are (param.id is an int and param.value is a float).

I tried using set_parameter_by_name and I get a similar error:

An invalid parameter was passed to this function.void godot::FmodEvent::set_parameter_by_name(const godot::String&, float) constsrc/studio/fmod_event.cpp60

It looks like a bug to me, or am I doing something wrong?

UPDATE:

I set the event using the FmodEventEmitter2D node, then used the same API calls above to manually create an instance using the FmodEventEmitter2D.event_guid property and I get the same error.

But the interesting thing is that calling FmodEventEmitter2D.set_parameter triggers a similar issue, too.

An invalid parameter was passed to this function.void godot::FmodEvent::set_parameter_by_fmod_id(const FMOD_STUDIO_PARAMETER_ID&, float) constsrc/studio/fmod_event.cpp82

Same exact error if I try $FmodEventEmitter2D["path/to/property"] = 42.
NOTE: in both cases, calling FmodEventEmitter2D.get_parameter actually shows the parameter has changed! But the sound is indeed the same, as if the parameter wasn't actually set.

I'm worried there's currently no way to set parameters.

@Dodoveloper
Copy link
Author

Probably related to #217

@Dodoveloper Dodoveloper changed the title Invalid parameter passed to FmodEvent.set_parameter_by_id Setting parameters not working Sep 10, 2024
@northrain04
Copy link

I have the exact same problem, but didn't investigate as deep as you did. So it seems like parameter calls for the engine are not implemented?

@piiertho
Copy link
Member

Hello @Dodoveloper
I'm not sure it is related to #217
Can you provide a minimal reproduction project so I can have a look ?

@Dodoveloper
Copy link
Author

Ok, I was able to dig a bit deeper.

When setting up an MRP for you, using the default Fmod Examples, I noticed that parameter setting actually worked!

I figured there's an issue with my project, so I tried again and I saw that the issue I reported only affects continuous parameters for some reason; discrete and labeled parameters are fine ✅ .

Here's a list of what I tried:

  • check that the banks folder is set in Project Settings
  • load all banks in the scene via the FmodBankLoader node and make sure Master.strings.bank and Master.bank are loaded first (in this order)
  • clear my project's .godot cache
  • rebuild the project in Fmod
  • refresh banks in Godot
  • test at least 4 different events with continuous parameters (not working ❌ )
  • call FmodEvent.set_parameter_by_id and FmodEventEmitter2D.set_parameter (both not working ❌ )

So it seems to be related to my project and to continuous parameters, specifically.
Unfortunately, I can't include those events in an MRP. I'll share it as soon as I'm able to figure out how to trigger the error with non-copyrighted assets, but ATM I'm still not able to figure out what's the issue.

Could this be related to a misconfiguration? Or maybe to a particular setting in the Fmod project?

The Fmod version is 2.02.21 BTW

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants