constructor()

in src/lib/pi.ts [91:109]


  constructor(pi?: Pi, config: Partial<PiStreamConfig> = {}) {
    const DEFAULT_STREAM_BUFFER_SIZE = 2;
    const DEFAULT_STREAM_CHUNK_SIZE = 100;
    const DEFAULT_DELAY_MS = 1000;
    const DEFAULT_START = 0;

    this.config = {
      streamBufferSize: config.streamBufferSize ?? DEFAULT_STREAM_BUFFER_SIZE,
      streamChunkSize: config.streamChunkSize ?? DEFAULT_STREAM_CHUNK_SIZE,
      delayMs: config.delayMs ?? DEFAULT_DELAY_MS,
      start: config.start ?? DEFAULT_START,
    };

    this.#pi = pi ?? new Pi();
    this.#off = this.config.start;
    this.#bufBase = this.#off;
    this.#buffer = new Array<Chunk>(this.config.streamBufferSize);
    this.#delayMs = this.config.delayMs;
  }