name peg file after TYPE
[software/lv2-mdametapiano.git] / src / mdaPiano.h
1 #ifndef MDA_PIANO_H
2 #define MDA_PIANO_H
3 //See associated .cpp file for copyright and other info
4
5 #include "mdaPianoVoice.h"
6 #ifdef PIANO
7 #include "mdaPiano.peg"
8 #elif defined EPIANO
9 #include "mdaEPiano.peg"
10 #endif
11
12 #pragma GCC system_header
13 #include <lvtk/synth.hpp>
14 #include <stdio.h>
15
16
17 class mdaPiano : public lvtk::Synth<mdaPianoVoice, mdaPiano> {
18 public:
19 mdaPiano(double);
20 ~mdaPiano() {
21 for (unsigned char i = 0; i < NSAMPLES; i++) {
22 free(samples[i].buffer);
23 }
24 free(samples);
25 }
26
27 bool sustain;
28 KGRP kgrp[NSAMPLES];
29 mdaPianoVoice *voices[NVOICES];
30 Sample *samples = (Sample*) malloc (NSAMPLES * sizeof(Sample));
31
32 void load_kgrp(KGRP*);
33 void load_sample(Sample*, const char*);
34 void tweak_sample(Sample*, long);
35
36 unsigned find_free_voice(unsigned char, unsigned char);
37 void handle_midi(uint32_t, unsigned char*);
38 void setVolume(float);
39 void update(void);
40 };
41
42 #endif