When you call getProperty on the EventInstance you are getting back the value you set (or the default). In this case that value is -1, meaning use the values from the Event data. To fetch the min / max distance authored in FMOD Studio you can use EventDescription::getMaximumDistance.
getMaximumDistance indeed works. I was expecting I’ll be able to get value from the instance cause instance will change depending on parameters.
I’m trying to implement footstep system where other than walking I have sprint and sneak options.
Here is my setup
So by changing Speed param I’m getting different volumes.
What doesn’t seem to work is when I added Spatializer override, cause max distance is still default 20m from Master track and not the one I’m setting by params. And if I remove Master Spatializer then I get 0 for max distance.
Is this doable or I need to take different approach?
If you plan on using the override feature within Unity your query logic will be slightly more complicated. First call getProperty on the instance, if it returns -1 then call getMaximumDistance on the description, otherwise use the instance value. If you remove the spatializer then that event will have no min/max distance.
When I pass speed 1 for a Sneak, I would expect that max distance to be 6 and not default 20, but at first I get printed -1 for maxDist and then 20 for newMaxDist, so it’s not picking up overridden value.
It looks like you have a spatializer on a track that isn’t the master track. The query API cannot see the values of these effects. For details please check the query API documentation. We are aware that the handling of min/max distance isn’t ideal and have plans to improve it for 2.2.
Unfortunately they won’t, only the master track is considered for min/max override and the query APIs.
In 2.2 we will be making min/max a property of the Event rather than a property of a specific panner effect. This means any panner within the event including those on tracks will respond to the min/max Event value. Additionally we will be making min/max at the Event level automatable, so you can expose parameters to control the range just like any other Event property.
I resume this old thread since I’ve also some doubts about setting the min\maxdist through Event Instance Property (can’t use Fmod 2.02 at the moment).
I also get (for example, for min dist using EventInstance->getpropertyt): -1 as minDist value, then I set the minimum distance to let’s say 50 with setProperty, and then I verify that the mindist is effectively changed with the same getProperty (and this time I get 50, as expected).
The problem is that inside the game apparently there is no change in audio even with extreme values…so I am wondering…does this setProperty work also with presets? because I’ve got a spatializer on the main track but it’s a preset shared between multiple events…so maybe no error is logged but the value is not set because it’s a preset?
Thank you very much
P.S: I am using Fmod 2.01 with a proprietary engine…
The key things with 2.01 are only 3D spatializers on the master track are affected by setProperty min / max. Whether that effect is applied directly or via a preset to the Event shouldn’t make any difference. If you min distance is larger than your max distance you might get some weird results, but otherwise it should apply.
Can you perform a simple test setting the min distance to 1000, then placing the Event 900 units away, it should still be fully audible.