forked from nicoroulet/RaffoSynth
-
Notifications
You must be signed in to change notification settings - Fork 1
/
raffo.h
71 lines (49 loc) · 1.39 KB
/
raffo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <math.h>
#include <lv2plugin.hpp>
#include <lv2types.hpp>
#include <stdlib.h>
#include "lv2/lv2plug.in/ns/ext/atom/atom.h"
#include "lv2/lv2plug.in/ns/ext/atom/util.h"
#include "lv2/lv2plug.in/ns/ext/midi/midi.h"
#include "lv2/lv2plug.in/ns/ext/urid/urid.h"
#include <list>
#include <iostream>
#include <fstream>
#include "tiempo.h"
//#define EXPERIENCIA
using namespace std;
class RaffoSynth : public LV2::Plugin<RaffoSynth> //LV2::Synth<RaffoVoice, RaffoSynth>
{
protected:
double sample_rate;
list<unsigned char> keys;
uint32_t period; // periodo de la nota presionada
float glide_period; // periodo que se esta reproduciendo
float last_val[4];
float pre_buf_end; // el valor del ultimo sample del buffer anterior
float prev_vals[6]; // [in[n-2], in[n-1], lpf[n-2], lpf[n-1], peak[n-2], peak[n-1]]
bool primer_nota;
uint32_t counter;
int envelope_count;
int filter_count;
float modwheel;
float pitch;
double glide;
uint32_t midi_type;
#ifdef EXPERIENCIA
Tiempo t_run;
Tiempo t_osc;
Tiempo t_eq;
int run_count;
ofstream output;
#endif
void equ_wrapper(int sample_count);
public:
typedef LV2::Plugin<RaffoSynth> Parent;
RaffoSynth(double rate);
void activate();
void deactivate();
void render(uint32_t from, uint32_t to);
void handle_midi(uint32_t size, unsigned char* data);
void run(uint32_t sample_count);
};