summaryrefslogtreecommitdiff
path: root/src/mdaPianoVoice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mdaPianoVoice.cpp')
-rw-r--r--src/mdaPianoVoice.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
new file mode 100644
index 0000000..1223e43
--- /dev/null
+++ b/src/mdaPianoVoice.cpp
@@ -0,0 +1,41 @@
+#include "mdaPianoVoice.h"
+
+mdaPianoVoice::mdaPianoVoice(double rate, short * samples, KGRP * master_kgrp) {
+ //set tuning
+ Fs = rate;
+ iFs = 1.0f/Fs;
+
+ waves = samples;
+ kgrp = master_kgrp;
+
+ default_preset[p_offset(p_envelope_decay)] = 0.500f;
+ default_preset[p_offset(p_envelope_release)] = 0.500f;
+ default_preset[p_offset(p_hardness_offset)] = 0.500f;
+ default_preset[p_offset(p_velocity_to_hardness)] = 0.500f;
+ default_preset[p_offset(p_muffling_filter)] = 0.803f;
+ default_preset[p_offset(p_velocity_to_muffling)] = 0.251f;
+ default_preset[p_offset(p_velocity_sensitivity)] = 0.376f;
+ default_preset[p_offset(p_stereo_width)] = 0.500f;
+ default_preset[p_offset(p_polyphony)] = 0.330f;
+ default_preset[p_offset(p_fine_tuning)] = 0.500f;
+ default_preset[p_offset(p_random_detuning)] = 0.246f;
+ default_preset[p_offset(p_stretch_tuning)] = 0.500f;
+
+ reset();
+}
+
+
+void mdaPianoVoice::reset() {
+ env = 0.0f;
+ dec = 0.99f;
+ muff = 160.0f;
+ volume = 0.2f;
+}
+
+
+float mdaPianoVoice::p_helper(unsigned short id, Param d) {
+ if (d == Default)
+ return default_preset[p_offset(id)];
+ else
+ return *p(id);
+}