TimeCalculator
Converts between ticks and (bar, beat, offset) positions for a chart.
Built from the chart's :class:BeatEvent list, which partitions the timeline into
time-signature segments. Bars before the first event default to 4/4. Most callers use
the module-level :func:tick_to_pos / :func:pos_to_tick instead of constructing this
directly.
Functions
func__init__(self, beat_events) -> NoneBuild a calculator from a chart's beat (time-signature) events.
paramselfparambeat_eventsIterable[BeatEvent]Returns
Nonefunctick_to_pos(self, tick) -> PositionConvert an absolute tick to a (bar, beat, offset) position.
paramselfparamtickintNon-negative absolute tick from the chart start.
Returns
margrete_rpc.chart.time.PositionThe (bar, beat, offset) position of tick.
func_find_segment_index(self, tick) -> intparamselfparamtickintReturns
intfuncpos_to_tick(self, bar, beat=0, offset=0) -> intConvert a (bar, beat, offset) position to an absolute tick.
paramselfparambarintZero-based bar index.
parambeatint= 0Zero-based beat within the bar.
paramoffsetint= 0Tick offset within the beat.
Returns
intThe absolute tick from the chart start.
func_find_segment_index_for_bar(self, bar) -> intparamselfparambarintReturns
int