25 |
|
|
26 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
27 |
|
|
28 |
const float EGADSR::FadeOutCoeff(CalculateFadeOutCoeff()); |
void EGADSR::CalculateFadeOutCoeff(float FadeOutTime, float SampleRate) { |
29 |
|
const float killSteps = FadeOutTime * SampleRate; |
30 |
float EGADSR::CalculateFadeOutCoeff() { |
FadeOutCoeff = -1.0f / killSteps; |
|
const float sampleRate = 44100.0; // even if the sample rate will be 192kHz it won't hurt at all |
|
|
const float killSteps = CONFIG_EG_MIN_RELEASE_TIME * sampleRate; |
|
|
return -1.0f / killSteps; |
|
31 |
} |
} |
32 |
|
|
33 |
EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) { |
EGADSR::EGADSR(gig::Engine* pEngine, Event::destination_t ModulationDestination) { |
35 |
this->ModulationDestination = ModulationDestination; |
this->ModulationDestination = ModulationDestination; |
36 |
Stage = stage_end; |
Stage = stage_end; |
37 |
Level = 0.0; |
Level = 0.0; |
38 |
|
CalculateFadeOutCoeff(CONFIG_EG_MIN_RELEASE_TIME, 44100.0); // even if the sample rate will be 192kHz it won't hurt at all |
39 |
} |
} |
40 |
|
|
41 |
/** |
/** |
248 |
pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level; |
pEngine->pSynthesisParameters[ModulationDestination][iSample++] *= Level; |
249 |
} |
} |
250 |
Stage = stage_end; |
Stage = stage_end; |
251 |
if (Level > -FadeOutCoeff) dmsg(1,("EGADSR: Warning, final fade out level too high, may result in click sound!\n")); |
if (Level > -FadeOutCoeff) dmsg(2,("EGADSR: Warning, final fade out level too high, may result in click sound!\n")); |
252 |
} //Fall through here instead of breaking otherwise we can get back into stage_fadeout and loop forever! |
} //Fall through here instead of breaking otherwise we can get back into stage_fadeout and loop forever! |
253 |
case stage_end: { |
case stage_end: { |
254 |
while (iSample < TotalSamples) { |
while (iSample < TotalSamples) { |