#pragma once

#include "buffer.h"

class DelayLine {
  BufferF32 delayBuffer;
  int writeIndex;

public:
  DelayLine(int channelCount, int delayFrames);
  ~DelayLine();

  // Return buf with delayFrames of delay added at the start
  void pushpull(BufferF32 buf);
  void copyPlaybackState(const DelayLine &other);
  void zero();
  void read(float *out, int channel, int readIndexOffset, int frames) const;

  // temporary
  float peakUpTo(int channel, int writeIndexOffset, int frames);
};