import { IMediaInstance as IMediaInstance$1, PlayOptions, Options, SoundLibrary, Sound, filters as filters$1 } from '@pixi/sound';

type IMediaInstance = Omit<IMediaInstance$1, "on" | "destroy" | "init" | "off" | "once" | "toString">;

interface SoundOptions extends Omit<Options, "complete" | "loaded" | "sprites" | "source"> {
}
interface SoundPlayOptions extends Omit<PlayOptions, "complete" | "loaded"> {
    /**
     * The delay in seconds before playback becomes audible or resumes. If specified, the sound will be started immediately but delayed (for example, via pause/unpause) so that it is effectively heard only after the delay. If not specified, the sound will play without any additional delay.
     */
    delay?: number;
    /**
     * Whether the sound is paused. If specified, the sound will be paused or unpaused according to the value. If not specified, the sound will play without being paused or unpaused.
     */
    paused?: boolean;
}
interface SoundPlayOptionsWithChannel extends SoundPlayOptions {
    /**
     * The alias of the audio channel to play the sound on. If the channel does not exist, it will be created.
     * If not specified, the sound will be played on the default channel (see `SoundManagerInterface.defaultChannelAlias`).
     */
    channel?: string;
}
interface ChannelOptions extends Pick<SoundPlayOptions, "filters" | "muted" | "volume" | "paused"> {
    /**
     * Whether this channel is a background channel.
     * Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
     */
    background?: boolean;
}

