27 |
const float EGADSR::EndCoeff(CalculateEndCoeff()); |
const float EGADSR::EndCoeff(CalculateEndCoeff()); |
28 |
|
|
29 |
float EGADSR::CalculateEndCoeff() { |
float EGADSR::CalculateEndCoeff() { |
30 |
const double sampleRate = 44100.0; // even if the sample rate will be 192kHz it won't hurt at all |
const float sampleRate = 44100.0; // even if the sample rate will be 192kHz it won't hurt at all |
31 |
const double killSteps = EG_MIN_RELEASE_TIME * sampleRate; |
const float killSteps = EG_MIN_RELEASE_TIME * sampleRate; |
32 |
return float(exp(1.0 / killSteps) - 1.0); |
return 1.0f / killSteps; |
33 |
} |
} |
34 |
|
|
35 |
EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) { |
EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) { |
170 |
break; |
break; |
171 |
} |
} |
172 |
case stage_end: { |
case stage_end: { |
173 |
while (iSample < TotalSamples) { |
int to_process = RTMath::Min(int(Level / EndCoeff), TotalSamples - iSample); |
174 |
Level += Level * EndCoeff; |
int process_end = iSample + to_process; |
175 |
|
while (iSample < process_end) { |
176 |
|
Level += EndCoeff; |
177 |
pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level; |
pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level; |
178 |
} |
} |
179 |
|
while (iSample < TotalSamples) { |
180 |
|
pEngine->pSynthesisParameters[ModulationDestination][iSample++] = 0.0f; |
181 |
|
} |
182 |
break; |
break; |
183 |
} |
} |
184 |
} |
} |