Returned global parameter value not what it should be

I’ve added a global parameter “TrackNumber”.
In an event I have all my music tracks one after another and use this parameter to select the active one:

Each track is a nested event. When it’s finished, a command instrument increases the TrackNumber value by one:

grafik

This way I’m getting a nicely playing track playlist, but I’m also able to select the active track from code by just setting the TrackNumber parameter directly.

However, since the tracks increase the global parameter automatically at the end, to then manually skip to the next track, I first need to get the value of the global parameter, because my C++ code can’t know how often the tracks already automatically increased the parameter value.

And this is where it’s getting weird.

I call System::getParameterByName to retrieve the value, but it seems to be de-synced from the actual value used by the event. I can change it via System::setParameterByName and that DOES change the active track, and I can then call System::getParameterByName and it DOES give me the previously set value, however, if the value is modified by the command instrument inside the event, it DOES advance to the next track, but the value returned by System::getParameterByName does NOT change.

So I don’t know which track fmod is actually currently playing.

Is this supposed to work? Anything obvious that I might be doing wrong?

Edit: This is with FMOD 2.02.20. I’ve looked at the release notes but didn’t see any fixes around global parameters being mentioned in newer versions.

The value argument of getParameterByName is the value as set from the public API. The finalvalue argument is the final value of parameter calculated by the Studio system based on value set via the API and changes from the system itself like automation, modulation, command instruments, etc.

Try retrieving finalvalue instead of value and see whether its value lines up with what you expect based on how your event is set up.

That works, thank you!

1 Like