# Event Callback Measure Number Discrepancy

**URL:** https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634
**Category:** Unity
**Created:** [May 18, 2024, 2:01am UTC](https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634 "2024-05-18T02:01:49Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![m\_daniel26](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@m\_daniel26](https://qa.fmod.com/u/m_daniel26)
#### Post date: [May 18, 2024, 2:01am UTC](https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634/1 "2024-05-18T02:01:49Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [May 22, 2024, 3:20am UTC](https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634/2 "2024-05-22T03:20:51Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![m\_daniel26](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@m\_daniel26](https://qa.fmod.com/u/m_daniel26)
#### Post date: [May 22, 2024, 10:21pm UTC](https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634/3 "2024-05-22T22:21:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [May 24, 2024, 5:45am UTC](https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634/4 "2024-05-24T05:45:50Z")

</div>

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”.

---

<div class="post-metadata">

### Author: ![m\_daniel26](https://avatars.discourse-cdn.com/v4/letter/m/ecd19e/32.png) [@m\_daniel26](https://qa.fmod.com/u/m_daniel26)
#### Post date: [May 25, 2024, 1:37am UTC](https://qa.fmod.com/t/event-callback-measure-number-discrepancy/21634/5 "2024-05-25T01:37:02Z")

</div>

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