Everything a transport bar and a clock need, in one object.

interface ReplayState {
    bar: null | Bar;
    index: number;
    playing: boolean;
    speed: number;
    subIndex: number;
    subSteps: number;
    total: number;
}

Properties

bar: null | Bar

The bar at index, the replay clock's "now". Null when there is no data.

Under intra-bar replay this is the partial bar as it stands this step, not the completed one, which is what makes it the right thing to drive a host's own forming volume bar or an OHLC readout from.

index: number

0-based index of the newest bar currently on the chart.

playing: boolean
speed: number

Multiplier over barMs: 2 plays two bars per barMs.

subIndex: number

Which step of the forming bar this is, 0-based, and how many it takes. Both are 0 and 1 without subBars, so a transport that shows them needs no special case for the plain mode.

subSteps: number
total: number

Bars in the replay set (the scrub bar's maximum is total - 1).