diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1cccf408..3ad7ec1d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/src/processors/drive/big_muff/BigMuffClippingStage.cpp b/src/processors/drive/big_muff/BigMuffClippingStage.cpp index 94561615..c34182cd 100644 --- a/src/processors/drive/big_muff/BigMuffClippingStage.cpp +++ b/src/processors/drive/big_muff/BigMuffClippingStage.cpp @@ -1,6 +1,6 @@ #include "BigMuffClippingStage.h" -namespace +namespace BigMuffMath { // circuit component values constexpr float C5 = 100.0e-9f; @@ -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::bilinear (b, a, b_s, a_s, 2.0f * fs); @@ -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 @@ -103,10 +103,10 @@ void BigMuffClippingStage::processBlock (AudioBuffer& 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; diff --git a/src/processors/drive/muff_clipper/MuffClipperStage.cpp b/src/processors/drive/muff_clipper/MuffClipperStage.cpp index eab46ba2..aee40bd1 100644 --- a/src/processors/drive/muff_clipper/MuffClipperStage.cpp +++ b/src/processors/drive/muff_clipper/MuffClipperStage.cpp @@ -1,6 +1,6 @@ #include "MuffClipperStage.h" -namespace +namespace MuffClipperMath { // circuit component values constexpr float C5 = 100.0e-9f; @@ -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::bilinear (b, a, b_s, a_s, 2.0f * fs); @@ -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 @@ -111,10 +111,10 @@ void MuffClipperStage::processBlock (AudioBuffer& 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;