mwg API
    Preparing search index...

    Interface BlockSource

    Audio that is produced as it is played instead of decoded up front: a tracker, a chip player, a synthesiser. The consumer pulls frames in order; it can also ask for a different position, which a stateful source answers by skipping or rewinding as it can.

    interface BlockSource {
        length?: number;
        sampleRate: number;
        read(
            left: Float32Array,
            right: Float32Array,
            start: number,
            count: number,
        ): number;
        seek(frame: number): void;
    }

    Implemented by

    Index
    length?: number

    total frames, or undefined for a source with no end (a chip tune that never finishes)

    sampleRate: number
    • writes up to count frames at start of both buffers and returns how many it wrote; fewer than asked means the source ended

      Parameters

      • left: Float32Array
      • right: Float32Array
      • start: number
      • count: number

      Returns number

    • makes the next read return frames from this position

      Parameters

      • frame: number

      Returns void