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:
Alex Birch
2019-06-22 20:41:38 +01:00
parent d22c2cd4fa
commit 9ee566b251
1140 changed files with 67534 additions and 105952 deletions

View File

@ -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)
{

View File

@ -72,7 +72,7 @@ public:
double maxSampleLengthSeconds);
/** Destructor. */
~SamplerSound();
~SamplerSound() override;
//==============================================================================
/** Returns the sample's name */
@ -83,12 +83,14 @@ public:
*/
AudioBuffer<float>* getAudioData() const noexcept { return data.get(); }
//==============================================================================
/** Changes the parameters of the ADSR envelope which will be applied to the sample. */
void setEnvelopeParameters (ADSR::Parameters parametersToUse) { params = parametersToUse; }
//==============================================================================
bool appliesToNote (int midiNoteNumber) override;
bool appliesToChannel (int midiChannel) override;
private:
//==============================================================================
friend class SamplerVoice;
@ -97,8 +99,9 @@ private:
std::unique_ptr<AudioBuffer<float>> data;
double sourceSampleRate;
BigInteger midiNotes;
int length = 0, attackSamples = 0, releaseSamples = 0;
int midiRootNote = 0;
int length = 0, midiRootNote = 0;
ADSR::Parameters params;
JUCE_LEAK_DETECTOR (SamplerSound)
};
@ -123,7 +126,7 @@ public:
SamplerVoice();
/** Destructor. */
~SamplerVoice();
~SamplerVoice() override;
//==============================================================================
bool canPlaySound (SynthesiserSound*) override;
@ -136,13 +139,13 @@ public:
void renderNextBlock (AudioBuffer<float>&, int startSample, int numSamples) override;
private:
//==============================================================================
double pitchRatio = 0;
double sourceSamplePosition = 0;
float lgain = 0, rgain = 0, attackReleaseLevel = 0, attackDelta = 0, releaseDelta = 0;
bool isInAttack = false, isInRelease = false;
float lgain = 0, rgain = 0;
ADSR adsr;
JUCE_LEAK_DETECTOR (SamplerVoice)
};