wave-roll
Version:
JavaScript Library for Comparative MIDI Piano-Roll Visualization
100 lines • 3.37 kB
TypeScript
import { MultiMidiManager } from "@/lib/core/midi/multi-midi-manager";
import { SampleFileConfig, SampleAudioFileConfig } from "./types";
import { MidiInput } from "@/lib/midi/types";
import { FileLoadOptions } from "./types";
import { MidiFileEntry } from "@/lib/midi/types";
import { StateManager } from "@/core/state";
export declare class FileManager {
midiManager: MultiMidiManager;
isBatchLoading: boolean;
/** Lazy audio files registry lives under `window._waveRollAudio` to keep surface minimal */
stateManager?: StateManager;
constructor(midiManager: MultiMidiManager, stateManager?: StateManager);
/** Load default or custom sample files. */
loadSampleFiles(files?: SampleFileConfig[]): Promise<void>;
/** Load a single MIDI file (local File object or URL). */
loadFile(input: MidiInput, options?: FileLoadOptions): Promise<string | null>;
/** Load multiple local files at once. */
loadMultipleFiles(files: File[], options?: FileLoadOptions): Promise<string[]>;
/** Load a single audio file (wav/mp3) */
loadAudioFile(input: string | File, options?: FileLoadOptions & {
color?: number;
}): Promise<string | null>;
/** Load sample audio files */
loadSampleAudioFiles(files?: SampleAudioFileConfig[]): Promise<void>;
/**
* Get all files
* @returns Array of file entries
*/
getAllFiles(): MidiFileEntry[];
/**
* Get a specific file by ID
* @param fileId - ID of the file
* @returns File entry or null if not found
*/
getFile(fileId: string): MidiFileEntry | null;
/**
* Get visible files
* @returns Array of visible file entries
*/
getVisibleFiles(): MidiFileEntry[];
/**
* Get file count
* @returns Number of loaded files
*/
getFileCount(): number;
/**
* Get visible file count
* @returns Number of visible files
*/
getVisibleFileCount(): number;
/**
* Remove a file from the manager
* @param fileId - ID of the file to remove
*/
removeFile(fileId: string): void;
/**
* Toggle file visibility
* @param fileId - ID of the file to toggle
*/
toggleFileVisibility(fileId: string): void;
/**
* Set file visibility
* @param fileId - ID of the file
* @param isVisible - Whether the file should be visible
*/
setFileVisibility(fileId: string, isVisible: boolean): void;
/**
* Update file name
* @param fileId - ID of the file
* @param name - New name
*/
updateFileName(fileId: string, name: string): void;
/**
* Update file color
* @param fileId - ID of the file
* @param color - New color (PixiJS hex color)
*/
updateFileColor(fileId: string, color: number): void;
/**
* Check if currently in batch loading mode
* @returns Whether batch loading is active
*/
isBatchLoadingActive(): boolean;
/**
* Set batch loading mode
* @param isBatching - Whether to enable batch loading
*/
setBatchLoading(isBatching: boolean): void;
/**
* Clear all files
*/
clearAllFiles(): void;
/**
* Check if a file exists
* @param fileId - ID of the file to check
* @returns Whether the file exists
*/
hasFile(fileId: string): boolean;
}
//# sourceMappingURL=file-manager.d.ts.map