1 /* 2 * phrasor.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 9 #ifndef __phrasor 10 #define __phrasor 11 12 #include <vector> 13 #include "box.h" 14 #include "point.h" 15 16 struct phrasor { 17 18 std::vector < point<int> > data; 19 20 int size, last; 21 22 float last_1; 23 float amount; // cur as [0,1] 24 25 int state; 26 enum {stopped, recording, playing, paused}; 27 28 int cur; 29 phrasorphrasor30 phrasor () { 31 clear (); 32 } 33 addphrasor34 void add (point<int>& p) { 35 data.push_back (p); 36 } 37 getphrasor38 void get (int& win_mousex, int& win_mousey) { 39 point<int>& pt = data[cur]; 40 win_mousex = pt.x; 41 win_mousey = pt.y; 42 } 43 clearphrasor44 void clear () { 45 state = stopped; 46 data.clear (); 47 cur = 0; 48 size = 0; 49 last = -1; 50 last_1 = 0; 51 amount = 0; 52 } 53 54 void play (); 55 56 void draw (); 57 void draw_marker (int x, int y); 58 59 int validate (); 60 int next (); 61 void set_cur (float amt); 62 63 }; 64 65 #endif 66 67 68 69