Event Callback Measure Number Discrepancy

I’m using the Event Callback system to synch up my scripts in Unity to the measures and beats in FMOD. I noticed that whenever there is a tempo change marker in my FMOD event, the measure number in Unity resets to 1 - which I know FMOD does for looping synchronization purposes, so that makes sense. As a quick fix, I’ve added a function into my Music Manager script which basically checks what the current LastMarker callback is, and then adds the appropriate number of measures onto the CurrentMeasure integer in the script based on which marker I’m currently on.

My question is…is there an easier way? This works in a pinch, but if there’s an alternate callback that reads the actual full timeline measure instead of the current loop measure, that would be easier than doing all that extra math in the Music Manager script.

Currently you need to keep track of it on the game side as there isn’t a way of getting the absolute beat number.

Depending on the use case, it may be better handled on the game side rather than in FMOD, can I ask what you are wanting to do with it?

In this particular instance, it’s a UI interaction. Basically, when the player picks up a certain object, a chord will play and which chord plays naturally depends on which bar and beat of music is current.

Doing the math in-script is working fine, just figured I might as well see if there was a more efficient way to get that calculation.

1 Like

That sounds cool. At this point appears to be the best way to determine the overall beat and bar.

While discussing this internally, we could only come up with other similar ways of maybe doing something similar, eg. using parameters and nested events along the timeline of music track, but nothing necessarily “better” or “more efficient”.

Cheers, figured as much, but might as well check!