declare module '@pixi/sound'
{
    export interface SoundSpriteDefinition
    {
        start: number;
        end: number;
        loop?: boolean;
        speed?: number;
        group?: string;
        volume?: number;
        singleInstance?: boolean;
    }

    export interface SoundAsset
    {
        isPlaying?: boolean;
        group?: string;
        loop?: boolean;
        singleInstance?: boolean;
        volume?: number;
        media: {
            nodes: {
                gain: GainNode;
            };
        };
        _sprites: Record<string, SoundSpriteDefinition>;
    }

    export interface PlayOptions
    {
        complete?: () => void;
        sprite?: string;
        loop?: boolean;
        volume?: number;
        singleInstance?: boolean;
        singleInstanceDuration?: number;
        [key: string]: unknown;
    }

    export interface IMediaInstance
    {
        stop(): void;
        pause?(): void;
        resume?(): void;
        volume: number;
    }

    export interface SoundContext
    {
        audioContext: AudioContext;
        destination: AudioNode;
    }

    export interface PixiSound
    {
        context: SoundContext;
        disableAutoPause: boolean;
        play(alias: string, options?: PlayOptions): IMediaInstance;
        stop(alias: string): void;
        stopAll(): void;
        muteAll(): void;
        unmuteAll?(): void;
        pauseAll(): void;
        resumeAll(): void;
        find(alias: string): SoundAsset | undefined;
        add?(alias: string, source: unknown, options?: Record<string, unknown>): SoundAsset | undefined;
        volume(alias: string, value?: number): number;
        _sounds: Record<string, SoundAsset>;
    }

    export const sound: PixiSound;
}
