Triplet Timeline Callbacks

I have a woring Timeline Callback script triggering events on beats, but I need subbeats to trigger certain events as well. I tried altering the signature and managed to get the quarter notes, but I might need things like triplets to also be assigned to events, which seems hard to do.

        accurateTime = dspclock / 48800;
        halfTime = dspclock / 48800 * 0.5f;
        tripletTime = dspclock / 48800 * GetIntervalLength(_bpm, 0.3f);
        quarterTime = dspclock / 48800 * 0.25f;
      
        public float GetIntervalLength(float bpm, float noteLength)
        {
            return 60f / (bpm * noteLength);
        }

This is what I’m trying as of now, but for some reason it keeps being triggered with every frame in a condition like this.

        if (lastTripletTime != Mathf.FloorToInt(tripletTime))
        {
            lastTripletTime = Mathf.FloorToInt(tripletTime);
            //TripletEventUpdated();
            Debug.Log("Triplet");
        }

Any help would be much appreciated!

Just to clarify, you’re wanting to receive callbacks for both quarter notes and triplet for the same timeline? Is it a compound meter, or a polyrhythm?

I see you’ve already posted in a separate thread, which I will link here for posterity: Is it possible to subscribe to sub-beat callbacks? - #7 by Kiru176

xanhulme’s response in the thread was pretty much exactly what I was going to suggest - if that doesn’t suit your use case, please reply in that thread.