Skip to content

Commit

Permalink
fix chebyshev amplitude mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
rayxke committed Aug 27, 2024
1 parent 9e91adc commit 07994b0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Source/SineWaveVoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,13 @@ float SineWaveVoice::getChebyshevSignal(float currentSample)
float chebyshevSignal = 0.0;
for (auto chebyshevLevel = (int) chebyshevLevel1; chebyshevLevel < chebyshevLevelEnd; chebyshevLevel++)
{
chebyshevSignal += chebyshevAmplitudes[chebyshevLevel] * chebyshevCalculation(chebyshevLevel, currentSample);
chebyshevSignal += (2*chebyshevAmplitudes[chebyshevLevel]-1) * chebyshevCalculation(chebyshevLevel, currentSample);
}
return chebyshevSignal;
}
void SineWaveVoice::stopNote (float /*velocity*/, bool allowTailOff)
{

void SineWaveVoice::stopNote (float /*velocity*/, bool allowTailOff)
{
if (allowTailOff)
{
// start a tail-off by setting this flag. The render callback will pick up on
Expand All @@ -92,7 +93,7 @@ float SineWaveVoice::getChebyshevSignal(float currentSample)
angleDelta = 0.0;
}
adsr.noteOff();
}
}

void SineWaveVoice::pitchWheelMoved (int /*newValue*/)
{
Expand Down Expand Up @@ -174,6 +175,7 @@ void SineWaveVoice::setAttack()
mattack = 1.0;
}
}

void SineWaveVoice::setRelease()
{
if (adsrParams.release != 0) {
Expand All @@ -188,6 +190,7 @@ void SineWaveVoice::setRelease()
mrelease = 1.0;
}
}

void SineWaveVoice::renderNextBlock (AudioBuffer<float>& outputBuffer, int startSample, int numSamples)
{
if (angleDelta != 0.0)
Expand Down

0 comments on commit 07994b0

Please sign in to comment.