summaryrefslogtreecommitdiff
path: root/src/mdaPianoVoice.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mdaPianoVoice.h')
-rw-r--r--src/mdaPianoVoice.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/mdaPianoVoice.h b/src/mdaPianoVoice.h
new file mode 100644
index 0000000..86a1c2a
--- /dev/null
+++ b/src/mdaPianoVoice.h
@@ -0,0 +1,51 @@
+#ifndef MDA_PIANO_VOICE_H
+#define MDA_PIANO_VOICE_H
+
+#include "mdaPianoCommon.h"
+#include "mdaPiano.peg"
+
+#pragma GCC system_header
+#include <lv2synth.hpp>
+
+enum Param {
+ Default,
+ Current
+};
+
+class mdaPianoVoice : public LV2::Voice {
+ private:
+ float Fs, iFs;
+
+ /// global internal variables
+ KGRP *kgrp;
+ short *waves;
+ float default_preset[NPARAMS]; // contains the default preset
+
+ // voice state
+ uint32_t delta; //sample playback
+ uint32_t frac;
+ uint32_t pos;
+ uint32_t end;
+ uint32_t loop;
+
+ float env; //envelope
+ float dec;
+
+ float f0; //first-order LPF
+ float f1;
+ float ff;
+
+ float outl;
+ float outr;
+ uint32_t note; //remember what note triggered this
+ // end of voice state
+
+
+ public:
+ mdaPianoVoice(double, short*, KGRP*);
+
+ float p_helper(unsigned short, Param);
+ void reset(void);
+};
+
+#endif