import { SoundToken } from "./soundToken"; import { ChannelOptions, PlayOptions, CachedAudio, IChannel, IAudioProvider } from "./types"; /** * Channel manages a group of audio sources and sub-channels. * Channels can be nested to create a tree structure with cascading volume control. */ export declare class Channel implements IChannel { private readonly name; private readonly options; private readonly subChannels; private readonly tokens; private readonly tokenQueue; private readonly audioProvider; private readonly parentChannel; private volume; private muted; private removed; private gainNode; constructor(name: string, audioProvider: IAudioProvider, options?: ChannelOptions, parentChannel?: Channel | null); /** * Connect this channel's gain node to the parent's output. */ private connectToParent; /** * Get the gain node for this channel. * Used by child channels and tokens to connect to this channel. */ getGainNode(): GainNode; /** * Ensure the channel is not removed before performing operations. */ private ensureNotRemoved; /** * Get the name of this channel. */ getName(): string; /** * Play a sound through this channel. * @param source - The path to the audio file or a CachedAudio instance. * @param options - Optional play options. */ play(source: string | CachedAudio, options?: PlayOptions): Promise; /** * Create a sub-channel under this channel. * @param name - The name of the sub-channel. * @param options - Optional channel options. */ createChannel(name: string, options?: ChannelOptions): Channel; /** * Get a sub-channel by name. * @param name - The name of the sub-channel. */ getChannel(name: string): Channel | null; /** * Get all direct sub-channels of this channel. */ getChannels(): Channel[]; /** * Set the volume of this channel. * @param volume - The volume value between 0 and 1. */ setVolume(volume: number): this; /** * Get the current volume of this channel. */ getVolume(): number; /** * Mute or unmute this channel. * @param muted - Whether to mute the channel. Defaults to true if not provided. */ mute(): this; mute(muted: boolean): this; /** * Unmute this channel. */ unmute(): this; /** * Check if this channel is muted. */ isMuted(): boolean; /** * Remove this channel and all its sub-channels. * All tokens will be stopped immediately. */ remove(): this; /** * Remove a sub-channel from this channel's map. * @internal */ private removeSubChannel; /** * Get all tokens managed by this channel and its sub-channels. */ getTokens(): SoundToken[]; /** * Check if this channel has been removed. */ isRemoved(): boolean; /** * Get the parent channel, if any. */ getParent(): Channel | null; /** * Get the options for this channel. */ getOptions(): Required; }