Skip to content

Commit

Permalink
Apply new clang formatting to Compressor.* and PluginProcessor.*
Browse files Browse the repository at this point in the history
I'm going to be hacking on these for a video, so getting this out
of the way will be super helpful.
  • Loading branch information
JoseDiazRohena committed Sep 1, 2024
1 parent 0ef9a7a commit 387f2f5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
10 changes: 7 additions & 3 deletions libs/tote_bag/dsp/Compressor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void Compressor::setOversampleMultiplier (const int o)
overSampleMultiplier = o - 1;
}

inline void Compressor::makeMonoSidechain (const juce::dsp::AudioBlock<float>& inAudio, juce::AudioBuffer<float>& scSignal)
inline void Compressor::makeMonoSidechain (const juce::dsp::AudioBlock<float>& inAudio,
juce::AudioBuffer<float>& scSignal)
{
scSignal.clear();
auto* scWritePointer = scSignal.getWritePointer (0);
Expand Down Expand Up @@ -101,7 +102,9 @@ inline float Compressor::calculateGain (float inputSample)

else if (abs (doubleOvershoot) <= W)
{
cvOutput = inputSample + ((1.0f / R - 1.0f) * powf (overshoot + W / 2.0f, 2)) / (2.0f * W);
cvOutput =
inputSample
+ ((1.0f / R - 1.0f) * powf (overshoot + W / 2.0f, 2)) / (2.0f * W);
}
else
{
Expand Down Expand Up @@ -132,7 +135,8 @@ void Compressor::process (juce::dsp::AudioBlock<float>& inAudio)
{
auto controlVoltage = juce::Decibels::gainToDecibels (abs (sidechain[sample]));
// TODO: level detector methods should be float or templated
controlVoltage = static_cast<float> (levelDetector.processSampleDecoupledBranched (controlVoltage));
controlVoltage = static_cast<float> (
levelDetector.processSampleDecoupledBranched (controlVoltage));

controlVoltage = calculateGain (controlVoltage);
controlVoltage = juce::Decibels::decibelsToGain (controlVoltage);
Expand Down
12 changes: 5 additions & 7 deletions libs/tote_bag/dsp/Compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class Compressor
float inThreshold,
float inKnee);

void makeMonoSidechain (const juce::dsp::AudioBlock<float>& inAudio, juce::AudioBuffer<float>& scSignal);
void makeMonoSidechain (const juce::dsp::AudioBlock<float>& inAudio,
juce::AudioBuffer<float>& scSignal);

void makeKneeCoeffs();

Expand All @@ -51,16 +52,13 @@ class Compressor
private:
juce::WeakReference<FFAU::LevelMeterSource> meterSource;

juce::Atomic<float> ratio { -1.0f },
knee { -1.0f },
msAttack { -1.0f },
msRelease { -1.0f },
threshold { -1.0 };
juce::Atomic<float> ratio {-1.0f}, knee {-1.0f}, msAttack {-1.0f}, msRelease {-1.0f},
threshold {-1.0};

EnvelopeDetector levelDetector;
juce::AudioBuffer<float> analysisSignal;

int overSampleMultiplier { 1 };
int overSampleMultiplier {1};

JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Compressor)
};
4 changes: 2 additions & 2 deletions src/PluginProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ class ValentineAudioProcessor : public juce::AudioProcessor,
FFCompParameterDefaults[static_cast<size_t> (VParameter::outputClipEnable)]
> 0.5f};
bool clipOnState = clipOn.get();
juce::Atomic<bool> saturateOn = FFCompParameterDefaults[static_cast<size_t> (VParameter::saturateEnable)]
> 0.5f;
juce::Atomic<bool> saturateOn =
FFCompParameterDefaults[static_cast<size_t> (VParameter::saturateEnable)] > 0.5f;
bool saturateOnState = saturateOn.get();

// This is used for, yes you guessed it, processing
Expand Down

0 comments on commit 387f2f5

Please sign in to comment.