replace param[n] with calls to p_helper
authorrekado <rekado@elephly.net>
Tue, 15 Jan 2013 23:59:24 +0000 (07:59 +0800)
committerrekado <rekado@elephly.net>
Tue, 15 Jan 2013 23:59:24 +0000 (07:59 +0800)
src/mdaPianoVoice.cpp

index 86203eb..deb99f5 100644 (file)
@@ -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));
 }