How to replace the deprecated ParameterInstance class in 2.0?

Hi,

I’m excited about the new features in 2.0. Thank you for this amazing release! I just was testing the integration and in older versions I was using this method to set a parameter:

public void SetParameterFloat(FMOD.Studio.EventInstance instance, string parameter, float value)
    {
        FMOD.Studio.ParameterInstance _parameter;
        instance.getParameter(parameter, out _parameter);

        _parameter.setValue(value);
    }

My knowledge of C# is basic and I thought this was a very simple way of setting a parameter. I can’t understand very well how to use the new event functions to archieve a similar result in code. Can I just use setParameterByName(parameter, value) to quickly set a parameter now? What are the EventDescription and ParameterDescription useful for? I think that’s something I haven’t managed to understand and that could clear up my mind : )

Alex

I hit this too, but my entire project exploded, so I bailed on upgrading right now. setParameterByName should work perfectly fine. If it doesn’t, I suggest you report it as a bug :wink:

@Shadoninja is correct, setParameterByName can be used in place of that function.

The description objects can be thought of as the default object from Studio, you can get all the information about the object but most things can only be set on an instance of that object.

In studio api, typically you will load an Studio::EventDescription from a Studio::Bank. Then you will use the Studio::EventDescription to create an Studio::EventInstance. Then to play the event, you call Studio::EventInstance::start.

https://fmod.com/resources/documentation-api?version=2.0&page=studio-guide.html#getting-started

Using strings when calling the API isn’t the most efficient, so we also expose methods for using ID’s which is generally much faster. These ID’s are stored in the desctiptions.

1 Like