Delta-times are gaps between events; to place events on a timeline you add them up into absolute ticks from the start of the track. Today you make that running total.
Convert a track's delta-times into absolute tick positions.
A delta-time is relative - it says “wait this many ticks after the previous
event.” That is compact for storage but useless for asking “what happens at tick
192?” So the first step toward timing is a running total: walk the events in
order, keep a sum, and each event’s absolute tick is the sum after adding its
own delta. Deltas 0, 96, 96 become absolute ticks 0, 96, 192.
Add an AbsTick field to each timed event and fill it in this one pass. Absolute
ticks are the common currency for everything left in the project: pairing a note-on
with the note-off that comes later, collecting tempo changes at the ticks where they
happen, and converting any tick to seconds. It is a tiny computation with a big
payoff - the whole track now lives on one shared timeline.
// running sum: each event sits at the previous total plus its own deltavar tick uint32for i := range events {tick += events[i].Deltaevents[i].AbsTick = tick // add this field to TrackEvent}