1 /* 2 * noiser.h 3 * DIN Is Noise is copyright (c) 2006-2021 Jagannathan Sampath 4 * DIN Is Noise is released under GNU Public License 2.0 5 * For more information, please visit https://dinisnoise.org/ 6 */ 7 8 #ifndef __noiser 9 #define __noiser 10 11 #include "solver.h" 12 #include "random.h" 13 #include "beat2value.h" 14 #include "listeners.h" 15 #include <fstream> 16 17 struct noiser { 18 19 static multi_curve interp; 20 static curve_editor ed; 21 static noise_interp_lis lis; 22 23 struct value_dat { 24 float cur; 25 float next; 26 float delta; value_datnoiser::value_dat27 value_dat () { cur = next = delta = 0.0f;} 28 } value; 29 30 float spread; 31 rnd<float> random_value; 32 33 struct samples_dat { 34 int cur; 35 int due; 36 int duei; 37 float next; 38 float err; 39 float derr; samples_datnoiser::samples_dat40 samples_dat () { 41 cur = due = duei = 0; 42 next = err = derr = 0.0f; 43 } 44 } samples; 45 46 47 struct alpha_dat { 48 float val; 49 float warp; 50 float delta; alpha_datnoiser::alpha_dat51 alpha_dat () {val = warp = delta = 0.0f;} 52 } alpha; 53 void calc_delta_alpha (); 54 55 solver warp; 56 57 float last_vol; 58 59 noiser (); 60 void operator() (float* L, float* R, int n, float vol); 61 void operator() (float* L, float* R, int n, float* vola); 62 void set_samples (float s); 63 void set_spread (float s); 64 void set_value (float v); 65 66 }; 67 68 std::ofstream& operator<< (std::ofstream& o, noiser& n); 69 70 #endif 71