move voice parameters to mdaPianoVoice
[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 void handle_midi(uint32_t size, unsigned char* data);
23 void setVolume(float);
24 void setParameter(unsigned char, float);
25
26
27 private:
28 void update(); //my parameter update
29 void noteOn(uint32_t note, uint32_t velocity);
30
31 float param[NPARAMS];
32 float Fs, iFs;
33
34 #define EVENTBUFFER 120
35 #define EVENTS_DONE 99999999
36 uint32_t notes[EVENTBUFFER + 8]; //list of delta|note|velocity for current block
37
38 ///global internal variables
39 KGRP kgrp[16];
40 mdaPianoVoice *voices[NVOICES];
41 uint32_t activevoices;
42 short *waves;
43 uint32_t cmax;
44 uint32_t sustain;
45 };
46
47 #endif