39 lines
1.7 KiB
C
39 lines
1.7 KiB
C
#pragma once
|
|
#include "../SynthVoice.h"
|
|
|
|
void NeuralSynthVoice::renderEQ(juce::dsp::AudioBlock<float> &block)
|
|
{
|
|
// ================================================================
|
|
// EQ + Master + Limiter (EQ guarded by eqOn)
|
|
// ================================================================
|
|
const bool eqEnabled = shared.eqOn && shared.eqOn->load() > 0.5f;
|
|
|
|
auto& eqL = chain.get<eqLowIndex>();
|
|
auto& eqM = chain.get<eqMidIndex>();
|
|
auto& eqH = chain.get<eqHighIndex>();
|
|
|
|
if (eqEnabled)
|
|
{
|
|
eqL.coefficients = juce::dsp::IIR::Coefficients<float>::makeLowShelf (
|
|
spec.sampleRate, 100.0f, 0.707f,
|
|
juce::Decibels::decibelsToGain (shared.lowGainDbls ? shared.lowGainDbls->load() : 0.0f));
|
|
|
|
eqM.coefficients = juce::dsp::IIR::Coefficients<float>::makePeakFilter (
|
|
spec.sampleRate, 1000.0f, 1.0f,
|
|
juce::Decibels::decibelsToGain (shared.midGainDbls ? shared.midGainDbls->load() : 0.0f));
|
|
|
|
eqH.coefficients = juce::dsp::IIR::Coefficients<float>::makePeakFilter (
|
|
spec.sampleRate, 10000.0f, 0.707f,
|
|
juce::Decibels::decibelsToGain (shared.highGainDbls ? shared.highGainDbls->load() : 0.0f));
|
|
|
|
eqL.process (juce::dsp::ProcessContextReplacing<float> (block));
|
|
eqM.process (juce::dsp::ProcessContextReplacing<float> (block));
|
|
eqH.process (juce::dsp::ProcessContextReplacing<float> (block));
|
|
}
|
|
|
|
chain.get<masterIndex>().setGainDecibels (shared.masterDbls ? shared.masterDbls->load() : 0.0f);
|
|
chain.get<masterIndex>().process (juce::dsp::ProcessContextReplacing<float> (block));
|
|
|
|
chain.get<limiterIndex>().process (juce::dsp::ProcessContextReplacing<float> (block));
|
|
}
|