Core · interface

TickTraceLike

What a fixed-step simulation produced, tick by tick.

Explained in The loop.

interface TickTraceLike
import type { TickTraceLike } from '@driftengine/core';

In depth

Replaying a recorded run means re-running the simulation, which is far too expensive to do inside a frame and cannot be seeked into at all — an intent stream has no keyframes, so reaching tick 4,000 means running the four thousand before it. Running it once, up front, and keeping what each tick produced turns a replay from a simulation into a lookup.

A flat Float32Array of channels values per tick, plus one byte of flags for the booleans that would otherwise cost four bytes each. Preallocate with capacity when the length is known — a caller replaying a recording always knows it — and nothing reallocates while the simulation is running.

Properties

NameTypeDescription
lengthreadonlynumber
channelsreadonlynumber

Methods

sample

sample(tick: number, out: Float32Array): void
ParameterTypeDescription
ticknumber
outFloat32Array

flagsAt

flagsAt(tick: number): number
ParameterTypeDescription
ticknumber

channelAt

channelAt(tick: number, channel: number): number
ParameterTypeDescription
ticknumber
channelnumber

tickAtOrBefore

tickAtOrBefore(channel: number, value: number): number
ParameterTypeDescription
channelnumber
valuenumber