import Artist from './artist'; import type { ScoreV2 } from './score/grammar2/model'; import type { ParsedScore } from './score/model'; import { type PerformerName, type PerformerProfile, type SwingSetting } from './playback/performer'; import { type SheetControls } from './playback/control-options.mts'; import { type PlaybackPlugin } from './playback/transport'; /** One plugin instance may open independent sessions for multiple players. */ export interface PlayerOptions { /** Zero-based v2 instrument to play. Omit to play all instruments together. */ partIndex?: number; partId?: string; playback?: PlaybackPlugin; /** Configure or hide the sheet controls, or mount a transport in a separate host. */ controls?: HTMLElement | boolean | SheetControls; tempo?: number; /** Override the written performer. Each play takes a fresh seed unless one is supplied. */ performer?: PerformerName | PerformerProfile; seed?: number; /** Override the written swing directive for this performance. */ swing?: SwingSetting; order?: 'written' | 'performed'; instrument?: string | number; show_controls?: boolean; overlay_class?: string; soundfont_url?: string; } export default class Player { static DEBUG: boolean; static INSTRUMENTS_LOADED: Record; private readonly transport; private overlay?; private artist?; private score?; private ensemble?; private generation; private performanceTempo; private sharedSurface; private geometry?; private companions; private animations; private mark?; private readonly options; /** A parsed score can play headlessly. An Artist supplies its most recently drawn rows. */ constructor(source: Artist | ParsedScore | ScoreV2, options?: PlayerOptions); /** Swap Artists and release the previous score and controls. */ setArtist(artist: Artist): void; /** Apply a new tempo to future attacks and keep the playhead at its current beat. */ setTempo(tempo: number): void; setInstrument(instrument: string | number): void; /** Reattach the Artist after a reset and invalidate any earlier play request. */ reset(): void; /** Remove the whole overlay on redraw or when the source disables playback. */ removeControls(): void; dispose(): void; /** One transport drives all registered part surfaces. The first hosts the controls. */ render(surface?: HTMLCanvasElement | SVGSVGElement, mark?: (id: string) => void, additional?: readonly (HTMLCanvasElement | SVGSVGElement)[]): void; /** Move the cursor using score coordinates, including reflowed SVG note positions. */ moveCursor(x: number, y: number): void; /** Start the selected instrument from the user's gesture. Failures are also shown on the controls. */ play(): Promise; private stopAnimations; /** Stop pending loads, sounding notes, and cursor updates for this player. */ stop(): void; }