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!