Skip to content

File jitter.h

File List > DaisySP > DaisySP-LGPL > Source > Utility > jitter.h

Go to the documentation of this file

Source Code

/*
Copyright (c) 2023 Electrosmith, Corp, Paul Batchelor, Gabriel Maldonado

Use of this source code is governed by the LGPL V2.1
license that can be found in the LICENSE file or at
https://opensource.org/license/lgpl-2-1/
*/

#pragma once
#ifndef DAISY_JITTER
#define DAISY_JITTER

namespace daisysp
{
class Jitter
{
  public:
    Jitter() {}
    ~Jitter() {}

    void Init(float sample_rate);

    float Process();

    void SetCpsMin(float cps_min);

    void SetCpsMax(float cps_max);

    void SetAmp(float amp);

  private:
    float   amp_, cps_min_, cps_max_, cps_, sample_rate_;
    int32_t phs_;
    bool    init_flag_;
    float   num1_, num2_, dfd_max_;
    float   randGab();
    float   biRandGab();
    void    Reset();
};
} // namespace daisysp

#endif