move `process` to voice
[software/lv2-mdametapiano.git] / src / mdaPiano.h
1 //See associated .cpp file for copyright and other info
2
3 #ifndef MDA_PIANO_H
4 #define MDA_PIANO_H
5
6 #pragma GCC system_header
7 #include "mdaPianoVoice.h"
8 #include "mdaPiano.peg"
9 #include <lv2synth.hpp>
10
11
12 class mdaPiano : public LV2::Synth<mdaPianoVoice, mdaPiano> {
13 public:
14 mdaPiano(double rate);
15 ~mdaPiano() {
16 free(waves);
17 }
18
19 void load_kgrp(KGRP*);
20 void load_samples(short**);
21
22 virtual uint32_t processEvents(VstEvents* events);
23
24 virtual void setParameter(uint32_t index, float value);
25 virtual void resume();
26
27
28 private:
29 void update(); //my parameter update
30 void noteOn(uint32_t note, uint32_t velocity);
31
32 float param[NPARAMS];
33 float Fs, iFs;
34
35 #define EVENTBUFFER 120
36 #define EVENTS_DONE 99999999
37 uint32_t notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block
38
39 ///global internal variables
40 KGRP kgrp[16];
41 mdaPianoVoice *voices[NVOICES];
42 uint32_t activevoices, poly, cpos;
43 short *waves;
44 uint32_t cmax;
45 float *comb, cdep, width, trim;
46 uint32_t size, sustain;
47 float tune, fine, random, stretch;
48 float muff, muffvel, sizevel, velsens, volume;
49 };
50
51 #endif