/** * AudioMixer.ts * * Advanced channel-based audio mixer with dynamic mixing features: * - Channel-based volume control and mute groups * - Ducking (auto-lower music when dialogue plays) * - Sidechain compression * - Priority-based voice stealing * - Context-aware mixing */ export interface MixerChannel { name: string; volume: number; muted: boolean; priority: number; maxVoices: number; currentVoices: number; } export interface DuckingConfig { enabled: boolean; triggerChannel: string; targetChannels: string[]; threshold: number; ratio: number; attackTime: number; releaseTime: number; } export interface SidechainConfig { enabled: boolean; sourceChannel: string; targetChannel: string; threshold: number; ratio: number; attackTime: number; releaseTime: number; } export interface VoiceStealingStrategy { mode: 'oldest' | 'quietest' | 'lowest_priority'; } export interface AudioSource { id: string; channel: string; volume: number; priority: number; startTime: number; } export interface MixingContext { name: string; channelVolumes: Record; } export declare class AudioMixer { private channels; private masterVolume; private masterMuted; private duckingStates; private sidechains; private activeSources; private voiceStealingStrategy; private currentContext; constructor(); /** * Create or update a channel. */ createChannel(name: string, volume?: number, priority?: number, maxVoices?: number): void; /** * Set channel volume. */ setChannelVolume(name: string, volume: number): void; /** * Get channel volume. */ getChannelVolume(name: string): number; /** * Mute/unmute a channel. */ setChannelMuted(name: string, muted: boolean): void; /** * Check if a channel is muted. */ isChannelMuted(name: string): boolean; /** * Set master volume. */ setMasterVolume(volume: number): void; getMasterVolume(): number; /** * Mute/unmute all audio. */ setMasterMuted(muted: boolean): void; isMasterMuted(): boolean; /** * List all channels. */ getChannels(): MixerChannel[]; /** * Mute a group of channels. */ muteGroup(channelNames: string[]): void; /** * Unmute a group of channels. */ unmuteGroup(channelNames: string[]): void; /** * Configure ducking for a channel. * Example: Duck music and ambient when voice plays. */ configureDucking(config: DuckingConfig): void; /** * Remove ducking configuration. */ removeDucking(triggerChannel: string, targetChannels: string[]): void; /** * Update ducking state. Call every frame with delta time. */ updateDucking(delta: number): void; /** * Get ducking attenuation for a channel (0-1, where 0 = no attenuation, 1 = full duck). */ getDuckingAttenuation(channelName: string): number; /** * Check if a channel has active sources above a dB threshold. */ private isChannelActiveAboveThreshold; /** * Configure sidechain compression. * Example: Compress SFX when music peaks. */ configureSidechain(config: SidechainConfig): void; /** * Remove sidechain configuration. */ removeSidechain(sourceChannel: string, targetChannel: string): void; /** * Set voice stealing strategy. */ setVoiceStealingStrategy(strategy: VoiceStealingStrategy): void; /** * Register a new audio source. Returns true if allowed, false if stolen. */ registerSource(source: AudioSource): boolean; /** * Unregister an audio source. */ unregisterSource(sourceId: string): void; /** * Steal a voice from a channel based on strategy. * Returns the ID of the stolen source, or null if no voice could be stolen. */ private stealVoice; /** * Get active source count for a channel. */ getChannelVoiceCount(channelName: string): number; /** * Get all active sources for a channel. */ getChannelSources(channelName: string): AudioSource[]; /** * Set mixing context (e.g., 'combat', 'dialogue', 'ambient'). * Automatically adjusts channel volumes based on context. */ setMixingContext(context: MixingContext | null): void; /** * Get current mixing context. */ getMixingContext(): MixingContext | null; /** * Compute the effective volume for a source on a given channel. * Now includes ducking, sidechain, and context-aware adjustments. */ getEffectiveVolume(channelName: string, sourceVolume: number): number; } //# sourceMappingURL=AudioMixer.d.ts.map