summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrekado <rekado@elephly.net>2013-01-16 07:59:24 +0800
committerrekado <rekado@elephly.net>2013-01-16 07:59:24 +0800
commit5aefe1cbcc218187e26bd6c67745553d3d756682 (patch)
tree0c21dcff46547c23cddbeae7103e54e5b3bbc16a
parentb273ec03ac4d420a5a33ae50ed588eb7b236bec0 (diff)
replace param[n] with calls to p_helper
-rw-r--r--src/mdaPianoVoice.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/mdaPianoVoice.cpp b/src/mdaPianoVoice.cpp
index 86203eb..deb99f5 100644
--- a/src/mdaPianoVoice.cpp
+++ b/src/mdaPianoVoice.cpp
@@ -228,22 +228,20 @@ if(!(r > -2.0f) || !(r < 2.0f))
void mdaPianoVoice::update(Param par)
{
- //TODO: use local copy
- float * param = programs[curProgram].param;
- size = (uint32_t)(12.0f * param[2] - 6.0f);
- sizevel = 0.12f * param[3];
- muffvel = param[5] * param[5] * 5.0f;
+ size = (uint32_t)(12.0f * p_helper(p_hardness_offset, par) - 6.0f);
+ sizevel = 0.12f * p_helper(p_velocity_to_hardness, par);
+ muffvel = p_helper(p_velocity_to_muffling, par) * p_helper(p_velocity_to_muffling, par) * 5.0f;
- velsens = 1.0f + param[6] + param[6];
- if(param[6] < 0.25f) velsens -= 0.75f - 3.0f * param[6];
+ velsens = 1.0f + p_helper(p_velocity_sensitivity, par) + p_helper(p_velocity_sensitivity, par);
+ if(p_helper(p_velocity_sensitivity, par) < 0.25f) velsens -= 0.75f - 3.0f * p_helper(p_velocity_sensitivity, par);
- fine = param[9] - 0.5f;
- random = 0.077f * param[10] * param[10];
- stretch = 0.000434f * (param[11] - 0.5f);
+ fine = p_helper(p_fine_tuning, par) - 0.5f;
+ random = 0.077f * p_helper(p_random_detuning, par) * p_helper(p_random_detuning, par);
+ stretch = 0.000434f * (p_helper(p_stretch_tuning, par) - 0.5f);
- cdep = param[7] * param[7];
+ cdep = p_helper(p_stereo_width, par) * p_helper(p_stereo_width, par);
trim = 1.50f - 0.79f * cdep;
- width = 0.04f * param[7]; if(width > 0.03f) width = 0.03f;
+ width = 0.04f * p_helper(p_stereo_width, par); if(width > 0.03f) width = 0.03f;
- poly = 8 + (uint32_t)(24.9f * param[8]);
+ poly = 8 + (uint32_t)(24.9f * p_helper(p_polyphony, par));
}