1 /* 2 * sine_mixer.h 3 * DIN Is Noise is copyright (c) 2006-2021 Jagannathan Sampath 4 * For more information, please visit http://dinisnoise.org/ 5 */ 6 7 #ifndef __sine_mixer 8 #define __sine_mixer 9 10 #include "box.h" 11 #include "multi_curve.h" 12 #include "spinner.h" 13 #include "checkbutton.h" 14 #include "state_button.h" 15 #include "levels.h" 16 #include "plugin.h" 17 #include "point.h" 18 #include "custom_periodic.h" 19 #include "sine.h" 20 #include "curve_editor.h" 21 #include "listeners.h" 22 #include "filled_button.h" 23 #include "mouse_slider.h" 24 #include "plus_button.h" 25 #include "minus_button.h" 26 #include "cross_button.h" 27 28 #include <vector> 29 30 struct harmonics_list_button : state_button { 31 std::vector<int> harmonics; 32 }; 33 34 struct sine_mixer : plugin, change_listener<levels>, shift_listener, paint_listener, curve_listener, option_listener { 35 36 static int NUM_SINE_SAMPLES; 37 static const int MIN_SINE_SAMPLES; 38 39 int num_points; 40 int make_shapeform; 41 42 funktion* pf_sin; 43 custom_periodic cp_sin; 44 sine st_sin; 45 int type; 46 curve_editor sin_ed; 47 48 int nharmonics; 49 std::vector< std::vector< point<float> > > harmonics; 50 51 // output 52 std::vector< point<float> > norm; 53 void normalise (); 54 55 // ui 56 // 57 58 spinner<int> sp_points; 59 checkbutton cb_make_shapeform; 60 61 // standard/custom sin 62 options_list ol_sin; 63 64 button b_edit; 65 66 levels harms; // harmonics 67 levels phase; // phase 68 levels* levs [2]; // harmonics, phase 69 checkbutton cbpaint; 70 options_list olpaint; 71 MAKE_OPTION_LISTENER(paintlis, pail) 72 void toggpaint (label& l); 73 74 sine_mixer (); 75 ~sine_mixer (); 76 void load_params (); 77 void save_params (); 78 79 void setup (); 80 81 void set_type (); 82 void set_samples (int s); 83 84 void prep_harmonics (); 85 void num_harmonics (int n); 86 void mix (); 87 void render (); 88 89 int auto_apply; 90 void apply_not_auto_apply (); 91 void shift_apply (); 92 93 void changed (field& f); 94 void changed (checkbutton& cb); 95 96 void changed (levels& l); 97 void paint (levels& l); 98 void shifted (levels& l); 99 100 void picked (label& lbl, int dir); 101 void edited (curve_editor* e, int i); 102 void clicked (button& b); 103 void moused (int dir, double scl); 104 int handle_input (); 105 106 int paintphase; 107 MAKE_MOVE_LISTENER (szrmov, szm) 108 109 }; 110 111 extern sine_mixer sinemixer; 112 #endif 113