Skip to content

File parameter.h

File List > external-docs > libDaisy > src > hid > parameter.h

Go to the documentation of this file

Source Code

#pragma once
#include <stdint.h>
#include "hid/ctrl.h"

namespace daisy
{
class Parameter
{
  public:
    enum Curve
    {
        LINEAR,      
        EXPONENTIAL, 
        LOGARITHMIC, 
        CUBE,        
        LAST,        
    };
    Parameter() {}
    ~Parameter() {}

    void Init(AnalogControl input, float min, float max, Curve curve);

    float Process();

    inline float Value() { return val_; }

  private:
    AnalogControl in_;
    float         pmin_, pmax_;
    float         lmin_, lmax_; // for log range
    float         val_;
    Curve         pcurve_;
};
} // namespace daisy