Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on improving build times #338

Merged
merged 5 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/arm-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions modules/cmake/WarningFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ if(WIN32)
-Wno-sign-conversion
-Wno-implicit-int-float-conversion
-Wno-implicit-const-int-float-conversion
-Wno-unsafe-buffer-usage
-Wno-header-hygiene
)
elseif((CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") OR (CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC"))
Expand Down
1 change: 1 addition & 0 deletions src/BYOD.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "BYOD.h"
#include "gui/BYODPluginEditor.h"
#include "state/StateManager.h"
#include "state/presets/PresetManager.h"

namespace
Expand Down
5 changes: 2 additions & 3 deletions src/BYOD.h
Original file line number Diff line number Diff line change
@@ -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<BYOD>
{
public:
Expand Down
11 changes: 10 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -196,3 +195,13 @@ 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)
target_precompile_headers(BYOD PRIVATE pch.h)
10 changes: 5 additions & 5 deletions src/gui/toolbar/presets/PresetSearchWindow.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "PresetSearchWindow.h"

namespace
namespace PresetSearchDims
{
constexpr int rowHeight = 40;
constexpr int itemHeight = rowHeight + 20;
} // namespace
} // namespace PresetSearchDims

struct PresetSearchWindow::ResultsListModel : public ListBoxModel
{
Expand Down Expand Up @@ -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);
Expand All @@ -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));
}
Expand Down
24 changes: 12 additions & 12 deletions src/gui/toolbar/presets/PresetsSaveDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
#include "gui/utils/ErrorMessageView.h"
#include "state/presets/PresetInfoHelpers.h"

namespace
namespace PresetSaveDims
{
constexpr int headerHeight = 40;
constexpr int footerHeight = 50;
constexpr int labelsWidth = 80;
constexpr int itemHeight = 50;
} // namespace
} // namespace PresetSaveDims

PresetsSaveDialog::PresetsSaveDialog()
{
Expand Down Expand Up @@ -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);
};

Expand All @@ -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));
Expand Down
14 changes: 7 additions & 7 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 @@ -56,15 +56,15 @@ 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)
{
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
18 changes: 9 additions & 9 deletions src/processors/drive/centaur/Centaur.cpp
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#include "Centaur.h"
#include "processors/netlist_helpers/NetlistViewer.h"

namespace
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)
{
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);
Expand Down Expand Up @@ -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<AudioParameterChoice> (params, modeTag, "Mode", StringArray { "Traditional", "Neural" }, 0);
createPercentParameter (params, CentaurTags::gainTag, "Gain", 0.5f);
createPercentParameter (params, CentaurTags::levelTag, "Level", 0.5f);
emplace_param<AudioParameterChoice> (params, CentaurTags::modeTag, "Mode", StringArray { "Traditional", "Neural" }, 0);

return { params.begin(), params.end() };
}
Expand Down
2 changes: 1 addition & 1 deletion src/processors/drive/diode_circuits/DiodeClipperWDF.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <pch.h>
#include "OmegaProvider.h"
#include <pch.h>

template <template <typename, typename, wdft::DiodeQuality, typename> typename DiodeType>
class DiodeClipperWDF
Expand Down
24 changes: 12 additions & 12 deletions src/processors/drive/flapjack/Flapjack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@
// - transistor is _active_
// - bias voltage = 4V

namespace
namespace FlapjackTags
{
const auto driveTag = "drive";
const auto presenceTag = "presence";
const auto levelTag = "level";
const auto modeTag = "mode";
const auto lowCutTag = "lowcut";
} // namespace
} // namespace FlapjackTags

Flapjack::Flapjack (UndoManager* um)
: BaseProcessor ("Flapjack", createParameterLayout(), um)
{
using namespace ParameterHelpers;

driveParam.setParameterHandle (getParameterPointer<chowdsp::FloatParameter*> (vts, driveTag));
driveParam.setParameterHandle (getParameterPointer<chowdsp::FloatParameter*> (vts, FlapjackTags::driveTag));
driveParam.setRampLength (0.025);
driveParam.mappingFunction = [this] (float x)
{
if (magic_enum::enum_value<FlapjackClipMode> (modeParam->getIndex()) == FlapjackClipMode::LightFold)
x *= 0.9f;
return chowdsp::Power::ipow<2> (1.0f - x);
};
presenceParam.setParameterHandle (getParameterPointer<chowdsp::FloatParameter*> (vts, presenceTag));
presenceParam.setParameterHandle (getParameterPointer<chowdsp::FloatParameter*> (vts, FlapjackTags::presenceTag));
presenceParam.setRampLength (0.025);
lowCutParam.setParameterHandle (getParameterPointer<chowdsp::FloatParameter*> (vts, lowCutTag));
lowCutParam.setParameterHandle (getParameterPointer<chowdsp::FloatParameter*> (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);
Expand Down Expand Up @@ -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<chowdsp::ChoiceParameter> (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<chowdsp::ChoiceParameter> (params, FlapjackTags::modeTag, "Mode", StringArray { "Fizzy", "Bluesberry", "Peachy" }, 1);

return { params.begin(), params.end() };
}
Expand Down
1 change: 0 additions & 1 deletion src/processors/drive/fuzz_machine/FuzzMachine.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "processors/BaseProcessor.h"

#include "FuzzFaceNDK.h"
#include "processors/drive/neural_utils/ResampledRNNAccelerated.h"

class FuzzMachine : public BaseProcessor
Expand Down
2 changes: 1 addition & 1 deletion src/processors/drive/mouse_drive/MouseDriveWDF.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <pch.h>
#include "../diode_circuits/OmegaProvider.h"
#include <pch.h>

class MouseDriveWDF
{
Expand Down
Loading
Loading