FMod Web API Failed to get parameter

Hi ! In my website i want to integrate a parameter to change values on audio with the FMod Studio API.
I started from the example “event_parameter” and I changed the soundbank, the name of the parameter and the event called but the script sends me: “Error!!! ‘The requested event, parameter, bus or vca couldn’t be found.’”

The error is in the line CHECK_RESULT(gEventInstance.setParameterByID(gSurfaceID, surfaceParameterValue, false)); and i dont know why it didn’t work.

(sorry for the spelling I am French)

Hi,

To clarify:

  • Have you spelled the parameter name correctly? Capitalization shouldn’t matter
  • Does the parameter whose name has been changed exist in your event?

If you’re using a new event and parameter, have you done the following:

  1. Created a new event in FMOD Studio
  2. Added your new parameter to the event
  3. Assigned the event to the bank you’re going load
  4. Built your banks

If you want to verify that your event has a specific parameter, you can use Studio::EventDescription::getParameterDescriptionCount to get the total number of parameters in the event, and then iterate using the parameter count with Studio::EventDescription::getParameterDescriptionByIndex to get all the parameter descriptions.

I checked the error with “getParameterDescriptionCount(1)” and he send me 0 every time.
The message changed to "Error!!! ‘An invalid parameter was passed to this function.’ "
Its the right name, with the right build and the right assingation.

I placed my parameter called “PlainOrForest_param” in a folder in FMod
Should the parameter name change from “PlainOrForest_param” to “Ambiance Modifiers/PlainOrForest_param” ?

The count argument of getParameterDescriptionCount is a reference to a var that FMOD will assign a value to. You need to pass it to the function like so:

var paramCount = 0;
youEventInstance.getParameterDescriptionCount(paramCount);
console.log(paramCount);

If you’ve done the following:

  • Added the parameter “PlainOrForest_param” to your event
  • Assigned the event to a bank
  • Built your banks
  • Loaded your built banks in your code - see lines 151-153 of event_parameter.js in the Studio API HTML5 example

Then you should be able to access the parameter using just the name “PlainOrForest_param” - you shouldn’t need “Ambiance Modifiers/PlainOrForest_param”.

The most common way to use the parameter name is to create your EventInstance using the EventDescription, and then use EventInstance::setParameterByName with the name to set the parameter value for that event.

The event_parameter.js example uses a slightly different approach, where it gets the ParameterDescription from the EventDescription (line 161), then gets the parameter ID from the ParameterDescription (line 162), and uses the ID instead of the name to set the parameter value with EventInstance::setParameterByID (line 170).

Okay so i think use EventInstance::setParameterByName is what i want.

So I tried several things:
colorfullAmbienceInstance.setParameterByName but the error “colorfullAmbienceInstance.setParameterByName is not a function” appeared
gEventInstance.setParameterByName but the error “a invalid parameter passed to this function” appeared.
When i change the name of the parameter and choose another who exist in the sounbank but the console tell me : Error!!! ‘The requested event, parameter, bus or vca could not be found.’

I think the second test was correct but I don’t understand why FMod indicates that the event doesn’t exist. My sound bank has been updated several times and I’m sure I have the parameter in it. The import of banks also works because I have an event from my sound bank that can be read.

In that case, to help me diagnose the issue, could I get you to upload your code and your packaged FMOD Studio project (packaged with assets, if possible) to your FMOD Profile under the “Uploads” tab?

I failed to upload my project to the “FMOD Profile” page my project disappeared
It is not possible to send a . zip archive by mail or just a wetransfer link ?

There may have been an issue on our end - try again now and see if it uploads successfully. Failing that, please email support@fmod.com either your project, or a link to it, as well as a link this forum thread.

I send my files. The fail page is on WebsiteSRC\projects\hideandflee\hideandflee.js with the slider “setVolumeSlider”

After a look at your project, it appears that the issue is that the masterVolume_param parameter is a global parameter, and isn’t tied to the “Colorfull” event like PlainOrForest_param or LevelStage_param are. This means it cannot be set with calls to the event; instead, to set a global parameter, you can use the FMOD Studio System’s setParameter functions - in this case, Studio::System::setParameterByName is probably what you want.