108 |
|
|
109 |
|
|
110 |
// Pitch according to keyboard position (if 'PitchTrack' is set) and given detune factor |
// Pitch according to keyboard position (if 'PitchTrack' is set) and given detune factor |
111 |
this->Pitch = ((double) Pitch / 8192.0) / 12.0 + (pDimRgn->PitchTrack) ? pow(2, ((double) (MIDIKey - (int) pDimRgn->UnityNote) + (double) pDimRgn->FineTune / 100.0) / 12.0) |
this->Pitch = ((double) Pitch / 8192.0) / 12.0 + ((pDimRgn->PitchTrack) ? pow(2, ((double) (MIDIKey - (int) pDimRgn->UnityNote) + (double) pDimRgn->FineTune / 100.0) / 12.0) |
112 |
: pow(2, ((double) pDimRgn->FineTune / 100.0) / 12.0); |
: pow(2, ((double) pDimRgn->FineTune / 100.0) / 12.0)); |
113 |
|
|
114 |
Volume = pDimRgn->GetVelocityAttenuation(pNoteOnEvent->Velocity); |
Volume = pDimRgn->GetVelocityAttenuation(pNoteOnEvent->Velocity); |
115 |
|
|
116 |
|
// get current value of EG1 controller |
117 |
|
double eg1controllervalue; |
118 |
|
switch (pDimRgn->EG1Controller.type) { |
119 |
|
case gig::eg1_ctrl_t::type_none: // no controller defined |
120 |
|
eg1controllervalue = 0; |
121 |
|
break; |
122 |
|
case gig::eg1_ctrl_t::type_channelaftertouch: |
123 |
|
eg1controllervalue = 0; // TODO: aftertouch not yet supported |
124 |
|
break; |
125 |
|
case gig::eg1_ctrl_t::type_velocity: |
126 |
|
eg1controllervalue = pNoteOnEvent->Velocity; |
127 |
|
break; |
128 |
|
case gig::eg1_ctrl_t::type_controlchange: // MIDI control change controller |
129 |
|
eg1controllervalue = pEngine->ControllerTable[pDimRgn->EG1Controller.controller_number]; |
130 |
|
break; |
131 |
|
} |
132 |
|
if (pDimRgn->EG1ControllerInvert) eg1controllervalue = 127 - eg1controllervalue; |
133 |
|
|
134 |
|
// calculate influence of EG1 controller on EG1's parameters (TODO: needs to be fine tuned) |
135 |
|
double eg1attack = (pDimRgn->EG1ControllerAttackInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG1ControllerAttackInfluence) * eg1controllervalue : 0.0; |
136 |
|
double eg1decay = (pDimRgn->EG1ControllerDecayInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG1ControllerDecayInfluence) * eg1controllervalue : 0.0; |
137 |
|
double eg1release = (pDimRgn->EG1ControllerReleaseInfluence) ? 0.0001 * (double) (1 << pDimRgn->EG1ControllerReleaseInfluence) * eg1controllervalue : 0.0; |
138 |
|
|
139 |
EG1.Trigger(pDimRgn->EG1PreAttack, |
EG1.Trigger(pDimRgn->EG1PreAttack, |
140 |
pDimRgn->EG1Attack, |
pDimRgn->EG1Attack + eg1attack, |
141 |
pDimRgn->EG1Hold, |
pDimRgn->EG1Hold, |
142 |
pSample->LoopStart, |
pSample->LoopStart, |
143 |
pDimRgn->EG1Decay1, |
pDimRgn->EG1Decay1 + eg1decay, |
144 |
pDimRgn->EG1Decay2, |
pDimRgn->EG1Decay2 + eg1decay, |
145 |
pDimRgn->EG1InfiniteSustain, |
pDimRgn->EG1InfiniteSustain, |
146 |
pDimRgn->EG1Sustain, |
pDimRgn->EG1Sustain, |
147 |
pDimRgn->EG1Release, |
pDimRgn->EG1Release + eg1release, |
148 |
Delay); |
Delay); |
149 |
|
|
150 |
// ************************************************ |
// ************************************************ |
260 |
*/ |
*/ |
261 |
void Voice::ProcessEvents(uint Samples) { |
void Voice::ProcessEvents(uint Samples) { |
262 |
// process pitch events |
// process pitch events |
263 |
RTEList<ModulationSystem::Event>* pEventList = pEngine->pCCEvents[ModulationSystem::destination_vco]; |
RTEList<ModulationSystem::Event>* pEventList = pEngine->pSynthesisEvents[ModulationSystem::destination_vco]; |
264 |
ModulationSystem::Event* pEvent = pEventList->first();; |
ModulationSystem::Event* pEvent = pEventList->first();; |
265 |
while (pEvent) { |
while (pEvent) { |
266 |
ModulationSystem::Event* pNextEvent = pEventList->next(); |
ModulationSystem::Event* pNextEvent = pEventList->next(); |