import { MidiFile } from "midifile-ts"; import type { TrackerBar } from "../systems/TrackerBar.js"; import { Version } from "../model/Version.js"; import { AnyPerformedRollFeature, EmulatedCurve, NegotiatedEvent, ReproducingSystem } from "../systems/ReproducingSystem.js"; import { Millimeters } from "../model/Quantity.js"; import { Edition } from "../model/Edition.js"; /** * Which part of a version `emulate` plays, and where its clock starts. * @category Systems and emulation */ export type EmulationScope = { /** Only notes whose onset lies within this span of the roll are played. */ range?: [Millimeters, Millimeters]; /** Start the clock at the first note rather than at the beginning of the roll. */ skipToFirstNote?: boolean; }; /** * The events moved to where their statements put them, the events given * left as they were. The edition supplies the copies, whose measurements * decide how far before or after its reference a command goes, and a * punch diameter, or a millimetre, where no copy agrees with a statement. * @category Systems and emulation */ export declare const withPlacementsApplied: (edition: Edition, events: readonly NegotiatedEvent[]) => NegotiatedEvent[]; /** * The commands of a version as the bar performs them, in order of place, * within the scope and with the placements applied. A note plays only * where its onset falls in the range; expressions play throughout. * @category Systems and emulation */ export declare const negotiatedEventsOf: (edition: Edition, version: Readonly, bar: TrackerBar, { range }?: Pick) => NegotiatedEvent[]; /** * A version performed: what was negotiated, and what the system made of it. * @category Systems and emulation */ export interface Emulated { /** The id of the version performed. */ readonly source: string; readonly negotiated: readonly NegotiatedEvent[]; /** The performed events in order of time, from the origin the scope sets. */ readonly events: readonly AnyPerformedRollFeature[]; readonly curves: readonly EmulatedCurve[]; } /** * Performs a version on a reproducing system: the symbols are negotiated * into placed events and the system plays them. Nothing given is changed. * @category Systems and emulation */ export declare const emulate: (system: ReproducingSystem, version: Readonly, edition: Edition, options?: Options, { range, skipToFirstNote }?: EmulationScope) => Emulated; /** * The performed events as a MIDI file, in which every note and pedal step * is labelled with the symbol it performs. The file names the system, the * version and the options it was played with. * @category Systems and emulation */ export declare const midiOf: (events: readonly AnyPerformedRollFeature[], systemName: string, options: object, source?: string) => MidiFile; /** * A version of the edition, performed and kept: `emulate` and `midiOf` * with the result held on the object between the two calls. Prefer the * functions where nothing needs holding. * @category Systems and emulation */ export declare class Emulation { readonly system: ReproducingSystem; options: Options; midiEvents: AnyPerformedRollFeature[]; negotiatedEvents: NegotiatedEvent[]; curves: readonly EmulatedCurve[]; source?: string; constructor(system: ReproducingSystem, options?: Options); /** Moves the negotiated events to where their statements put them; see `withPlacementsApplied`. */ applyConstraints(edition: Edition): void; /** Performs the version, keeps what came of it, and returns the performed events; see `emulate`. */ emulateVersion(version: Version, edition: Edition, scope?: EmulationScope): AnyPerformedRollFeature[]; /** The performed events that sound or follow from the symbol with the id. */ findEventsPerforming(id: string): AnyPerformedRollFeature[]; /** The performed events as a MIDI file; see `midiOf`. */ asMIDI(): MidiFile; }