249 |
} |
} |
250 |
if (pDimRgn->EG1ControllerInvert) eg1controllervalue = 127 - eg1controllervalue; |
if (pDimRgn->EG1ControllerInvert) eg1controllervalue = 127 - eg1controllervalue; |
251 |
|
|
252 |
// calculate influence of EG1 controller on EG1's parameters (TODO: needs to be fine tuned) |
// calculate influence of EG1 controller on EG1's parameters |
253 |
double eg1attack = (pDimRgn->EG1ControllerAttackInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG1ControllerAttackInfluence) * eg1controllervalue : 0.0; |
// (eg1attack is different from the others) |
254 |
double eg1decay = (pDimRgn->EG1ControllerDecayInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG1ControllerDecayInfluence) * eg1controllervalue : 0.0; |
double eg1attack = (pDimRgn->EG1ControllerAttackInfluence) ? |
255 |
double eg1release = (pDimRgn->EG1ControllerReleaseInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG1ControllerReleaseInfluence) * eg1controllervalue : 0.0; |
1 + 0.031 * (double) (pDimRgn->EG1ControllerAttackInfluence == 1 ? |
256 |
|
1 : 1 << pDimRgn->EG1ControllerAttackInfluence) * eg1controllervalue : 1.0; |
257 |
|
double eg1decay = (pDimRgn->EG1ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pDimRgn->EG1ControllerDecayInfluence) * eg1controllervalue : 1.0; |
258 |
|
double eg1release = (pDimRgn->EG1ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pDimRgn->EG1ControllerReleaseInfluence) * eg1controllervalue : 1.0; |
259 |
|
|
260 |
pEG1->Trigger(pDimRgn->EG1PreAttack, |
pEG1->Trigger(pDimRgn->EG1PreAttack, |
261 |
pDimRgn->EG1Attack + eg1attack, |
pDimRgn->EG1Attack * eg1attack, |
262 |
pDimRgn->EG1Hold, |
pDimRgn->EG1Hold, |
263 |
pSample->LoopStart, |
pSample->LoopStart, |
264 |
(pDimRgn->EG1Decay1 + eg1decay) * velrelease, |
pDimRgn->EG1Decay1 * eg1decay * velrelease, |
265 |
(pDimRgn->EG1Decay2 + eg1decay) * velrelease, |
pDimRgn->EG1Decay2 * eg1decay * velrelease, |
266 |
pDimRgn->EG1InfiniteSustain, |
pDimRgn->EG1InfiniteSustain, |
267 |
pDimRgn->EG1Sustain, |
pDimRgn->EG1Sustain, |
268 |
(pDimRgn->EG1Release + eg1release) * velrelease, |
pDimRgn->EG1Release * eg1release * velrelease, |
269 |
// the SSE synthesis implementation requires |
// the SSE synthesis implementation requires |
270 |
// the vca start to be 16 byte aligned |
// the vca start to be 16 byte aligned |
271 |
SYNTHESIS_MODE_GET_IMPLEMENTATION(SynthesisMode) ? |
SYNTHESIS_MODE_GET_IMPLEMENTATION(SynthesisMode) ? |
294 |
} |
} |
295 |
if (pDimRgn->EG2ControllerInvert) eg2controllervalue = 127 - eg2controllervalue; |
if (pDimRgn->EG2ControllerInvert) eg2controllervalue = 127 - eg2controllervalue; |
296 |
|
|
297 |
// calculate influence of EG2 controller on EG2's parameters (TODO: needs to be fine tuned) |
// calculate influence of EG2 controller on EG2's parameters |
298 |
double eg2attack = (pDimRgn->EG2ControllerAttackInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG2ControllerAttackInfluence) * eg2controllervalue : 0.0; |
double eg2attack = (pDimRgn->EG2ControllerAttackInfluence) ? 1 + 0.00775 * (double) (1 << pDimRgn->EG2ControllerAttackInfluence) * eg2controllervalue : 1.0; |
299 |
double eg2decay = (pDimRgn->EG2ControllerDecayInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG2ControllerDecayInfluence) * eg2controllervalue : 0.0; |
double eg2decay = (pDimRgn->EG2ControllerDecayInfluence) ? 1 + 0.00775 * (double) (1 << pDimRgn->EG2ControllerDecayInfluence) * eg2controllervalue : 1.0; |
300 |
double eg2release = (pDimRgn->EG2ControllerReleaseInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG2ControllerReleaseInfluence) * eg2controllervalue : 0.0; |
double eg2release = (pDimRgn->EG2ControllerReleaseInfluence) ? 1 + 0.00775 * (double) (1 << pDimRgn->EG2ControllerReleaseInfluence) * eg2controllervalue : 1.0; |
301 |
|
|
302 |
pEG2->Trigger(pDimRgn->EG2PreAttack, |
pEG2->Trigger(pDimRgn->EG2PreAttack, |
303 |
pDimRgn->EG2Attack + eg2attack, |
pDimRgn->EG2Attack * eg2attack, |
304 |
false, |
false, |
305 |
pSample->LoopStart, |
pSample->LoopStart, |
306 |
(pDimRgn->EG2Decay1 + eg2decay) * velrelease, |
pDimRgn->EG2Decay1 * eg2decay * velrelease, |
307 |
(pDimRgn->EG2Decay2 + eg2decay) * velrelease, |
pDimRgn->EG2Decay2 * eg2decay * velrelease, |
308 |
pDimRgn->EG2InfiniteSustain, |
pDimRgn->EG2InfiniteSustain, |
309 |
pDimRgn->EG2Sustain, |
pDimRgn->EG2Sustain, |
310 |
(pDimRgn->EG2Release + eg2release) * velrelease, |
pDimRgn->EG2Release * eg2release * velrelease, |
311 |
Delay, |
Delay, |
312 |
velocityAttenuation); |
velocityAttenuation); |
313 |
} |
} |