Upon pressing Play in Unity, you’ll find all the event’s parameters within an array in the inspector,
from where they can be accesed using the following syntax:
You could make this a tad more user friendly by storing the parameters in a dictionary instead of a standard array. I had a go an this is what I came up with, it works too:
private FMOD.Studio.ParameterInstance p = null;
private FMOD.Studio.PARAMETER_DESCRIPTION description = new PARAMETER_DESCRIPTION();
public Dictionary<string, FMOD.Studio.ParameterInstance> parameters = new Dictionary<string, FMOD.Studio.ParameterInstance>();
void CacheEventParameters()
{
int parameterCount;
ERRCHECK(evt.getParameterCount(out parameterCount));
for (int i = 0; i < parameterCount; i++)
{
ERRCHECK(evt.getParameterByIndex(i, out p));
ERRCHECK(p.getDescription(out description));
parameters.Add(description.name, p);
}
}
So now you can reference parameters by their actual name instead of remembering their position in an array.
parameters["ParameterName"].SetValue(value);
I personally turned it into a function so all I need to do is call SetParameterValue(string, float).
Cool stuff, excited to try it out. Would love to see FMOD develop true occlusion and reflections like GSOUND http://gamma.cs.unc.edu/GSOUND/ as well as true HRTF!