foo-webview-sdk
    Preparing search index...

    Class PcmRingReaderExperimental

    Pull the frames written since the previous read from one ring buffer.

    Construct one reader per buffer (a new epoch comes with a new buffer). Reading starts at frame 0 of the buffer, so the first read also returns what was written before the page received it, up to the capacity.

    Index
    • Experimental

      Parameters

      • buffer: ArrayBuffer

        Ring buffer from sharedbufferreceived.

      • loadSeq: SeqLoader = atomicSeq

        Replaces Atomics.load for the seqlock counter; meant for tests.

      Returns PcmRingReader

      PcmHeaderError when the buffer is not a ring buffer of a version this reader supports.

    capacityFrames: number

    Frames the ring holds.

    channels: number

    Number of audio channels in each frame (e.g. 2 for stereo).

    epoch: number

    Generation of this buffer; a format change arrives as a new buffer with a higher epoch.

    sampleRate: number

    Samples per second per channel.

    • get ended(): boolean
      Experimental

      true once the host has stopped writing (unsubscribed, format change, page gone or host exit).

      Returns boolean

    • Experimental

      Copy out the frames written since the previous call, de-interleaved.

      Returns null when nothing new was written, or when the host kept writing during all three attempts; in that case nothing is consumed and the next call tries again. Each retry halves the window and keeps only the newest frames, so a slow copy of a large backlog still completes; the frames given up that way count in dropped.

      Returns PcmRingRead | null