Subversion Repositories DIN Is Noise

Rev

Rev 1536 | Rev 1651 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
* modulator.h
* DIN Is Noise is copyright (c) 2006-2020 Jagannathan Sampath
* For more information, please visit https://dinisnoise.org/
*/

#ifndef __modulator__
#define __modulator__

#include "beat2value.h"
#include <string>

struct multi_curve;

struct mod_params { // modulation params

  float depth;
  beat2value bv; // for bpm
  float result;

  float initial; // for range modulation

  mod_params (multi_curve* c, const std::string& n = "noname");
  void set_bpm (float value, int reset = 0);
  void calc ();
  void clear (int reset = 0);

};

struct modulator {
 
  enum {FM, AM};
  mod_params fm, am;
 
  enum {FROZEN=-1, NOT_ACTIVE, ACTIVE};
  int active;

  // affects velocity vector of drones?
  int afx_vel;
  static float afx_vel_min_mag;

  int scrubbed;

  modulator (multi_curve* fc, multi_curve* ac) : fm (fc), am (ac) {afx_vel = active = scrubbed = 0;}

  void clear () {
    fm.clear ();
    am.clear ();
    active = 0;
  }

  void calc () {
    fm.calc ();
    am.calc ();
  }

};

#endif