Skip to content

Commit

Permalink
Enable PCH
Browse files Browse the repository at this point in the history
  • Loading branch information
jatinchowdhury18 committed Dec 6, 2023
1 parent 7c28f4f commit a829d35
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,4 @@ set_source_files_properties(${juce_module_sources}
TARGET_DIRECTORY BYOD
PROPERTIES SKIP_PRECOMPILE_HEADERS TRUE SKIP_UNITY_BUILD_INCLUSION TRUE)
set_target_properties(BYOD PROPERTIES UNITY_BUILD ON UNITY_BUILD_BATCH_SIZE 8)
target_precompile_headers(BYOD PRIVATE pch.h)
12 changes: 6 additions & 6 deletions src/processors/drive/big_muff/BigMuffClippingStage.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "BigMuffClippingStage.h"

namespace
namespace BigMuffMath
{
// circuit component values
constexpr float C5 = 100.0e-9f;
Expand Down Expand Up @@ -63,8 +63,8 @@ void BigMuffClippingStage::prepare (double sampleRate)
fs = (float) sampleRate;

// set coefficients for input filter
float b_s[] = { C5 * R20, 0.0f };
float a_s[] = { C5 * (R19 + R20), 1.0f };
float b_s[] = { BigMuffMath::C5 * BigMuffMath::R20, 0.0f };
float a_s[] = { BigMuffMath::C5 * (BigMuffMath::R19 + BigMuffMath::R20), 1.0f };
float b[2];
float a[2];
chowdsp::ConformalMaps::Transform<float, 1>::bilinear (b, a, b_s, a_s, 2.0f * fs);
Expand All @@ -88,7 +88,7 @@ void BigMuffClippingStage::reset()
float BigMuffClippingStage::getGC12 (float fs, float smoothing)
{
// capacitor C12 admittance, smoothing adds or removes 200 pF
return 2.0f * (C12 + smoothing * 200.0e-12f) * fs;
return 2.0f * (BigMuffMath::C12 + smoothing * 200.0e-12f) * fs;
}

template <bool highQuality>
Expand All @@ -103,10 +103,10 @@ void BigMuffClippingStage::processBlock (AudioBuffer<float>& buffer, const chowd
auto u_n = inputFilter[ch].processSample (x);

// newton-raphson
float y_k = newton_raphson<(highQuality ? 8 : 4)> (u_n, y_1[ch], C_12_1[ch], G_C_12);
float y_k = BigMuffMath::newton_raphson<(highQuality ? 8 : 4)> (u_n, y_1[ch], C_12_1[ch], G_C_12);

// update state
C_12_1[ch] = 2.0f * (y_k - VbiasA) * G_C_12 - C_12_1[ch];
C_12_1[ch] = 2.0f * (y_k - BigMuffMath::VbiasA) * G_C_12 - C_12_1[ch];
y_1[ch] = y_k;

return y_k;
Expand Down
14 changes: 7 additions & 7 deletions src/processors/drive/muff_clipper/MuffClipperStage.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "MuffClipperStage.h"

namespace
namespace MuffClipperMath
{
// circuit component values
constexpr float C5 = 100.0e-9f;
Expand Down Expand Up @@ -63,8 +63,8 @@ void MuffClipperStage::prepare (double sampleRate)
fs = (float) sampleRate;

// set coefficients for input filter
float b_s[] = { C5 * R20, 0.0f };
float a_s[] = { C5 * (R19 + R20), 1.0f };
float b_s[] = { MuffClipperMath::C5 * MuffClipperMath::R20, 0.0f };
float a_s[] = { MuffClipperMath::C5 * (MuffClipperMath::R19 + MuffClipperMath::R20), 1.0f };
float b[2];
float a[2];
chowdsp::ConformalMaps::Transform<float, 1>::bilinear (b, a, b_s, a_s, 2.0f * fs);
Expand All @@ -88,12 +88,12 @@ void MuffClipperStage::reset()
float MuffClipperStage::getGC12 (float fs, float smoothing)
{
// capacitor C12 admittance, scaled by smoothing
return 2.0f * C12 * (smoothing + 1.0f) * fs;
return 2.0f * MuffClipperMath::C12 * (smoothing + 1.0f) * fs;
}

float MuffClipperStage::getClipV (float clip)
{
return (clip + 1.0f) / Vt; // Vt_recip value needed by newton_raphson and sinh_cosh_asym
return (clip + 1.0f) / MuffClipperMath::Vt; // Vt_recip value needed by newton_raphson and sinh_cosh_asym
}

template <bool highQuality>
Expand All @@ -111,10 +111,10 @@ void MuffClipperStage::processBlock (AudioBuffer<float>& buffer,
auto u_n = inputFilter[ch].processSample (x);

// newton-raphson
float y_k = newton_raphson<(highQuality ? 8 : 4)> (u_n, y_1[ch], C_12_1[ch], G_C_12, clip1V_recip, clip2V_recip);
float y_k = MuffClipperMath::newton_raphson<(highQuality ? 8 : 4)> (u_n, y_1[ch], C_12_1[ch], G_C_12, clip1V_recip, clip2V_recip);

// update state
C_12_1[ch] = 2.0f * (y_k - VbiasA) * G_C_12 - C_12_1[ch];
C_12_1[ch] = 2.0f * (y_k - MuffClipperMath::VbiasA) * G_C_12 - C_12_1[ch];
y_1[ch] = y_k;

return y_k;
Expand Down

0 comments on commit a829d35

Please sign in to comment.