Are FMOD_STUDIO_PARAMETER_IDs fixed? Can I hardcode a known parameter ID into my code and it won’t ever change based on adjusting options on the parameter or between different bank builds/platforms? Or is there a way to get a non-global parameter ID by name from the Studio API without an EventDescription? According to the docs, Studio::System::getParameterDescriptionByName only seems to be for global / mixer parameters.
Hi,
Parameter IDs are designed to be stable, so they should remain unchanged when modifying parameter properties or rebuilding banks for different platforms, as long as the parameter itself isn’t deleted and recreated.
You can find more information in the New Parameter API documentation.
To retrieve a local parameter ID by name, you’ll need to use Studio::EventDescription::getParameterDescriptionByName. You don’t need to create an EventInstance for this, and you can cache the retrieved ID for reuse.
Hope this helps!
Thanks for the info! I’m a bit confused about Studio::EventDescription::getParameterDescriptionByName. This is not a static function, meaning I’d need an EventDescription object to call the function on, right?
Yes, that’s correct! Sorry for the confusion, I missed the “without an EventDescription” part of your original question.
You will need an EventDescription to retrieve an event-local parameter ID by name using the current Studio API. You can obtain one using Studio::System::getEvent().
You can also find an example of this in the event_parameter.cpp file included in the FMOD Engine SDK:
FMOD::Studio::EventDescription* eventDescription = NULL;
ERRCHECK( system->getEvent("event:/Character/Player Footsteps", &eventDescription) );
FMOD_STUDIO_PARAMETER_DESCRIPTION paramDesc;
ERRCHECK( eventDescription->getParameterDescriptionByName("Surface", ¶mDesc) );
FMOD_STUDIO_PARAMETER_ID surfaceID = paramDesc.id;