/** * Scheduler -- clock abstraction decoupling animation from requestAnimationFrame. * * Four implementations: * - raf: browser real-time (default) * - noop: SSR-safe * - fixedStep: deterministic timestamps at target fps (video rendering) * - audioSync: ticks in lockstep with an AVBridge sample counter * * @module */ import type { AVBridge } from './av-bridge.js'; interface SchedulerShape { readonly _tag: 'FrameScheduler'; schedule(callback: (now: number) => void): number; cancel(id: number): void; } interface FixedStepShape extends SchedulerShape { step(): void; readonly frame: number; } /** Default: requestAnimationFrame. Used by Timeline/animate in browser. */ declare function _raf(): SchedulerShape; /** SSR-safe: noop scheduler for server environments. */ declare function _noop(): SchedulerShape; declare function _fixedStep(fps: number): FixedStepShape; interface AudioSyncShape extends SchedulerShape { poll(): void; readonly frame: number; readonly bridge: AVBridge.Shape; } declare function _audioSync(bridge: AVBridge.Shape): AudioSyncShape; /** * Scheduler — clock abstraction that decouples animation driver from real time. * Pick the impl that matches the runtime: `raf` in browser, `noop` on the * server, `fixedStep` for deterministic video render, `audioSync` to drive UI * in lockstep with an {@link AVBridge}. */ export declare const Scheduler: { /** `requestAnimationFrame`-backed scheduler for browser real-time work. */ raf: typeof _raf; /** No-op scheduler for SSR / environments without rAF. */ noop: typeof _noop; /** Fixed-step scheduler at the given fps — deterministic timestamps for offline rendering. */ fixedStep: typeof _fixedStep; /** Scheduler that polls an {@link AVBridge} and fires callbacks when the sample frame advances. */ audioSync: typeof _audioSync; }; export declare namespace Scheduler { /** Common structural shape every scheduler variant satisfies. */ type Shape = SchedulerShape; /** Fixed-step scheduler with manual `step()` advancement. */ type FixedStep = FixedStepShape; /** Audio-synchronized scheduler bound to an {@link AVBridge}. */ type AudioSync = AudioSyncShape; } export {}; //# sourceMappingURL=scheduler.d.ts.map