like2d
    Preparing search index...

    Interface AudioSource

    Handle to a loaded audio resource, which pretends to be synchronous. Use play(), stop(), pause(), resume() for playback control. Access the underlying HTMLAudioElement via source.audio for looping, pitch, etc. Note: Use source.setVolume() instead of setting source.audio.volume directly to ensure global volume scaling works correctly.

    interface AudioSource {
        audio: HTMLAudioElement;
        options: Required<AudioSourceOptions>;
        path: string;
        ready: Promise<void>;
        getDuration(): number;
        getVolume(): number;
        isPaused(): boolean;
        isPlaying(): boolean;
        isReady(): boolean;
        isStopped(): boolean;
        pause(): void;
        play(): void;
        resume(): void;
        seek(position: number): void;
        setVolume(volume: number): void;
        stop(): void;
        tell(): number;
    }
    Index

    Methods

    • Parameters

      • position: number

      Returns void

    • Set volume (0-1). Applies global volume scaling. Prefer this over source.audio.volume.

      Parameters

      • volume: number

      Returns void

    Properties

    audio: HTMLAudioElement

    Underlying HTMLAudioElement. Modify directly for looping, pitch, etc. Use methods for playback control. Avoid setting volume directly.

    options: Required<AudioSourceOptions>

    Avoid setting these directly.

    path: string
    ready: Promise<void>

    Resolves when the audio is loaded and ready to play.