interface AudioChannelInterface {
    /**
     * The alias of the audio channel. This is used to reference the channel when playing sounds. The alias must be unique among all channels.
     */
    readonly alias: string;
    /**
     * Plays a sound.
     * @param alias The media and sound (asset) alias reference.
     * @param options The options
     * @return The sound instance,
     *        this cannot be reused after it is done playing. Returns a Promise if the sound
     *        has not yet loaded.
     */
    play(alias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
    /**
     * Plays a sound.
     * @param mediaAlias The media alias reference.
     * @param soundAlias The sound (asset) alias reference.
     * @param options The options
     * @return The sound instance,
     *        this cannot be reused after it is done playing. Returns a Promise if the sound
     *        has not yet loaded.
     */
    play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
    /**
     * Plays a non-persistent sound on this channel.
     * The returned media is not tracked by the sound manager and is therefore excluded from save/export state.
     * @param soundAlias The sound (asset) alias reference.
     * @param options The options.
     * @return The sound instance.
     */
    playTransient(soundAlias: string, options?: SoundPlayOptions): Promise<IMediaInstance>;
    /**
     * Stops all media instances that were started with {@link playTransient} on this channel.
     * Instances that have already ended are automatically removed, so this only affects
     * those that are still playing or paused.
     * @return Instance for chaining.
     */
    stopTransientAll(): this;
    /**
     * The volume of the audio channel, between 0 and 1. This is multiplied with the volume of each sound played through this channel.
     */
    volume: number;
    /**
     * Whether the audio channel is muted. This is combined with the muted state of each sound played through this channel.
     */
    muted: boolean;
    /**
     * The MediaInstances currently playing through this channel. This is read-only and cannot be modified directly. Use the play method to add new MediaInstances to this channel.
     */
    readonly mediaInstances: IMediaInstance[];
    /**
     * Whether this channel is a background channel.
     * Background channels are special channels. Unlike normal channels, media connected to a background channel does not stop when a scene changes, but continues to play in the background.
     */
    readonly background: boolean;
    /**
     * Stops all media currently playing through this channel.
     * @return Instance for chaining.
     */
    stopAll(): this;
    /**
     * Pauses any playing sounds.
     * @return Instance for chaining.
     */
    pauseAll(): this;
    /**
     * Temporarily pauses this channel without mutating each media instance's persisted paused option.
     * Useful for overlays (for example settings/pause menus) where pause state must not be saved.
     * @return Instance for chaining.
     */
    pauseUnsavedAll(): this;
    /**
     * Restores this channel after `pauseUnsavedAll()`, reapplying each media instance's persisted paused option.
     * @return Instance for chaining.
     */
    resumeUnsavedAll(): this;
    /**
     * Resumes any sounds.
     * @return Instance for chaining.
     */
    resumeAll(): this;
    /**
     * Toggle muted property for all sounds.
     * @return `true` if all sounds are muted.
     */
    toggleMuteAll(): boolean;
}

type DistortionFilter = {
    type: "DistortionFilter";
    amount?: number;
};
type EqualizerFilter = {
    type: "EqualizerFilter";
    f32?: number;
    f64?: number;
    f125?: number;
    f250?: number;
    f500?: number;
    f1k?: number;
    f2k?: number;
    f4k?: number;
    f8k?: number;
    f16k?: number;
};
type MonoFilter = {
    type: "MonoFilter";
};
type ReverbFilter = {
    type: "ReverbFilter";
    seconds?: number;
    decay?: number;
    reverse?: boolean;
};
type StereoFilter = {
    type: "StereoFilter";
    pan?: number;
};
type StreamFilter = {
    type: "StreamFilter";
};
type TelephoneFilter = {
    type: "TelephoneFilter";
};
type SoundFilterMemory = DistortionFilter | EqualizerFilter | MonoFilter | ReverbFilter | StereoFilter | StreamFilter | TelephoneFilter;

interface ExportedSound {
    options: SoundOptions;
    filters?: SoundFilterMemory[];
}
interface SoundPlay {
    stepIndex: number;
    paused: boolean;
    options?: SoundPlayOptions | string;
}
interface ExportedSoundPlay extends SoundPlay {
    sound: ExportedSound;
}
/**
 * Interface exported sounds
 */
interface SoundGameState {
    filters?: SoundFilterMemory[];
    /**
     * @deprecated
     */
    soundsPlaying?: {
        [key: string]: ExportedSoundPlay;
    };
    mediaInstances: {
        [key: string]: {
            channelAlias: string;
            soundAlias: string;
            stepCounter: number;
            options: Omit<SoundPlayOptions, "filters"> & {
                filters?: SoundFilterMemory[];
            };
            /**
             * @deprecated Use options.paused instead.
             */
            paused?: boolean;
        };
    };
}

interface SoundManagerInterface extends Omit<SoundLibrary, "init" | "close" | "add" | "play" | "volume" | "speed" | "remove" | "exists" | "find" | "stop" | "pause" | "resume" | "pauseAll" | "resumeAll" | "muteAll" | "unmuteAll" | "stopAll" | "removeAll" | "togglePauseAll"> {
    /**
     * @deprecated You can define sound assets directly in `PIXI.Assets`
     */
    add(alias: string, options: string): Sound;
    /**
     * Plays a sound.
     * @param alias The media and sound (asset) alias reference.
     * @param options The options
     * @return The sound instance,
     *        this cannot be reused after it is done playing. Returns a Promise if the sound
     *        has not yet loaded.
     */
    play(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
    play(mediaAlias: string, soundAlias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
    /**
     * Plays a non-persistent sound (for example UI/menu sounds).
     * This playback is not tracked in save/export state.
     * @param alias The sound (asset) alias reference.
     * @param options The options.
     * @return The sound instance.
     */
    playTransient(alias: string, options?: SoundPlayOptionsWithChannel): Promise<IMediaInstance>;
    /**
     * Stops all transient media instances started with {@link playTransient}.
     * If `channel` is provided only instances on that channel are stopped;
     * otherwise all channels are affected.
     * @param channel Optional channel alias to limit the operation to.
     * @return Instance for chaining.
     */
    stopTransientAll(channel?: string): this;
    /**
     * Find a media by alias.
     * @param alias - The media alias reference.
     * @return Media object.
     */
    find(alias: string): IMediaInstance | undefined;
    /**
     * Stops a media and removes it from the manager.
     * @param alias - The media alias reference.
     */
    stop(alias: string): void;
    /**
     * Pauses a media.
     * @param alias - The media alias reference.
     * @return Media object.
     */
    pause(alias: string): IMediaInstance | undefined;
    /**
     * Resumes a media.
     * @param alias - The media alias reference.
     * @return Media object.
     */
    resume(alias: string): IMediaInstance | undefined;
    /**
     * Edits the options of an existing sound (asset).
     * If the asset is not yet loaded, it will be loaded with the new options.
     */
    edit(alias: string, options: SoundOptions): Promise<void>;
    /**
     * Pauses any playing sounds.
     * @return Instance for chaining.
     */
    pauseAll(): this;
    /**
     * Resumes any sounds.
     * @return Instance for chaining.
     */
    resumeAll(): this;
    /**
     * Temporarily pauses all sounds across all channels (or just the given channel) without
     * mutating each media instance's persisted paused option.
     * Useful for overlays (for example settings/pause menus) where pause state must not be saved.
     * @param channel Optional channel alias to limit the operation to.
     * @return Instance for chaining.
     */
    pauseUnsavedAll(channel?: string): this;
    /**
     * Restores all channels (or just the given channel) after `pauseUnsavedAll()`,
     * reapplying each media instance's persisted paused option.
     * @param channel Optional channel alias to limit the operation to.
     * @return Instance for chaining.
     */
    resumeUnsavedAll(channel?: string): this;
    /**
     * Mutes all playing sounds.
     * @return Instance for chaining.
     */
    muteAll(): this;
    /**
     * Unmutes all playing sounds.
     * @return Instance for chaining.
     */
    unmuteAll(): this;
    /**
     * Stops all sounds.
     * @return Instance for chaining.
     */
    stopAll(): this;
    load(alias: string | string[]): Promise<Sound[]>;
    backgroundLoad(alias: string | string[]): Promise<void>;
    backgroundLoadBundle(alias: string): Promise<void>;
    clear(): void;
    /**
     * Adds a new audio channel with the specified alias(es).
     * @param alias The alias or aliases for the new channel.
     * @returns The created AudioChannelInterface instance, or undefined if a channel with the alias already exists.
     */
    addChannel(alias: string | string[], options?: ChannelOptions): AudioChannelInterface | undefined;
    /**
     * Finds and returns the audio channel associated with the given alias. If the channel does not exist, it will be created.
     * @param alias The alias of the audio channel to find.
     * @returns The AudioChannelInterface instance associated with the alias.
     */
    findChannel(alias: string): AudioChannelInterface;
    /**
     * Returns an array of all existing audio channels.
     */
    readonly channels: AudioChannelInterface[];
    /**
     * The default channel alias to use when playing a sound without specifying a channel.
     * By default, this is set to `GENERAL_CHANNEL` ("general"), but it can be changed to any string; if the channel does not yet exist, it will be created on demand when used.
     */
    defaultChannelAlias: string;
    export(): SoundGameState;
    restore(data: object): Promise<void>;
}

declare const filters: {
    DistortionFilter: typeof filters$1.DistortionFilter;
    EqualizerFilter: typeof filters$1.EqualizerFilter;
    MonoFilter: typeof filters$1.MonoFilter;
    ReverbFilter: typeof filters$1.ReverbFilter;
    StereoFilter: typeof filters$1.StereoFilter;
    StreamFilter: typeof filters$1.StreamFilter;
    TelephoneFilter: typeof filters$1.TelephoneFilter;
};

declare class SoundManagerStatic {
    private constructor();
    static mediaInstances: Map<string, {
        channelAlias: string;
        soundAlias: string;
        instance: IMediaInstance;
        stepCounter: number;
        options: SoundPlayOptions;
    }>;
    static readonly channels: Map<string, AudioChannelInterface>;
    static delayTimeoutInstances: [number | NodeJS.Timeout, string][];
}

declare const sound: SoundManagerInterface;

export { type AudioChannelInterface, type ChannelOptions, type ExportedSound, type ExportedSoundPlay, type IMediaInstance, type SoundFilterMemory, type SoundGameState, SoundManagerStatic, type SoundOptions, type SoundPlay, type SoundPlayOptions, type SoundPlayOptionsWithChannel, filters, sound };
