diff --git a/source/dsp/Voice.h b/source/dsp/Voice.h index ac0c984..ac2d8d1 100644 --- a/source/dsp/Voice.h +++ b/source/dsp/Voice.h @@ -86,7 +86,6 @@ class Voice : public SynthesiserVoice, private Timer { // Initialize Oscillators firstOscillator().initialize(lookupTable); - secondOscillator().initialize(lookupTable); processorChain.prepare(spec); @@ -98,7 +97,6 @@ class Voice : public SynthesiserVoice, private Timer { adsr.setSampleRate(lfoSampleRate); firstOscillator().setRampDurationSeconds(lfoSampleDuration); - secondOscillator().setRampDurationSeconds(lfoSampleDuration); gainProcessor().setGainLinear(1.0 - gainHeadroom); @@ -128,11 +126,6 @@ class Voice : public SynthesiserVoice, private Timer { 1.0f - (*parameters.velocityEnvelopeAmount) * (1.0f - velocity); firstOscillator().setLevel(currentVelocity); - firstOscillator().setLevel(currentVelocity); - - if (modulationAmount > 0.0f) { - updateModulation(); - } updateADSRParameters(); @@ -207,8 +200,6 @@ class Voice : public SynthesiserVoice, private Timer { float currentFilterDrive = *parameters.filterDrive; float currentOsc1Frequency = 0.0; - float currentOsc2Frequency = 0.0; - float currentOsc2AnalogFactor = 0.0; Waveform currentWaveform = static_cast(static_cast(*parameters.oscillatorWaveform)); @@ -217,13 +208,12 @@ class Voice : public SynthesiserVoice, private Timer { enum { osc1Index, - osc2Index, filterIndex, gainIndex, }; - dsp::ProcessorChain, VCAOscillator, - blackbird::dsp::LadderFilter, dsp::Gain> + dsp::ProcessorChain, blackbird::dsp::LadderFilter, + dsp::Gain> processorChain; dsp::Oscillator lfo; @@ -236,10 +226,6 @@ class Voice : public SynthesiserVoice, private Timer { return processorChain.get(); } - VCAOscillator &secondOscillator() { - return processorChain.get(); - } - dsp::Gain &gainProcessor() { return processorChain.get(); } blackbird::dsp::LadderFilter &filter() { @@ -259,16 +245,9 @@ class Voice : public SynthesiserVoice, private Timer { updateLevelWithADSRSample(nextADSRSample); updateFilterWithADSRSample(nextADSRSample); - updateModulation(); - processorChain.process(context); } - static float analogFactor() { - return (Random::getSystemRandom().nextBool() ? 1.0f : -1.0f) * - maxAnalogFactor * Random::getSystemRandom().nextFloat(); - } - static double getBendedFrequencyForWheel(int newPitchWheelValue, int currentlyPlayingNote) { auto bendSemitonesValue = @@ -311,7 +290,6 @@ class Voice : public SynthesiserVoice, private Timer { static_cast(static_cast(*parameters.oscillatorWaveform)); firstOscillator().setWaveform(currentWaveform); - secondOscillator().setWaveform(currentWaveform); } void updateADSRParameters() { @@ -320,17 +298,8 @@ class Voice : public SynthesiserVoice, private Timer { } void updateOscillatorsFrequency() { - currentOsc1Frequency = currentNoteFrequency * (1.0f + analogFactor()); - currentOsc2AnalogFactor = analogFactor(); - currentOsc2Frequency = - currentNoteFrequency * - (1.0f + maxDetuningFactor * (*parameters.detuningAmount) * - currentOsc2AnalogFactor); - - currentDetuningAmount = *parameters.detuningAmount; - + currentOsc1Frequency = currentNoteFrequency; firstOscillator().setFrequency(currentOsc1Frequency); - secondOscillator().setFrequency(currentOsc2Frequency); } void updateFilterDrive() { @@ -339,14 +308,6 @@ class Voice : public SynthesiserVoice, private Timer { filter().setDrive(currentFilterDrive); } - void updateModulation() { - secondOscillator().setFrequency( - currentOsc2Frequency * - (1.0 + modulationAmount * lfo.processSample(0.0f) * - (maxDetuningFactor - defaultDetuningFactor) * - maxAnalogFactor)); - } - void updateFilterWithADSRSample(float nextADSRSample) { const auto envelopeCutoffValue = *parameters.cutoffEnvelopeAmount >= 0 @@ -372,7 +333,6 @@ class Voice : public SynthesiserVoice, private Timer { nextADSRSample; firstOscillator().setLevel(envelopeVelocityValue); - secondOscillator().setLevel(envelopeVelocityValue); } #pragma mark - Note Lifecycle @@ -389,7 +349,6 @@ class Voice : public SynthesiserVoice, private Timer { void setProcessorsBypassed(bool bypassed) { processorChain.template setBypassed(bypassed); - processorChain.template setBypassed(bypassed); filter().setEnabled(!bypassed); }