import { EventBus } from '../core/EventBus';
import React from 'react';
export type AudioBusType = 'master' | 'music' | 'sfx' | 'voice' | 'ambient' | 'ui';
export type SpatialModel = 'none' | '2d-panning' | '3d-hrtf' | '3d-equal-power';
export type AudioPoolStrategy = 'round-robin' | 'steal-oldest' | 'steal-quietest' | 'reject';
export interface AudioBusConfig {
    type: AudioBusType;
    volume: number;
    muted: boolean;
    effects: AudioEffectNode[];
}
export interface AudioEffectNode {
    type: 'reverb' | 'delay' | 'distortion' | 'compressor' | 'eq' | 'lowpass' | 'highpass';
    enabled: boolean;
    params: Record<string, number>;
}
export interface SpatialAudioConfig {
    model: SpatialModel;
    maxDistance: number;
    refDistance: number;
    rolloffFactor: number;
    coneInnerAngle: number;
    coneOuterAngle: number;
    coneOuterGain: number;
}
export declare const DEFAULT_SPATIAL: SpatialAudioConfig;
export interface AudioPoolConfig {
    id: string;
    src: string;
    maxInstances: number;
    strategy: AudioPoolStrategy;
    bus: AudioBusType;
    spatial?: SpatialAudioConfig;
    cooldownMs?: number;
}
export interface GameAudioEvent {
    type: 'play' | 'stop' | 'pause' | 'resume' | 'fade' | 'crossfade' | 'set-bus-volume';
    sourceId?: string;
    bus?: AudioBusType;
    volume?: number;
    fadeDuration?: number;
    position?: {
        x: number;
        y: number;
        z?: number;
    };
}
export interface MusicTrack {
    id: string;
    src: string;
    bpm?: number;
    loopStart?: number;
    loopEnd?: number;
    tags: string[];
}
export interface MusicCrossfadeConfig {
    fromTrackId: string | null;
    toTrackId: string;
    duration: number;
    curve: 'linear' | 'equal-power' | 'ease-in' | 'ease-out';
}
export interface AdaptiveAudioRule {
    id: string;
    /** Game event that triggers this rule */
    triggerEvent: string;
    /** Action to take */
    action: 'switch-track' | 'add-layer' | 'remove-layer' | 'set-intensity' | 'play-stinger';
    targetTrackId?: string;
    layerId?: string;
    intensity?: number;
    fadeDuration?: number;
    stingerSrc?: string;
    priority: number;
}
export interface AudioSnapshot {
    timestamp: number;
    busVolumes: Record<AudioBusType, number>;
    activeSounds: {
        id: string;
        src: string;
        bus: AudioBusType;
        volume: number;
        playing: boolean;
    }[];
    currentMusicTrack: string | null;
    musicPosition: number;
}
export declare class AudioBusMixer {
    private buses;
    private eventBus;
    constructor(eventBus: EventBus);
    getBus(type: AudioBusType): AudioBusConfig | undefined;
    setVolume(type: AudioBusType, volume: number): void;
    setMuted(type: AudioBusType, muted: boolean): void;
    /** Get effective volume considering master and mute */
    getEffectiveVolume(type: AudioBusType): number;
    addEffect(type: AudioBusType, effect: AudioEffectNode): void;
    removeEffect(type: AudioBusType, effectType: AudioEffectNode['type']): void;
    getAllBuses(): ReadonlyMap<AudioBusType, AudioBusConfig>;
    snapshot(): Record<AudioBusType, number>;
}
export declare class SFXPool {
    private config;
    private sounds;
    private nextId;
    private lastPlayedAt;
    constructor(config: AudioPoolConfig);
    play(volume?: number, position?: {
        x: number;
        y: number;
        z?: number;
    }): number | null;
    stop(id: number): void;
    stopAll(): void;
    getActiveCount(): number;
    getConfig(): Readonly<AudioPoolConfig>;
}
export declare class MusicManager {
    private tracks;
    private currentTrackId;
    private adaptiveRules;
    private eventBus;
    private intensity;
    constructor(eventBus: EventBus);
    registerTrack(track: MusicTrack): void;
    unregisterTrack(id: string): void;
    getTrack(id: string): MusicTrack | undefined;
    getCurrentTrackId(): string | null;
    /** Start playing or crossfade to a new track */
    play(trackId: string, crossfadeDuration?: number): MusicCrossfadeConfig | null;
    stop(fadeOutMs?: number): void;
    /** Adaptive audio rules — respond to game events */
    addRule(rule: AdaptiveAudioRule): void;
    removeRule(id: string): void;
    /** Process a game event and apply matching adaptive rules */
    processGameEvent(eventName: string): AdaptiveAudioRule | null;
    getIntensity(): number;
    setIntensity(value: number): void;
    getRules(): readonly AdaptiveAudioRule[];
    getAllTracks(): MusicTrack[];
    /** Find tracks matching tags */
    findByTags(tags: string[]): MusicTrack[];
}
/** Main bridge class connecting @nice2dev/ui-audio features to the game engine */
export declare class GameAudioBridge {
    readonly mixer: AudioBusMixer;
    readonly music: MusicManager;
    private pools;
    private eventBus;
    private paused;
    private snapshot;
    constructor(eventBus: EventBus);
    private setupGameStateHandlers;
    /** Register an SFX pool for frequent sounds */
    registerPool(config: AudioPoolConfig): void;
    /** Play a pooled SFX */
    playSFX(poolId: string, volume?: number, position?: {
        x: number;
        y: number;
        z?: number;
    }): number | null;
    /** Stop a pooled SFX instance */
    stopSFX(poolId: string, instanceId: number): void;
    /** Pause all audio (game menu, alt-tab, etc.) */
    pauseAll(): void;
    /** Resume all audio */
    resumeAll(): void;
    isPaused(): boolean;
    /** Create a snapshot of current audio state for save/restore */
    createSnapshot(): AudioSnapshot;
    /** Restore audio from a snapshot */
    restoreSnapshot(snap: AudioSnapshot): void;
    /** Process a game audio event */
    processEvent(event: GameAudioEvent): void;
    getPool(id: string): SFXPool | undefined;
    getAllPools(): Map<string, SFXPool>;
    destroy(): void;
}
export declare function useGameAudio(eventBus: EventBus): {
    bridge: GameAudioBridge;
    playSFX: (poolId: string, volume?: number, position?: {
        x: number;
        y: number;
        z?: number;
    }) => number | null;
    playMusic: (trackId: string, crossfadeDuration?: number) => MusicCrossfadeConfig | null;
    stopMusic: (fadeOutMs?: number) => void;
    setVolume: (bus: AudioBusType, volume: number) => void;
    pauseAll: () => void;
    resumeAll: () => void;
    registerPool: (config: AudioPoolConfig) => void;
    registerTrack: (track: MusicTrack) => void;
};
export interface GameAudioSettingsProps {
    bridge: GameAudioBridge;
    className?: string;
    style?: React.CSSProperties;
}
export declare const GameAudioSettings: React.FC<GameAudioSettingsProps>;
