1 #ifndef MDA_PIANO_VOICE_H
2 #define MDA_PIANO_VOICE_H
4 #include "mdaPianoCommon.h"
5 #include "mdaPiano.peg"
7 #pragma GCC system_header
8 #include <lv2synth.hpp>
15 class mdaPianoVoice
: public LV2::Voice
{
19 /// global internal variables
22 float default_preset
[NPARAMS
]; // contains the default preset
24 float *comb
, cdep
, width
, trim
;
25 float fine
, random
, stretch
;
26 float volume
, muff
, muffvel
, sizevel
, velsens
;
27 uint32_t cpos
, size
, poly
;
30 uint32_t delta
; //sample playback
39 float f0
; //first-order LPF
45 uint32_t note
; //remember what note triggered this
52 mdaPianoVoice(double, short*, KGRP
*);
53 void set_sustain(unsigned short v
) { sustain
= v
; }
54 void set_volume(float v
) { volume
= v
; }
55 void set_muff(float v
) { muff
= v
; }
57 float p_helper(unsigned short, Param
);
58 void update(Param
); // recalculates internal variables
59 void on(unsigned char key
, unsigned char velocity
);
60 void release(unsigned char velocity
);
62 bool is_sustained(void) { return (note
== SUSTAIN
); }
63 unsigned char get_key(void) const { return m_key
; }