//
//  LFO.hpp
//  SwitchboardAudioEffects
//
//  Created by Balázs Kiss on 2022. 11. 04..
//

#pragma once

#include <atomic>
#include <cmath>

namespace switchboard::audio {

class LFO {
public:
    LFO();

    float getFrequency();

    void setFrequency(float newValue);

    float getAmplitude();

    void setAmplitude(float newValue);

    float getOffset();

    void setOffset(float newValue);

    float getPhaseOffset();

    void setPhaseOffset(float newValue);

    float process(int sampleRate);

private:
    std::atomic<float> frequency;
    std::atomic<float> amplitude;
    std::atomic<float> offset;
    std::atomic<float> phaseOffset;
    float phase;
    int lastSampleRate;
    float inverseSampleRate;
};

}
