//
//  CircularBuffer.hpp
//  SwitchboardAudioEffects
//
//  Created by Balázs Kiss on 2022. 10. 30..
//

#pragma once

namespace switchboard::audio {

struct CircularBuffer {
public:
    const int size;
    float* buffer;
    int readPointer;
    int writePointer;

    CircularBuffer(int size);

    void setReadPointer(int value);

    void setWritePointer(int value);

    void stepReadPointer(int numberOfSteps = 1);

    void stepWritePointer(int numberOfSteps = 1);

    float readSample();

    float readSample(int index);

    void writeSample(float value);

    float interpolate(float index);

    int getFillLevel();

    void reset();
};

};
