/**
 * TempoEventBus - Event bus for MIDI tempo synchronization
 *
 * Implements the Late Subscriber pattern to solve race conditions where
 * VisualizationEngine may subscribe after MultiMidiManager has already
 * emitted the tempo event.
 *
 * Supports two types of tempo events:
 * 1. Regular tempo events (emit) - notifies subscribers of tempo changes
 * 2. Baseline reset events (emitBaselineReset) - resets the baseline/original
 *    tempo when the "top file" changes (e.g., file deletion, reordering)
 */
/** Callback type for tempo event subscribers */
type TempoEventCallback = (tempo: number, fileId: string) => void;
/** Callback type for baseline reset subscribers */
type BaselineResetCallback = (tempo: number, fileId: string) => void;
/**
 * Event bus for broadcasting MIDI tempo changes across components.
 * Supports late subscribers by storing the last emitted value.
 */
declare class TempoEventBus {
    private listeners;
    private baselineListeners;
    private lastTempo;
    private lastFileId;
    /** Stores the baseline tempo (top file's BPM) */
    private baselineTempo;
    private baselineFileId;
    /**
     * Emit a tempo event to all subscribers.
     * Always stores the latest value for late subscribers.
     *
     * @param tempo - The tempo in BPM extracted from MIDI header
     * @param fileId - The ID of the MIDI file
     */
    emit(tempo: number, fileId: string): void;
    /**
     * Subscribe to tempo events.
     * If a tempo has already been emitted, the callback is invoked immediately
     * with the stored value (late subscriber pattern).
     *
     * @param cb - Callback function to invoke on tempo events
     * @returns Unsubscribe function to remove the listener
     */
    subscribe(cb: TempoEventCallback): () => void;
    /**
     * Get the last emitted tempo value.
     * @returns The last tempo or null if none emitted yet
     */
    getLastTempo(): number | null;
    /**
     * Emit a baseline reset event.
     * This is used when the "top file" (first file in the list) changes,
     * such as when a file is deleted or files are reordered.
     * Subscribers should update their originalTempo to this new baseline.
     *
     * @param tempo - The new baseline tempo in BPM
     * @param fileId - The ID of the new top file
     */
    emitBaselineReset(tempo: number, fileId: string): void;
    /**
     * Subscribe to baseline reset events.
     * These events are emitted when the top file changes and the baseline
     * tempo should be updated (e.g., for originalTempo in VisualizationEngine).
     *
     * @param cb - Callback function to invoke on baseline reset
     * @returns Unsubscribe function to remove the listener
     */
    subscribeBaseline(cb: BaselineResetCallback): () => void;
    /**
     * Get the baseline tempo value.
     * @returns The baseline tempo or null if none set
     */
    getBaselineTempo(): number | null;
    /**
     * Reset the event bus state.
     * Useful for testing or when clearing all MIDI files.
     */
    reset(): void;
}
/** Singleton instance of the tempo event bus */
export declare const tempoEventBus: TempoEventBus;
export {};
//# sourceMappingURL=tempo-event-bus.d.ts.map