upgrade to JUCE 5.4.3. Remove (probably) unused JUCE modules. Remove VST2 target (it's been end-of-life'd by Steinberg and by JUCE)
This commit is contained in:
@ -48,8 +48,8 @@ SamplerSound::SamplerSound (const String& soundName,
|
||||
|
||||
source.read (data.get(), 0, length + 4, 0, true, true);
|
||||
|
||||
attackSamples = roundToInt (attackTimeSecs * sourceSampleRate);
|
||||
releaseSamples = roundToInt (releaseTimeSecs * sourceSampleRate);
|
||||
params.attack = static_cast<float> (attackTimeSecs);
|
||||
params.release = static_cast<float> (releaseTimeSecs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,24 +87,10 @@ void SamplerVoice::startNote (int midiNoteNumber, float velocity, SynthesiserSou
|
||||
lgain = velocity;
|
||||
rgain = velocity;
|
||||
|
||||
isInAttack = (sound->attackSamples > 0);
|
||||
isInRelease = false;
|
||||
adsr.setSampleRate (sound->sourceSampleRate);
|
||||
adsr.setParameters (sound->params);
|
||||
|
||||
if (isInAttack)
|
||||
{
|
||||
attackReleaseLevel = 0.0f;
|
||||
attackDelta = (float) (pitchRatio / sound->attackSamples);
|
||||
}
|
||||
else
|
||||
{
|
||||
attackReleaseLevel = 1.0f;
|
||||
attackDelta = 0.0f;
|
||||
}
|
||||
|
||||
if (sound->releaseSamples > 0)
|
||||
releaseDelta = (float) (-pitchRatio / sound->releaseSamples);
|
||||
else
|
||||
releaseDelta = -1.0f;
|
||||
adsr.noteOn();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -116,12 +102,12 @@ void SamplerVoice::stopNote (float /*velocity*/, bool allowTailOff)
|
||||
{
|
||||
if (allowTailOff)
|
||||
{
|
||||
isInAttack = false;
|
||||
isInRelease = true;
|
||||
adsr.noteOff();
|
||||
}
|
||||
else
|
||||
{
|
||||
clearCurrentNote();
|
||||
adsr.reset();
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,35 +137,10 @@ void SamplerVoice::renderNextBlock (AudioBuffer<float>& outputBuffer, int startS
|
||||
float r = (inR != nullptr) ? (inR[pos] * invAlpha + inR[pos + 1] * alpha)
|
||||
: l;
|
||||
|
||||
l *= lgain;
|
||||
r *= rgain;
|
||||
auto envelopeValue = adsr.getNextSample();
|
||||
|
||||
if (isInAttack)
|
||||
{
|
||||
l *= attackReleaseLevel;
|
||||
r *= attackReleaseLevel;
|
||||
|
||||
attackReleaseLevel += attackDelta;
|
||||
|
||||
if (attackReleaseLevel >= 1.0f)
|
||||
{
|
||||
attackReleaseLevel = 1.0f;
|
||||
isInAttack = false;
|
||||
}
|
||||
}
|
||||
else if (isInRelease)
|
||||
{
|
||||
l *= attackReleaseLevel;
|
||||
r *= attackReleaseLevel;
|
||||
|
||||
attackReleaseLevel += releaseDelta;
|
||||
|
||||
if (attackReleaseLevel <= 0.0f)
|
||||
{
|
||||
stopNote (0.0f, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
l *= lgain * envelopeValue;
|
||||
r *= rgain * envelopeValue;
|
||||
|
||||
if (outR != nullptr)
|
||||
{
|
||||
|
Reference in New Issue
Block a user