mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
Add brickwall limiter FX section
This commit is contained in:
parent
fcdb1939ee
commit
6cd7d4f3ba
4 changed files with 161 additions and 49 deletions
|
|
@ -180,6 +180,19 @@ juce::AudioProcessorValueTreeState::ParameterLayout ChromaFlockProcessor::create
|
|||
juce::NormalisableRange<float>(0.05f, 20.0f, 0.01f, 0.4f), 2.0f));
|
||||
layout.add(std::make_unique<juce::AudioParameterFloat>(
|
||||
juce::ParameterID{"autoPanDepth", 1}, "Pan Depth", zeroOne, 0.0f));
|
||||
layout.add(std::make_unique<juce::AudioParameterFloat>(
|
||||
juce::ParameterID{"autoPanPhase", 1}, "Pan Phase", zeroOne, 0.0f));
|
||||
|
||||
// LIMITER
|
||||
layout.add(std::make_unique<juce::AudioParameterFloat>(
|
||||
juce::ParameterID{"limiterThreshold", 1}, "Limiter Threshold",
|
||||
juce::NormalisableRange<float>(0.0f, 1.0f, 0.001f, 0.3f), 1.0f));
|
||||
layout.add(std::make_unique<juce::AudioParameterFloat>(
|
||||
juce::ParameterID{"limiterCeiling", 1}, "Limiter Ceiling",
|
||||
juce::NormalisableRange<float>(0.0f, 1.0f, 0.001f, 0.3f), 0.9f));
|
||||
layout.add(std::make_unique<juce::AudioParameterFloat>(
|
||||
juce::ParameterID{"limiterRelease", 1}, "Limiter Release",
|
||||
juce::NormalisableRange<float>(1.0f, 500.0f, 0.1f), 50.0f));
|
||||
|
||||
// LFO 1
|
||||
layout.add(std::make_unique<juce::AudioParameterFloat>(
|
||||
|
|
@ -256,6 +269,7 @@ void ChromaFlockProcessor::prepareToPlay(double sampleRate, int samplesPerBlock)
|
|||
synth.setCurrentPlaybackSampleRate(sampleRate);
|
||||
distortion.prepare(sampleRate);
|
||||
compressor.prepare(sampleRate);
|
||||
limiter.prepare(sampleRate);
|
||||
delay.prepare(sampleRate);
|
||||
reverbFX.prepare(sampleRate);
|
||||
autoPanPhase = 0.0f;
|
||||
|
|
@ -402,6 +416,13 @@ void ChromaFlockProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::
|
|||
}
|
||||
delay.setParameters(delayTimeMs, getParam("delayFeedback"), getParam("delayMix"));
|
||||
reverbFX.setParameters(getParam("reverbSize"), getParam("reverbDamping"), 0.8f, getParam("reverbMix"));
|
||||
limiter.setParameters(getParam("limiterThreshold"), getParam("limiterCeiling"),
|
||||
getParam("limiterRelease"));
|
||||
|
||||
// Master fader applies a natural (perceptual) taper and is the final gain
|
||||
// stage, so it always controls output level regardless of the limiter.
|
||||
float masterValue = getParam("masterLevel");
|
||||
float masterGain = masterValue * masterValue;
|
||||
|
||||
// FX processing: distortion → compression → auto-pan
|
||||
int numSamples = buffer.getNumSamples();
|
||||
|
|
@ -421,9 +442,13 @@ void ChromaFlockProcessor::processBlock(juce::AudioBuffer<float>& buffer, juce::
|
|||
left = compressor.process(left);
|
||||
right = compressor.process(right);
|
||||
|
||||
// Brickwall limiter (stereo)
|
||||
left = limiter.process(left);
|
||||
right = limiter.process(right);
|
||||
|
||||
// Auto-pan
|
||||
if (panDepth > 0.001f) {
|
||||
float panLfo = std::sin(autoPanPhase * twoPi);
|
||||
float panLfo = std::sin((autoPanPhase + autoPanPhaseOffset) * twoPi);
|
||||
float leftGain = 1.0f - panDepth * 0.5f * (1.0f + panLfo);
|
||||
float rightGain = 1.0f - panDepth * 0.5f * (1.0f - panLfo);
|
||||
left *= leftGain;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue