// A linear falling
class EnvelopeSimpleLinear {
  public:
    float incrementer = 1.0;
    float value;
    float speed = 0.001;
    float amount = 1.0;
    void update();
    void reset();
    void setAmount(float speed);
    void setSpeed(float speed);
};

void EnvelopeSimpleLinear::update() {
  this->incrementer -= this->speed;
  if (this->incrementer <= 0.0) {
    this->incrementer = 0.0;
  }
  this->value = this->incrementer * this->amount;
}

void EnvelopeSimpleLinear::reset() {
  this->incrementer = 1.0;
  this->value = 0.0;
}

void EnvelopeSimpleLinear::setSpeed(float speed) {
  this->speed = speed;
}

void EnvelopeSimpleLinear::setAmount(float speed) {
  this->amount = amount;
}