Rev 2167 |
Blame |
Compare with Previous |
Last modification |
View Log
| RSS feed
/*
* phrasor.h
* DIN Is Noise is copyright (c) 2006-2025 Jagannathan Sampath
* DIN Is Noise is released under GNU Public License 2.0
* For more information, please visit https://dinisnoise.org/
*/
#ifndef __phrasor
#define __phrasor
#include <vector>
#include "box.h"
#include "point.h"
struct phrasor {
std::vector < point<int> > data;
int size, last;
float last_1;
float amount; // cur as [0,1]
int state;
enum {stopped, recording, playing, paused};
int cur;
phrasor () { clear (); }
void add (point<int>& p) {
data.push_back (p);
}
void get (int& win_mousex, int& win_mousey) {
point<int>& pt = data[cur];
win_mousex = pt.x;
win_mousey = pt.y;
}
void clear () {
state = stopped;
data.clear ();
cur = 0;
size = 0;
last = 0;
last_1 = -1;
amount = 0;
}
void rec () {
state = recording;
cur = 0;
}
void play () {
if (cur < size) state = playing;
}
void draw (box<int>& win);
void draw_marker (int x, int y, box<int>& win);
int validate ();
int next ();
void set_cur (float amt);
int isrecording () { return state == recording;}
};
#endif