move `process` to voice
[software/lv2-mdametapiano.git] / src / mdaPianoVoice.h
1 #ifndef MDA_PIANO_VOICE_H
2 #define MDA_PIANO_VOICE_H
3
4 #include "mdaPianoCommon.h"
5 #include "mdaPiano.peg"
6
7 #pragma GCC system_header
8 #include <lv2synth.hpp>
9
10 enum Param {
11 Default,
12 Current
13 };
14
15 class mdaPianoVoice : public LV2::Voice {
16 private:
17 float Fs, iFs;
18
19 /// global internal variables
20 KGRP *kgrp;
21 short *waves;
22 float default_preset[NPARAMS]; // contains the default preset
23 short sustain;
24
25 // voice state
26 uint32_t delta; //sample playback
27 uint32_t frac;
28 uint32_t pos;
29 uint32_t end;
30 uint32_t loop;
31
32 float env; //envelope
33 float dec;
34
35 float f0; //first-order LPF
36 float f1;
37 float ff;
38
39 float outl;
40 float outr;
41 uint32_t note; //remember what note triggered this
42 // end of voice state
43
44
45 public:
46 mdaPianoVoice(double, short*, KGRP*);
47
48 float p_helper(unsigned short, Param);
49 void reset(void);
50 };
51
52 #endif