UNPKG

wave-roll

Version:

JavaScript Library for Comparative MIDI Piano-Roll Visualization

119 lines 3.46 kB
import { NoteData, ParsedMidi } from "@/lib/midi/types"; import { ColorPalette, MultiMidiState } from "./types"; /** * Manages multiple MIDI files with visualization */ export declare class MultiMidiManager { private state; private colorIndex; private onStateChange?; /** Multiple subscribers for UI components */ private listeners; constructor(); /** * Set state change callback */ setOnStateChange(callback: (state: MultiMidiState) => void): void; /** * Subscribe to state changes. Returns an unsubscribe function. */ subscribe(cb: (state: MultiMidiState) => void): () => void; /** * Get current state */ getState(): MultiMidiState; /** * Get active palette */ private getActivePalette; /** * Get next color from active palette */ private getNextColor; /** * Reset color index to match current file count */ private resetColorIndex; /** * Add a MIDI file */ addMidiFile(fileName: string, parsedData: ParsedMidi, displayName?: string, originalInput?: File | string): string; /** * Remove a MIDI file */ removeMidiFile(id: string): void; /** * Toggle visibility of a MIDI file */ toggleVisibility(id: string): void; /** * Toggle mute state of a MIDI file (audio only) */ toggleMute(id: string): void; /** * Update name */ updateName(id: string, name: string): void; /** * Update file color */ updateColor(id: string, color: number): void; /** * Reorder files within the state array. * @param sourceIndex - The current index of the file. * @param targetIndex - The desired index after the move. */ reorderFiles(sourceIndex: number, targetIndex: number): void; /** * Set active palette */ setActivePalette(paletteId: string): void; /** * Add custom palette */ addCustomPalette(palette: ColorPalette): void; /** * Update an existing custom palette. Only applicable to user-defined palettes. * If the palette is currently active, note that colors of existing files will be reassigned. * @param id Palette identifier * @param patch Partial properties to update (name and/or colors) */ updateCustomPalette(id: string, patch: Partial<Omit<ColorPalette, "id">>): void; /** * Remove a user-defined custom palette. * If the palette is active, fall back to another palette and reassign colors. */ removeCustomPalette(id: string): void; /** * Get combined notes from visible files */ getVisibleNotes(): Array<{ note: NoteData; color: number; fileId: string; }>; /** * Get total duration across all visible files */ getTotalDuration(): number; /** * Clear all files */ clearAll(): void; /** * Notify state change */ private notifyStateChange; /** * Toggle sustain overlay visibility of a MIDI file (visualisation only) */ toggleSustainVisibility(id: string): void; /** * Reparse all MIDI files with new settings (e.g., pedal elongate) */ reparseAllFiles(options?: { applyPedalElongate?: boolean; pedalThreshold?: number; }, onProgress?: (current: number, total: number) => void): Promise<void>; } //# sourceMappingURL=multi-midi-manager.d.ts.map