From 7c28f4ff05e548b2ec54ea18c33ca428102ea406 Mon Sep 17 00:00:00 2001 From: jatin Date: Tue, 5 Dec 2023 17:47:00 -0800 Subject: [PATCH 1/4] Trying out CMake unity builds --- .github/workflows/arm-mac.yml | 18 +++++ CMakeLists.txt | 2 + src/BYOD.cpp | 1 + src/BYOD.h | 5 +- src/CMakeLists.txt | 10 ++- .../toolbar/presets/PresetSearchWindow.cpp | 8 +-- src/gui/toolbar/presets/PresetsSaveDialog.cpp | 22 +++--- src/processors/drive/centaur/Centaur.cpp | 16 ++--- src/processors/drive/flapjack/Flapjack.cpp | 22 +++--- .../drive/fuzz_machine/FuzzMachine.h | 1 - src/processors/modulation/Tremolo.cpp | 31 ++------- src/processors/modulation/phaser/Phaser4.cpp | 32 ++++----- src/processors/modulation/phaser/Phaser8.cpp | 22 +++--- .../scanner_vibrato/ScannerVibrato.cpp | 67 +++++++++---------- .../modulation/uni_vibe/UniVibe.cpp | 26 +++---- src/processors/other/Delay.cpp | 58 ++++++++-------- src/processors/other/Octaver.cpp | 14 ++-- 17 files changed, 182 insertions(+), 173 deletions(-) diff --git a/.github/workflows/arm-mac.yml b/.github/workflows/arm-mac.yml index 50dcef25..8a6d3ffe 100644 --- a/.github/workflows/arm-mac.yml +++ b/.github/workflows/arm-mac.yml @@ -38,6 +38,24 @@ jobs: path: modules/BYOD-add-ons token: ${{ secrets.OUR_GITHUB_PAT }} + - name: Checkout Jai + uses: actions/checkout@v2 + if: github.actor == 'jatinchowdhury18' + with: + ref: main + repository: Chowdhury-DSP/jai-minimal + token: ${{ secrets.OUR_GITHUB_PAT }} + path: modules/jai + + - name: Checkout math_approx + uses: actions/checkout@v2 + if: github.actor == 'jatinchowdhury18' + with: + ref: main + repository: Chowdhury-DSP/math_approx + token: ${{ secrets.OUR_GITHUB_PAT }} + path: modules/math_approx + - name: Configure shell: bash run: cmake -Bbuild -GXcode $CONFIGURE_ADD_ONS_FLAG -D"CMAKE_OSX_ARCHITECTURES=arm64" diff --git a/CMakeLists.txt b/CMakeLists.txt index a22855be..97ab9344 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,8 @@ set(CMAKE_CXX_STANDARD 20) # Useful for testing with address sanitizer: # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -g") +# Useful for measuring build times: +# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftime-trace -g") if (NOT IOS) option(BYOD_BUILD_CLAP "Create a CLAP target for BYOD" ON) diff --git a/src/BYOD.cpp b/src/BYOD.cpp index 624479b0..f96c0db1 100644 --- a/src/BYOD.cpp +++ b/src/BYOD.cpp @@ -1,6 +1,7 @@ #include "BYOD.h" #include "gui/BYODPluginEditor.h" #include "state/presets/PresetManager.h" +#include "state/StateManager.h" namespace { diff --git a/src/BYOD.h b/src/BYOD.h index f4229c29..6f200bc0 100644 --- a/src/BYOD.h +++ b/src/BYOD.h @@ -1,13 +1,12 @@ #pragma once -#include "processors/PlayheadHelpers.h" #include "processors/ProcessorStore.h" #include "processors/chain/ProcessorChain.h" -#include "state/ParamForwardManager.h" -#include "state/StateManager.h" JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wattributes", "-Woverloaded-virtual") +class ParamForwardManager; +class StateManager; class BYOD : public chowdsp::PluginBase { public: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9225fabe..1cccf408 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,7 +77,6 @@ target_sources(BYOD PRIVATE processors/drive/diode_circuits/DiodeRectifier.cpp processors/drive/flapjack/Flapjack.cpp processors/drive/fuzz_machine/FuzzMachine.cpp - processors/drive/fuzz_machine/FuzzFaceNDK.cpp processors/drive/hysteresis/Hysteresis.cpp processors/drive/hysteresis/HysteresisProcessing.cpp processors/drive/junior_b/JuniorB.cpp @@ -196,3 +195,12 @@ target_link_libraries(BYOD PRIVATE rnn_accelerated) if (MSVC) target_compile_options(BYOD PRIVATE /bigobj) endif () + +file(GLOB_RECURSE juce_module_sources CONFIGURE_DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/../modules/JUCE/modules/juce_*/*.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/../modules/JUCE/modules/juce_*/*.mm + ${CMAKE_CURRENT_SOURCE_DIR}/../modules/JUCE/modules/chowdsp_utils/modules/*/chowdsp_*/*.cpp) +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) diff --git a/src/gui/toolbar/presets/PresetSearchWindow.cpp b/src/gui/toolbar/presets/PresetSearchWindow.cpp index ea32cae0..5de43bbd 100644 --- a/src/gui/toolbar/presets/PresetSearchWindow.cpp +++ b/src/gui/toolbar/presets/PresetSearchWindow.cpp @@ -1,6 +1,6 @@ #include "PresetSearchWindow.h" -namespace +namespace PresetSearchDims { constexpr int rowHeight = 40; constexpr int itemHeight = rowHeight + 20; @@ -107,7 +107,7 @@ PresetSearchWindow::PresetSearchWindow (chowdsp::PresetManager& presetMgr) : pre resultsBox.setColour (ListBox::outlineColourId, Colours::white); resultsBox.setColour (ListBox::backgroundColourId, Colours::transparentBlack); resultsBox.setOutlineThickness (1); - resultsBox.setRowHeight (rowHeight); + resultsBox.setRowHeight (PresetSearchDims::rowHeight); addAndMakeVisible (resultsBox); numResultsLabel.setColour (Label::backgroundColourId, Colours::transparentBlack); @@ -130,8 +130,8 @@ void PresetSearchWindow::resized() auto bounds = getLocalBounds(); const auto footer = bounds.removeFromBottom (20); - searchEntryBox->setFont ((float) rowHeight * 0.55f); - searchEntryBox->setBounds (bounds.removeFromTop (itemHeight).reduced (10, 10)); + searchEntryBox->setFont ((float) PresetSearchDims::rowHeight * 0.55f); + searchEntryBox->setBounds (bounds.removeFromTop (PresetSearchDims::itemHeight).reduced (10, 10)); resultsBox.setBounds (bounds.reduced (10, 0)); numResultsLabel.setBounds (footer.reduced (10, 1)); } diff --git a/src/gui/toolbar/presets/PresetsSaveDialog.cpp b/src/gui/toolbar/presets/PresetsSaveDialog.cpp index d963226c..6dedf592 100644 --- a/src/gui/toolbar/presets/PresetsSaveDialog.cpp +++ b/src/gui/toolbar/presets/PresetsSaveDialog.cpp @@ -2,7 +2,7 @@ #include "gui/utils/ErrorMessageView.h" #include "state/presets/PresetInfoHelpers.h" -namespace +namespace PresetSaveDims { constexpr int headerHeight = 40; constexpr int footerHeight = 50; @@ -89,15 +89,15 @@ void PresetsSaveDialog::paint (Graphics& g) g.fillAll (Colours::black); g.setColour (Colours::white); - g.setFont ((float) headerHeight * 0.5f); - const auto headerBounds = getLocalBounds().removeFromTop (headerHeight); + g.setFont ((float) PresetSaveDims::headerHeight * 0.5f); + const auto headerBounds = getLocalBounds().removeFromTop (PresetSaveDims::headerHeight); const auto headerText = isSaveMode ? "Save Preset:" : "Edit Preset"; g.drawFittedText (headerText, headerBounds, Justification::centred, 1); - g.setFont ((float) itemHeight * 0.35f); + g.setFont ((float) PresetSaveDims::itemHeight * 0.35f); auto drawItemLabel = [&] (const Component& comp, const String& label) { - auto textBounds = Rectangle { labelsWidth, comp.getHeight() }.withY (comp.getY()); + auto textBounds = Rectangle { PresetSaveDims::labelsWidth, comp.getHeight() }.withY (comp.getY()); g.drawFittedText (label, textBounds, Justification::centredRight, 1); }; @@ -108,15 +108,15 @@ void PresetsSaveDialog::paint (Graphics& g) void PresetsSaveDialog::resized() { auto bounds = getLocalBounds(); - bounds.removeFromTop (headerHeight); - auto footerBounds = bounds.removeFromBottom (footerHeight); + bounds.removeFromTop (PresetSaveDims::headerHeight); + auto footerBounds = bounds.removeFromBottom (PresetSaveDims::footerHeight); - bounds.removeFromLeft (labelsWidth); - nameLabel.setBounds (bounds.removeFromTop (itemHeight).reduced (10, 5)); - categoryLabel.setBounds (bounds.removeFromTop (itemHeight).reduced (10, 5)); + bounds.removeFromLeft (PresetSaveDims::labelsWidth); + nameLabel.setBounds (bounds.removeFromTop (PresetSaveDims::itemHeight).reduced (10, 5)); + categoryLabel.setBounds (bounds.removeFromTop (PresetSaveDims::itemHeight).reduced (10, 5)); #if BYOD_BUILD_PRESET_SERVER - publicSwitch.setBounds (bounds.removeFromTop (itemHeight).reduced (10, 5).withWidth (100)); + publicSwitch.setBounds (bounds.removeFromTop (PresetSaveDims::itemHeight).reduced (10, 5).withWidth (100)); #endif okButton.setBounds (footerBounds.removeFromLeft (proportionOfWidth (0.5f)).reduced (5)); diff --git a/src/processors/drive/centaur/Centaur.cpp b/src/processors/drive/centaur/Centaur.cpp index 893b525a..25d4371d 100644 --- a/src/processors/drive/centaur/Centaur.cpp +++ b/src/processors/drive/centaur/Centaur.cpp @@ -1,7 +1,7 @@ #include "Centaur.h" #include "processors/netlist_helpers/NetlistViewer.h" -namespace +namespace CentaurTags { const String gainTag = "gain"; const String levelTag = "level"; @@ -12,10 +12,10 @@ Centaur::Centaur (UndoManager* um) : BaseProcessor ("Centaur", createParameterLa gainStageML (vts) { using namespace ParameterHelpers; - loadParameterPointer (gainParam, vts, gainTag); - loadParameterPointer (levelParam, vts, levelTag); - modeParam = vts.getRawParameterValue (modeTag); - addPopupMenuParameter (modeTag); + loadParameterPointer (gainParam, vts, CentaurTags::gainTag); + loadParameterPointer (levelParam, vts, CentaurTags::levelTag); + modeParam = vts.getRawParameterValue (CentaurTags::modeTag); + addPopupMenuParameter (CentaurTags::modeTag); uiOptions.backgroundColour = Colour (0xFFDAA520); uiOptions.powerColour = Colour (0xFF14CBF2).brighter (0.5f); @@ -321,9 +321,9 @@ ParamLayout Centaur::createParameterLayout() using namespace ParameterHelpers; auto params = createBaseParams(); - createPercentParameter (params, gainTag, "Gain", 0.5f); - createPercentParameter (params, levelTag, "Level", 0.5f); - emplace_param (params, modeTag, "Mode", StringArray { "Traditional", "Neural" }, 0); + createPercentParameter (params, CentaurTags::gainTag, "Gain", 0.5f); + createPercentParameter (params, CentaurTags::levelTag, "Level", 0.5f); + emplace_param (params, CentaurTags::modeTag, "Mode", StringArray { "Traditional", "Neural" }, 0); return { params.begin(), params.end() }; } diff --git a/src/processors/drive/flapjack/Flapjack.cpp b/src/processors/drive/flapjack/Flapjack.cpp index 3856c628..dd5cbf74 100644 --- a/src/processors/drive/flapjack/Flapjack.cpp +++ b/src/processors/drive/flapjack/Flapjack.cpp @@ -10,7 +10,7 @@ // - transistor is _active_ // - bias voltage = 4V -namespace +namespace FlapjackTags { const auto driveTag = "drive"; const auto presenceTag = "presence"; @@ -24,7 +24,7 @@ Flapjack::Flapjack (UndoManager* um) { using namespace ParameterHelpers; - driveParam.setParameterHandle (getParameterPointer (vts, driveTag)); + driveParam.setParameterHandle (getParameterPointer (vts, FlapjackTags::driveTag)); driveParam.setRampLength (0.025); driveParam.mappingFunction = [this] (float x) { @@ -32,13 +32,13 @@ Flapjack::Flapjack (UndoManager* um) x *= 0.9f; return chowdsp::Power::ipow<2> (1.0f - x); }; - presenceParam.setParameterHandle (getParameterPointer (vts, presenceTag)); + presenceParam.setParameterHandle (getParameterPointer (vts, FlapjackTags::presenceTag)); presenceParam.setRampLength (0.025); - lowCutParam.setParameterHandle (getParameterPointer (vts, lowCutTag)); + lowCutParam.setParameterHandle (getParameterPointer (vts, FlapjackTags::lowCutTag)); lowCutParam.setRampLength (0.025); - loadParameterPointer (levelParam, vts, levelTag); - loadParameterPointer (modeParam, vts, modeTag); + loadParameterPointer (levelParam, vts, FlapjackTags::levelTag); + loadParameterPointer (modeParam, vts, FlapjackTags::modeTag); uiOptions.backgroundColour = Colours::whitesmoke.darker (0.1f); uiOptions.powerColour = Colours::red.darker (0.2f); @@ -155,11 +155,11 @@ ParamLayout Flapjack::createParameterLayout() using namespace ParameterHelpers; auto params = createBaseParams(); - createPercentParameter (params, driveTag, "Drive", 0.75f); - createPercentParameter (params, presenceTag, "Presence", 0.5f); - createFreqParameter (params, lowCutTag, "Low Cut", 20.0f, 750.0f, 100.0f, 100.0f); - createPercentParameter (params, levelTag, "Level", 0.5f); - emplace_param (params, modeTag, "Mode", StringArray { "Fizzy", "Bluesberry", "Peachy" }, 1); + createPercentParameter (params, FlapjackTags::driveTag, "Drive", 0.75f); + createPercentParameter (params, FlapjackTags::presenceTag, "Presence", 0.5f); + createFreqParameter (params, FlapjackTags::lowCutTag, "Low Cut", 20.0f, 750.0f, 100.0f, 100.0f); + createPercentParameter (params, FlapjackTags::levelTag, "Level", 0.5f); + emplace_param (params, FlapjackTags::modeTag, "Mode", StringArray { "Fizzy", "Bluesberry", "Peachy" }, 1); return { params.begin(), params.end() }; } diff --git a/src/processors/drive/fuzz_machine/FuzzMachine.h b/src/processors/drive/fuzz_machine/FuzzMachine.h index a52ccc19..2984ce67 100644 --- a/src/processors/drive/fuzz_machine/FuzzMachine.h +++ b/src/processors/drive/fuzz_machine/FuzzMachine.h @@ -2,7 +2,6 @@ #include "processors/BaseProcessor.h" -#include "FuzzFaceNDK.h" #include "processors/drive/neural_utils/ResampledRNNAccelerated.h" class FuzzMachine : public BaseProcessor diff --git a/src/processors/modulation/Tremolo.cpp b/src/processors/modulation/Tremolo.cpp index 70b13e82..4a8c7aa2 100644 --- a/src/processors/modulation/Tremolo.cpp +++ b/src/processors/modulation/Tremolo.cpp @@ -2,27 +2,10 @@ #include "../BufferHelpers.h" #include "../ParameterHelpers.h" -namespace +namespace TremoloTags { -template -static dsp::AudioBlock& addSmoothed (dsp::AudioBlock& block, SmoothedValue& value) noexcept -{ - if (! value.isSmoothing()) - return block.add (value.getTargetValue()); - - for (size_t i = 0; i < block.getNumSamples(); ++i) - { - const auto scaler = value.getNextValue(); - for (size_t ch = 0; ch < block.getNumChannels(); ++ch) - block.getChannelPointer (ch)[i] += scaler; - } - - return block; -} - const String stereoTag = "stereo"; const String v1WaveTag = "v1_wave"; - } // namespace Tremolo::Tremolo (UndoManager* um) : BaseProcessor ( @@ -48,11 +31,11 @@ Tremolo::Tremolo (UndoManager* um) : BaseProcessor ( loadParameterPointer (rateParam, vts, "rate"); loadParameterPointer (waveParam, vts, "wave"); loadParameterPointer (depthParam, vts, "depth"); - loadParameterPointer (stereoParam, vts, stereoTag); - loadParameterPointer (v1WaveParam, vts, v1WaveTag); + loadParameterPointer (stereoParam, vts, TremoloTags::stereoTag); + loadParameterPointer (v1WaveParam, vts, TremoloTags::v1WaveTag); - addPopupMenuParameter (stereoTag); - addPopupMenuParameter (v1WaveTag); + addPopupMenuParameter (TremoloTags::stereoTag); + addPopupMenuParameter (TremoloTags::v1WaveTag); uiOptions.backgroundColour = Colours::orange.darker (0.1f); uiOptions.powerColour = Colours::cyan.brighter(); @@ -70,8 +53,8 @@ ParamLayout Tremolo::createParameterLayout() createPercentParameter (params, "wave", "Wave", 0.5f); createPercentParameter (params, "depth", "Depth", 0.5f); - emplace_param (params, stereoTag, "Stereo", false); - emplace_param (params, v1WaveTag, "V1 Wave", false); + emplace_param (params, TremoloTags::stereoTag, "Stereo", false); + emplace_param (params, TremoloTags::v1WaveTag, "V1 Wave", false); return { params.begin(), params.end() }; } diff --git a/src/processors/modulation/phaser/Phaser4.cpp b/src/processors/modulation/phaser/Phaser4.cpp index 452bb4a5..e3033289 100644 --- a/src/processors/modulation/phaser/Phaser4.cpp +++ b/src/processors/modulation/phaser/Phaser4.cpp @@ -3,7 +3,7 @@ #include "processors/ParameterHelpers.h" #include "processors/netlist_helpers/CircuitQuantity.h" -namespace +namespace Phaser4Tags { const String rateTag = "rate"; const String depthTag = "depth"; @@ -33,19 +33,19 @@ Phaser4::Phaser4 (UndoManager* um) : BaseProcessor ( }) { using namespace ParameterHelpers; - loadParameterPointer (rateHzParam, vts, rateTag); - loadParameterPointer (fbStageParam, vts, fbStageTag); - loadParameterPointer (stereoParam, vts, stereoTag); + loadParameterPointer (rateHzParam, vts, Phaser4Tags::rateTag); + loadParameterPointer (fbStageParam, vts, Phaser4Tags::fbStageTag); + loadParameterPointer (stereoParam, vts, Phaser4Tags::stereoTag); - depthParam.setParameterHandle (getParameterPointer (vts, depthTag)); + depthParam.setParameterHandle (getParameterPointer (vts, Phaser4Tags::depthTag)); depthParam.mappingFunction = [] (float x) { return 0.45f * x; }; - feedbackParam.setParameterHandle (getParameterPointer (vts, feedbackTag)); + feedbackParam.setParameterHandle (getParameterPointer (vts, Phaser4Tags::feedbackTag)); feedbackParam.mappingFunction = [] (float x) { return 0.95f * x; }; - const auto* mixParam = getParameterPointer (vts, mixTag); + const auto* mixParam = getParameterPointer (vts, Phaser4Tags::mixTag); dryMix.setParameterHandle (mixParam); dryMix.setRampLength (0.05); dryMix.mappingFunction = [] (float x) @@ -61,8 +61,8 @@ Phaser4::Phaser4 (UndoManager* um) : BaseProcessor ( 1.0f, 2048); - addPopupMenuParameter (stereoTag); - disableWhenInputConnected ({ rateTag }, ModulationInput); + addPopupMenuParameter (Phaser4Tags::stereoTag); + disableWhenInputConnected ({ Phaser4Tags::rateTag }, ModulationInput); uiOptions.backgroundColour = Colour { 0xfffc7533 }; uiOptions.powerColour = Colours::cyan.brighter (0.1f); @@ -109,16 +109,16 @@ ParamLayout Phaser4::createParameterLayout() using namespace ParameterHelpers; auto params = createBaseParams(); - createFreqParameter (params, rateTag, "Rate", 0.1f, 10.0f, 1.0f, 1.0f); - createPercentParameter (params, depthTag, "Depth", 1.0f); - createBipolarPercentParameter (params, feedbackTag, "Feedback", 0.6f); - createPercentParameter (params, mixTag, "Mix", 0.5f); + createFreqParameter (params, Phaser4Tags::rateTag, "Rate", 0.1f, 10.0f, 1.0f, 1.0f); + createPercentParameter (params, Phaser4Tags::depthTag, "Depth", 1.0f); + createBipolarPercentParameter (params, Phaser4Tags::feedbackTag, "Feedback", 0.6f); + createPercentParameter (params, Phaser4Tags::mixTag, "Mix", 0.5f); emplace_param (params, - fbStageTag, + Phaser4Tags::fbStageTag, "FB Stage", StringArray { "2nd Stage", "3rd Stage", "4th Stage" }, 0); - emplace_param (params, stereoTag, "Stereo", false); + emplace_param (params, Phaser4Tags::stereoTag, "Stereo", false); return { params.begin(), params.end() }; } @@ -270,7 +270,7 @@ void Phaser4::fromXML (XmlElement* xml, const chowdsp::Version& version, bool lo if (version <= chowdsp::Version { "1.2.0"sv }) { // The "Mix" control was only introduced in version 1.2.1. Prior to that, mix was always at 100% wet. - auto* mixParam = vts.getParameter (mixTag); + auto* mixParam = vts.getParameter (Phaser4Tags::mixTag); mixParam->setValueNotifyingHost (1.0f); } } diff --git a/src/processors/modulation/phaser/Phaser8.cpp b/src/processors/modulation/phaser/Phaser8.cpp index 9df3a6bf..9ec452e1 100644 --- a/src/processors/modulation/phaser/Phaser8.cpp +++ b/src/processors/modulation/phaser/Phaser8.cpp @@ -2,7 +2,7 @@ #include "processors/BufferHelpers.h" #include "processors/ParameterHelpers.h" -namespace +namespace Phaser8Tags { const String rateTag = "rate"; const String depthTag = "depth"; @@ -30,18 +30,18 @@ Phaser8::Phaser8 (UndoManager* um) : BaseProcessor ( }) { using namespace ParameterHelpers; - loadParameterPointer (rateHzParam, vts, rateTag); + loadParameterPointer (rateHzParam, vts, Phaser8Tags::rateTag); - depthParam.setParameterHandle (getParameterPointer (vts, depthTag)); + depthParam.setParameterHandle (getParameterPointer (vts, Phaser8Tags::depthTag)); depthParam.mappingFunction = [] (float x) { return 0.45f * x; }; - feedbackParam.setParameterHandle (getParameterPointer (vts, feedbackTag)); + feedbackParam.setParameterHandle (getParameterPointer (vts, Phaser8Tags::feedbackTag)); feedbackParam.mappingFunction = [] (float x) { return 0.95f * x; }; - modSmooth.setParameterHandle (getParameterPointer (vts, modulationTag)); - noModSmooth.setParameterHandle (getParameterPointer (vts, modulationTag)); + modSmooth.setParameterHandle (getParameterPointer (vts, Phaser8Tags::modulationTag)); + noModSmooth.setParameterHandle (getParameterPointer (vts, Phaser8Tags::modulationTag)); noModSmooth.mappingFunction = [] (float x) { return 1.0f - x; }; @@ -53,7 +53,7 @@ Phaser8::Phaser8 (UndoManager* um) : BaseProcessor ( 1.0f, 2048); - disableWhenInputConnected ({ rateTag }, ModulationInput); + disableWhenInputConnected ({ Phaser8Tags::rateTag }, ModulationInput); uiOptions.backgroundColour = Colour { 0xff00a8e9 }; uiOptions.powerColour = Colour { 0xfff44e44 }; @@ -66,10 +66,10 @@ ParamLayout Phaser8::createParameterLayout() using namespace ParameterHelpers; auto params = createBaseParams(); - createFreqParameter (params, rateTag, "Rate", 0.1f, 20.0f, 1.0f, 1.0f); - createPercentParameter (params, depthTag, "Depth", 1.0f); - createPercentParameter (params, feedbackTag, "Feedback", 0.75f); - createPercentParameter (params, modulationTag, "Modulation", 0.75f); + createFreqParameter (params, Phaser8Tags::rateTag, "Rate", 0.1f, 20.0f, 1.0f, 1.0f); + createPercentParameter (params, Phaser8Tags::depthTag, "Depth", 1.0f); + createPercentParameter (params, Phaser8Tags::feedbackTag, "Feedback", 0.75f); + createPercentParameter (params, Phaser8Tags::modulationTag, "Modulation", 0.75f); return { params.begin(), params.end() }; } diff --git a/src/processors/modulation/scanner_vibrato/ScannerVibrato.cpp b/src/processors/modulation/scanner_vibrato/ScannerVibrato.cpp index 0e8035fa..183ef3e4 100644 --- a/src/processors/modulation/scanner_vibrato/ScannerVibrato.cpp +++ b/src/processors/modulation/scanner_vibrato/ScannerVibrato.cpp @@ -2,25 +2,13 @@ #include "processors/BufferHelpers.h" #include "processors/ParameterHelpers.h" -namespace +namespace ScannerVibratoTags { const String rateTag = "rate"; const String depthTag = "depth"; const String mixTag = "mix"; const String modeTag = "mode"; const String stereoTag = "stereo"; - -constexpr auto o16 = 1.0f / 16.0f; -float ramp_up (float x, int off) -{ - const auto y = 16.0f * (x - (float) off * o16); - return (y > 1.0f || y < 0.0f) ? 0.0f : y; -} -float ramp_down (float x, int off) -{ - const auto y = 1.0f - 16.0f * (x - (float) off * o16); - return (y > 1.0f || y < 0.0f) ? 0.0f : y; -} } // namespace ScannerVibrato::ScannerVibrato (UndoManager* um) : BaseProcessor ( @@ -43,41 +31,52 @@ ScannerVibrato::ScannerVibrato (UndoManager* um) : BaseProcessor ( }) { using namespace ParameterHelpers; - loadParameterPointer (rateHzParam, vts, rateTag); - loadParameterPointer (mixParam, vts, mixTag); - loadParameterPointer (modeParam, vts, modeTag); - loadParameterPointer (stereoParam, vts, stereoTag); + loadParameterPointer (rateHzParam, vts, ScannerVibratoTags::rateTag); + loadParameterPointer (mixParam, vts, ScannerVibratoTags::mixTag); + loadParameterPointer (modeParam, vts, ScannerVibratoTags::modeTag); + loadParameterPointer (stereoParam, vts, ScannerVibratoTags::stereoTag); - addPopupMenuParameter (stereoTag); + addPopupMenuParameter (ScannerVibratoTags::stereoTag); - depthParam.setParameterHandle (getParameterPointer (vts, depthTag)); + depthParam.setParameterHandle (getParameterPointer (vts, ScannerVibratoTags::depthTag)); depthParam.setRampLength (0.05); depthParam.mappingFunction = [] (float x) { return 0.5f * x; }; + static constexpr auto o16 = 1.0f / 16.0f; + const auto ramp_up = [] (float x, int off) + { + const auto y = 16.0f * (x - (float) off * o16); + return (y > 1.0f || y < 0.0f) ? 0.0f : y; + }; + const auto ramp_down = [] (float x, int off) + { + const auto y = 1.0f - 16.0f * (x - (float) off * o16); + return (y > 1.0f || y < 0.0f) ? 0.0f : y; + }; const auto initTable = [this] (int index, auto&& func) { tapMixTable[index].initialise (func, 0.0f, 1.0f, 1024); }; - initTable (0, [] (float x) + initTable (0, [ramp_up, ramp_down] (float x) { return ramp_up (x, 0) + ramp_down (x, 1); }); - initTable (1, [] (float x) + initTable (1, [ramp_up, ramp_down] (float x) { return ramp_up (x, 1) + ramp_down (x, 2) + ramp_up (x, 15) + ramp_down (x, 0); }); - initTable (2, [] (float x) + initTable (2, [ramp_up, ramp_down] (float x) { return ramp_up (x, 2) + ramp_down (x, 3) + ramp_up (x, 14) + ramp_down (x, 15); }); - initTable (3, [] (float x) + initTable (3, [ramp_up, ramp_down] (float x) { return ramp_up (x, 3) + ramp_down (x, 4) + ramp_up (x, 13) + ramp_down (x, 14); }); - initTable (4, [] (float x) + initTable (4, [ramp_up, ramp_down] (float x) { return ramp_up (x, 4) + ramp_down (x, 5) + ramp_up (x, 12) + ramp_down (x, 13); }); - initTable (5, [] (float x) + initTable (5, [ramp_up, ramp_down] (float x) { return ramp_up (x, 5) + ramp_down (x, 6) + ramp_up (x, 11) + ramp_down (x, 12); }); - initTable (6, [] (float x) + initTable (6, [ramp_up, ramp_down] (float x) { return ramp_up (x, 6) + ramp_down (x, 7) + ramp_up (x, 10) + ramp_down (x, 11); }); - initTable (7, [] (float x) + initTable (7, [ramp_up, ramp_down] (float x) { return ramp_up (x, 7) + ramp_down (x, 8) + ramp_up (x, 9) + ramp_down (x, 10); }); - initTable (8, [] (float x) + initTable (8, [ramp_up, ramp_down] (float x) { return ramp_up (x, 8) + ramp_down (x, 9); }); uiOptions.backgroundColour = Colour { 0xff95756d }; @@ -85,22 +84,22 @@ ScannerVibrato::ScannerVibrato (UndoManager* um) : BaseProcessor ( uiOptions.info.description = "Virtual analog emulation of the scanner vibrato/chorus effect from the Hammond Organ."; uiOptions.info.authors = StringArray { "Jatin Chowdhury" }; - disableWhenInputConnected ({ rateTag }, ModulationInput); + disableWhenInputConnected ({ ScannerVibratoTags::rateTag }, ModulationInput); } ParamLayout ScannerVibrato::createParameterLayout() { using namespace ParameterHelpers; auto params = createBaseParams(); - createFreqParameter (params, rateTag, "Rate", 0.5f, 10.0f, 6.0f, 6.0f); - createPercentParameter (params, depthTag, "Depth", 0.5f); - createPercentParameter (params, mixTag, "Mix", 0.5f); + createFreqParameter (params, ScannerVibratoTags::rateTag, "Rate", 0.5f, 10.0f, 6.0f, 6.0f); + createPercentParameter (params, ScannerVibratoTags::depthTag, "Depth", 0.5f); + createPercentParameter (params, ScannerVibratoTags::mixTag, "Mix", 0.5f); StringArray modeChoices; for (const auto& choice : magic_enum::enum_names()) modeChoices.add (choice.data()); - emplace_param (params, modeTag, "Mode", modeChoices, 0); - emplace_param (params, stereoTag, "Stereo", false); + emplace_param (params, ScannerVibratoTags::modeTag, "Mode", modeChoices, 0); + emplace_param (params, ScannerVibratoTags::stereoTag, "Stereo", false); return { params.begin(), params.end() }; } diff --git a/src/processors/modulation/uni_vibe/UniVibe.cpp b/src/processors/modulation/uni_vibe/UniVibe.cpp index 328944b0..5c8a8407 100644 --- a/src/processors/modulation/uni_vibe/UniVibe.cpp +++ b/src/processors/modulation/uni_vibe/UniVibe.cpp @@ -2,7 +2,7 @@ #include "processors/BufferHelpers.h" #include "processors/ParameterHelpers.h" -namespace +namespace UniVibeTags { const String speedTag = "speed"; const String intensityTag = "intensity"; @@ -31,19 +31,19 @@ UniVibe::UniVibe (UndoManager* um) : BaseProcessor ( }) { using namespace ParameterHelpers; - speedParamSmooth.setParameterHandle (getParameterPointer (vts, speedTag)); - intensityParamSmooth.setParameterHandle (getParameterPointer (vts, intensityTag)); - loadParameterPointer (numStagesParam, vts, numStagesTag); - loadParameterPointer (stereoParam, vts, stereoTag); - loadParameterPointer (mixParam, vts, mixTag); + speedParamSmooth.setParameterHandle (getParameterPointer (vts, UniVibeTags::speedTag)); + intensityParamSmooth.setParameterHandle (getParameterPointer (vts, UniVibeTags::intensityTag)); + loadParameterPointer (numStagesParam, vts, UniVibeTags::numStagesTag); + loadParameterPointer (stereoParam, vts, UniVibeTags::stereoTag); + loadParameterPointer (mixParam, vts, UniVibeTags::mixTag); uiOptions.backgroundColour = Colours::darkgrey.darker (0.1f); uiOptions.powerColour = Colours::violet.brighter(); uiOptions.info.description = "A vibrato/chorus effect based on the Univox Uni-Vibe pedal."; uiOptions.info.authors = StringArray { "Jatin Chowdhury" }; - disableWhenInputConnected ({ speedTag }, ModulationInput); - addPopupMenuParameter (stereoTag); + disableWhenInputConnected ({ UniVibeTags::speedTag }, ModulationInput); + addPopupMenuParameter (UniVibeTags::stereoTag); juce::Random rand { 0x1234321 }; const auto randInRange = [&rand] (const juce::Range& range) @@ -70,11 +70,11 @@ ParamLayout UniVibe::createParameterLayout() { using namespace ParameterHelpers; auto params = createBaseParams(); - createFreqParameter (params, speedTag, "Speed", 0.5f, 20.0f, 5.0f, 5.0f); - createPercentParameter (params, intensityTag, "Intensity", 0.5f); + createFreqParameter (params, UniVibeTags::speedTag, "Speed", 0.5f, 20.0f, 5.0f, 5.0f); + createPercentParameter (params, UniVibeTags::intensityTag, "Intensity", 0.5f); emplace_param ( params, - numStagesTag, + UniVibeTags::numStagesTag, "# Stages", NormalisableRange { 1.0f, (float) maxNumStages }, 4, @@ -83,8 +83,8 @@ ParamLayout UniVibe::createParameterLayout() return String { (int) val }; }, &stringToFloatVal); - emplace_param (params, stereoTag, "Stereo", false); - createPercentParameter (params, mixTag, "Mix", 0.5f); + emplace_param (params, UniVibeTags::stereoTag, "Stereo", false); + createPercentParameter (params, UniVibeTags::mixTag, "Mix", 0.5f); return { params.begin(), params.end() }; } diff --git a/src/processors/other/Delay.cpp b/src/processors/other/Delay.cpp index 348c4e31..5df4194f 100644 --- a/src/processors/other/Delay.cpp +++ b/src/processors/other/Delay.cpp @@ -6,7 +6,7 @@ using namespace chowdsp::RhythmUtils; //using namespace chowdsp::RhythmParameter; -namespace +namespace DelayTags { const String delayTypeTag = "delay_type"; const String pingPongTag = "ping_pong"; @@ -22,18 +22,18 @@ const String tempoSyncAmountTag = "time_tempo_sync"; DelayModule::DelayModule (UndoManager* um) : BaseProcessor ("Delay", createParameterLayout(), um) { using namespace ParameterHelpers; - loadParameterPointer (freqParam, vts, freqTag); - loadParameterPointer (feedbackParam, vts, feedBackTag); - loadParameterPointer (mixParam, vts, mixTag); - loadParameterPointer (delayTimeMsParam, vts, delayTimeMsTag); - loadParameterPointer (delayTimeRhythmParam, vts, tempoSyncAmountTag); - tempoSyncOnOffParam = vts.getRawParameterValue (tempoSyncTag); - delayTypeParam = vts.getRawParameterValue (delayTypeTag); - pingPongParam = vts.getRawParameterValue (pingPongTag); - - addPopupMenuParameter (delayTypeTag); - addPopupMenuParameter (pingPongTag); - addPopupMenuParameter (tempoSyncTag); + loadParameterPointer (freqParam, vts, DelayTags::freqTag); + loadParameterPointer (feedbackParam, vts, DelayTags::feedBackTag); + loadParameterPointer (mixParam, vts, DelayTags::mixTag); + loadParameterPointer (delayTimeMsParam, vts, DelayTags::delayTimeMsTag); + loadParameterPointer (delayTimeRhythmParam, vts, DelayTags::tempoSyncAmountTag); + tempoSyncOnOffParam = vts.getRawParameterValue (DelayTags::tempoSyncTag); + delayTypeParam = vts.getRawParameterValue (DelayTags::delayTypeTag); + pingPongParam = vts.getRawParameterValue (DelayTags::pingPongTag); + + addPopupMenuParameter (DelayTags::delayTypeTag); + addPopupMenuParameter (DelayTags::pingPongTag); + addPopupMenuParameter (DelayTags::tempoSyncTag); uiOptions.backgroundColour = Colours::cyan.darker (0.1f); uiOptions.powerColour = Colours::gold; @@ -46,19 +46,19 @@ ParamLayout DelayModule::createParameterLayout() using namespace ParameterHelpers; auto params = createBaseParams(); - createTimeMsParameter (params, delayTimeMsTag, "Delay Time", createNormalisableRange (20.0f, 2000.0f, 200.0f), 100.0f); - createFreqParameter (params, freqTag, "Cutoff", 500.0f, 10000.0f, 4000.0f, 10000.0f); - createPercentParameter (params, feedBackTag, "Feedback", 0.0f); - createPercentParameter (params, mixTag, "Mix", 0.5f); + createTimeMsParameter (params, DelayTags::delayTimeMsTag, "Delay Time", createNormalisableRange (20.0f, 2000.0f, 200.0f), 100.0f); + createFreqParameter (params, DelayTags::freqTag, "Cutoff", 500.0f, 10000.0f, 4000.0f, 10000.0f); + createPercentParameter (params, DelayTags::feedBackTag, "Feedback", 0.0f); + createPercentParameter (params, DelayTags::mixTag, "Mix", 0.5f); emplace_param (params, - tempoSyncAmountTag, + DelayTags::tempoSyncAmountTag, "Delay Rhythm", std::initializer_list { HALF, QUARTER, EIGHTH, EIGHTH_DOT }, HALF); - emplace_param (params, tempoSyncTag, "Tempo Sync", false); - emplace_param (params, delayTypeTag, "Delay Type", StringArray { "Clean", "Lo-Fi" }, 0); - emplace_param (params, pingPongTag, "Ping-Pong", false); + emplace_param (params, DelayTags::tempoSyncTag, "Tempo Sync", false); + emplace_param (params, DelayTags::delayTypeTag, "Delay Type", StringArray { "Clean", "Lo-Fi" }, 0); + emplace_param (params, DelayTags::pingPongTag, "Ping-Pong", false); return { params.begin(), params.end() }; } @@ -303,11 +303,11 @@ bool DelayModule::getCustomComponents (OwnedArray& customComps, chowd public: DelayTimeModeControl (AudioProcessorValueTreeState& vtState, chowdsp::HostContextProvider& hcp) : vts (vtState), - tempoSyncSelectorAttach (vts, tempoSyncAmountTag, tempoSyncSelector), - delayTimeSlider (*getParameterPointer (vts, delayTimeMsTag), hcp), - delayTimeAttach (vts, delayTimeMsTag, delayTimeSlider), + tempoSyncSelectorAttach (vts, DelayTags::tempoSyncAmountTag, tempoSyncSelector), + delayTimeSlider (*getParameterPointer (vts, DelayTags::delayTimeMsTag), hcp), + delayTimeAttach (vts, DelayTags::delayTimeMsTag, delayTimeSlider), tempoSyncOnOffAttach ( - *vts.getParameter (tempoSyncTag), + *vts.getParameter (DelayTags::tempoSyncTag), [this] (float newValue) { updateControlVisibility (newValue == 1.0f); }, vts.undoManager) @@ -315,7 +315,7 @@ bool DelayModule::getCustomComponents (OwnedArray& customComps, chowd addChildComponent (tempoSyncSelector); addChildComponent (delayTimeSlider); - const auto* modeChoiceParam = getParameterPointer (vts, tempoSyncAmountTag); + const auto* modeChoiceParam = getParameterPointer (vts, DelayTags::tempoSyncAmountTag); tempoSyncSelector.addItemList (modeChoiceParam->choices, 1); tempoSyncSelector.setSelectedItemIndex (0); tempoSyncSelector.setScrollWheelEnabled (true); @@ -323,7 +323,7 @@ bool DelayModule::getCustomComponents (OwnedArray& customComps, chowd hcp.registerParameterComponent (delayTimeSlider, delayTimeSlider.getParameter()); - this->setName (tempoSyncAmountTag + "__" + delayTimeMsTag + "__"); + Component::setName (DelayTags::tempoSyncAmountTag + "__" + DelayTags::delayTimeMsTag + "__"); } void colourChanged() override @@ -350,14 +350,14 @@ bool DelayModule::getCustomComponents (OwnedArray& customComps, chowd tempoSyncSelector.setVisible (tempoSyncOn); delayTimeSlider.setVisible (! tempoSyncOn); - setName (vts.getParameter (tempoSyncOn ? tempoSyncAmountTag : delayTimeMsTag)->name); + setName (vts.getParameter (tempoSyncOn ? DelayTags::tempoSyncAmountTag : DelayTags::delayTimeMsTag)->name); if (auto* parent = getParentComponent()) parent->repaint(); } void visibilityChanged() override { - updateControlVisibility (vts.getRawParameterValue (tempoSyncTag)->load() == 1.0f); + updateControlVisibility (vts.getRawParameterValue (DelayTags::tempoSyncTag)->load() == 1.0f); } void resized() override diff --git a/src/processors/other/Octaver.cpp b/src/processors/other/Octaver.cpp index 62b597f5..4747ada3 100644 --- a/src/processors/other/Octaver.cpp +++ b/src/processors/other/Octaver.cpp @@ -2,7 +2,7 @@ #include "processors/BufferHelpers.h" #include "processors/ParameterHelpers.h" -namespace +namespace OctaverTags { const String trackingTag = "tracking"; const String cutoffTag = "cutoff"; @@ -12,9 +12,9 @@ const String mixTag = "mix"; Octaver::Octaver (UndoManager* um) : BaseProcessor ("Octaver", createParameterLayout(), um) { using namespace ParameterHelpers; - loadParameterPointer (trackingParam, vts, trackingTag); - loadParameterPointer (cutoffParam, vts, cutoffTag); - loadParameterPointer (mixParam, vts, mixTag); + loadParameterPointer (trackingParam, vts, OctaverTags::trackingTag); + loadParameterPointer (cutoffParam, vts, OctaverTags::cutoffTag); + loadParameterPointer (mixParam, vts, OctaverTags::mixTag); uiOptions.backgroundColour = Colour { 0xff5c96ac }; uiOptions.powerColour = Colour { 0xffd8d737 }; @@ -27,9 +27,9 @@ ParamLayout Octaver::createParameterLayout() using namespace ParameterHelpers; auto params = createBaseParams(); - createFreqParameter (params, trackingTag, "Tracking", 300.0f, 1000.0f, 650.0f, 650.0f); - createFreqParameter (params, cutoffTag, "Cutoff", 500.0f, 2000.0f, 1000.0f, 2000.0f); - createPercentParameter (params, mixTag, "Mix", 0.75f); + createFreqParameter (params, OctaverTags::trackingTag, "Tracking", 300.0f, 1000.0f, 650.0f, 650.0f); + createFreqParameter (params, OctaverTags::cutoffTag, "Cutoff", 500.0f, 2000.0f, 1000.0f, 2000.0f); + createPercentParameter (params, OctaverTags::mixTag, "Mix", 0.75f); return { params.begin(), params.end() }; } From a829d35bd6af4dca055279f8cd1e95279a8680a1 Mon Sep 17 00:00:00 2001 From: jatin Date: Tue, 5 Dec 2023 19:02:50 -0800 Subject: [PATCH 2/4] Enable PCH --- src/CMakeLists.txt | 1 + .../drive/big_muff/BigMuffClippingStage.cpp | 12 ++++++------ .../drive/muff_clipper/MuffClipperStage.cpp | 14 +++++++------- 3 files changed, 14 insertions(+), 13 deletions(-) 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; From e31a267de2eb91a775c01ec71e61f8d9733c44a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 6 Dec 2023 03:05:11 +0000 Subject: [PATCH 3/4] Apply clang-format --- src/BYOD.cpp | 2 +- .../toolbar/presets/PresetSearchWindow.cpp | 2 +- src/gui/toolbar/presets/PresetsSaveDialog.cpp | 2 +- .../drive/big_muff/BigMuffClippingStage.cpp | 2 +- src/processors/drive/centaur/Centaur.cpp | 2 +- .../drive/diode_circuits/DiodeClipperWDF.h | 2 +- src/processors/drive/flapjack/Flapjack.cpp | 2 +- .../drive/mouse_drive/MouseDriveWDF.h | 2 +- .../drive/muff_clipper/MuffClipperStage.cpp | 2 +- .../drive/mxr_distortion/MXRDistWDF.h | 2 +- .../drive/tube_screamer/TubeScreamerWDF.h | 2 +- src/processors/drive/zen_drive/ZenDriveWDF.h | 2 +- src/processors/modulation/Tremolo.cpp | 2 +- src/processors/modulation/phaser/Phaser4.cpp | 36 +++++++++---------- src/processors/modulation/phaser/Phaser8.cpp | 2 +- .../scanner_vibrato/ScannerVibrato.cpp | 2 +- .../modulation/uni_vibe/UniVibe.cpp | 2 +- src/processors/other/Delay.cpp | 2 +- src/processors/other/Octaver.cpp | 2 +- 19 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/BYOD.cpp b/src/BYOD.cpp index f96c0db1..04dfff9f 100644 --- a/src/BYOD.cpp +++ b/src/BYOD.cpp @@ -1,7 +1,7 @@ #include "BYOD.h" #include "gui/BYODPluginEditor.h" -#include "state/presets/PresetManager.h" #include "state/StateManager.h" +#include "state/presets/PresetManager.h" namespace { diff --git a/src/gui/toolbar/presets/PresetSearchWindow.cpp b/src/gui/toolbar/presets/PresetSearchWindow.cpp index 5de43bbd..67c10056 100644 --- a/src/gui/toolbar/presets/PresetSearchWindow.cpp +++ b/src/gui/toolbar/presets/PresetSearchWindow.cpp @@ -4,7 +4,7 @@ namespace PresetSearchDims { constexpr int rowHeight = 40; constexpr int itemHeight = rowHeight + 20; -} // namespace +} // namespace PresetSearchDims struct PresetSearchWindow::ResultsListModel : public ListBoxModel { diff --git a/src/gui/toolbar/presets/PresetsSaveDialog.cpp b/src/gui/toolbar/presets/PresetsSaveDialog.cpp index 6dedf592..982f3825 100644 --- a/src/gui/toolbar/presets/PresetsSaveDialog.cpp +++ b/src/gui/toolbar/presets/PresetsSaveDialog.cpp @@ -8,7 +8,7 @@ constexpr int headerHeight = 40; constexpr int footerHeight = 50; constexpr int labelsWidth = 80; constexpr int itemHeight = 50; -} // namespace +} // namespace PresetSaveDims PresetsSaveDialog::PresetsSaveDialog() { diff --git a/src/processors/drive/big_muff/BigMuffClippingStage.cpp b/src/processors/drive/big_muff/BigMuffClippingStage.cpp index c34182cd..55274ff3 100644 --- a/src/processors/drive/big_muff/BigMuffClippingStage.cpp +++ b/src/processors/drive/big_muff/BigMuffClippingStage.cpp @@ -56,7 +56,7 @@ inline float newton_raphson (float x, float y, float C_12_state, float G_C_12) n return y; } -} // namespace +} // namespace BigMuffMath void BigMuffClippingStage::prepare (double sampleRate) { diff --git a/src/processors/drive/centaur/Centaur.cpp b/src/processors/drive/centaur/Centaur.cpp index 25d4371d..f8021059 100644 --- a/src/processors/drive/centaur/Centaur.cpp +++ b/src/processors/drive/centaur/Centaur.cpp @@ -6,7 +6,7 @@ namespace CentaurTags const String gainTag = "gain"; const String levelTag = "level"; const String modeTag = "mode"; -} // namespace +} // namespace CentaurTags Centaur::Centaur (UndoManager* um) : BaseProcessor ("Centaur", createParameterLayout(), um), gainStageML (vts) diff --git a/src/processors/drive/diode_circuits/DiodeClipperWDF.h b/src/processors/drive/diode_circuits/DiodeClipperWDF.h index d370a12d..d2b40ffb 100644 --- a/src/processors/drive/diode_circuits/DiodeClipperWDF.h +++ b/src/processors/drive/diode_circuits/DiodeClipperWDF.h @@ -1,7 +1,7 @@ #pragma once -#include #include "OmegaProvider.h" +#include template