(root)/wip/src/modulator.h - Rev 1712
Rev 1708 |
Rev 1713 |
Go to most recent revision |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* modulator.h
* DIN Is Noise is copyright (c) 2006-2021 Jagannathan Sampath
* For more information, please visit https://dinisnoise.org/
*/
#ifndef __modulator__
#define __modulator__
#include "beat2value.h"
#include <fstream>
#include <string>
struct multi_curve;
struct drone;
struct autorotator {
int yes;
int dir; // +1 = anti-clockwise , -1 = clockwise
float rpm;
struct anglet {
float persec;
float theta;
anglet () {
persec = 0.0f;
theta = 0.0f;
}
} angle;
autorotator () {
yes = 0;
dir = -1;
set_rpm (1.0f);
}
void set_rpm (float r);
};
std::ostream& operator<< (std::ostream&, autorotator& ar);
std::istream& operator>> (std::istream&, autorotator& ar);
struct mod_params {
double t;
float depth;
beat2value bv;
float result;
enum {VERTICAL, HORIZONTAL, VELOCITY, ACCELERATION};
static point<float> vertical, horizontal;
int dir;
float *dirx, *diry;
autorotator autorot; // for autorotating direction
void setdir (int d, float* x, float* y) {
dir = d;
dirx = x;
diry = y;
}
void calcdir (drone& d);
float initial; // for microtonal range modulation
mod_params (multi_curve* c, int d, point<float>& p, const std::string& n = "noname");
void set_bpm (float value, int reset = 0);
void calc ();
void clear (int reset = 0);
};
struct modulator {
enum {AM, FM};
mod_params am, fm;
mod_params* arr[2];
enum {FROZEN=-1, NOT_ACTIVE, ACTIVE};
int active;
int scrubbed;
modulator (multi_curve* fmc, multi_curve* amc) : am (amc, mod_params::VERTICAL, mod_params::vertical), fm (fmc, mod_params::HORIZONTAL, mod_params::horizontal) {
active = scrubbed = 0;
arr[0] = &am;
arr[1] = &fm;
}
void clear () {
am.clear ();
fm.clear ();
active = 0;
}
void calc () {
am.calc ();
fm.calc ();
}
};
#endif