From dd6f2f23fd402f4d0574861caa968eaa5601f9ef Mon Sep 17 00:00:00 2001 From: jatinchowdhury18 Date: Fri, 23 Feb 2024 00:12:08 -0800 Subject: [PATCH] Updating submodules and improved preset search (#350) * Updating submodules and improved preset search * Apply clang-format * Trying to fix CI failures * More CI fixing --------- Co-authored-by: github-actions[bot] --- .github/workflows/arm-mac.yml | 5 +++ .github/workflows/cmake.yml | 6 +++ .gitmodules | 3 -- modules/CMakeLists.txt | 3 +- modules/JUCE | 2 +- modules/chowdsp_utils | 2 +- modules/fuzzysearchdatabase | 1 - src/BYOD.cpp | 10 +++-- src/CMakeLists.txt | 15 +++++-- src/gui/pedalboard/BoardComponent.cpp | 16 ++++---- src/gui/pedalboard/BoardComponent.h | 2 +- src/gui/pedalboard/BoardViewport.cpp | 2 +- src/gui/pedalboard/cables/Cable.cpp | 2 +- .../pedalboard/cables/CableDrawingHelpers.cpp | 2 +- src/gui/pedalboard/editors/EditorSelector.cpp | 2 +- src/gui/pedalboard/editors/EditorSelector.h | 2 +- src/gui/pedalboard/editors/KnobsComponent.cpp | 40 +++++++++---------- .../pedalboard/editors/ProcessorEditor.cpp | 4 +- .../toolbar/presets/PresetSearchHelpers.cpp | 25 ++++++++---- src/gui/toolbar/presets/PresetSearchHelpers.h | 3 +- .../toolbar/presets/PresetSearchWindow.cpp | 2 +- src/gui/toolbar/presets/PresetsSaveDialog.cpp | 2 +- src/gui/toolbar/presets/PresetsSyncDialog.cpp | 2 +- src/gui/utils/LevelMeterComponent.cpp | 4 +- src/gui/utils/LevelMeterComponent.h | 2 +- src/gui/utils/LookAndFeels.cpp | 4 +- src/gui/utils/LookAndFeels.h | 2 +- src/headless/ScreenshotGenerator.cpp | 2 +- src/headless/ScreenshotGenerator.h | 2 +- src/pch.h | 2 - src/processors/BaseProcessor.cpp | 4 +- src/processors/BaseProcessor.h | 4 +- src/processors/ProcessorStore.cpp | 4 +- src/processors/modulation/MIDIModulator.cpp | 4 +- src/processors/modulation/phaser/Phaser4.cpp | 34 ++++++++-------- src/processors/other/krusher/Krusher.h | 4 +- .../other/krusher/krusher_fallback_impl.h | 6 ++- .../other/poly_octave/PolyOctave.cpp | 2 +- src/processors/utility/Oscilloscope.cpp | 4 +- src/processors/utility/Oscilloscope.h | 4 +- src/processors/utility/Tuner.cpp | 4 +- 41 files changed, 140 insertions(+), 105 deletions(-) delete mode 160000 modules/fuzzysearchdatabase diff --git a/.github/workflows/arm-mac.yml b/.github/workflows/arm-mac.yml index 8ee66f70..67c688ab 100644 --- a/.github/workflows/arm-mac.yml +++ b/.github/workflows/arm-mac.yml @@ -21,6 +21,11 @@ jobs: runs-on: macos-13 steps: + - name: Set Xcode version + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.2' + - name: Get latest CMake uses: lukka/get-cmake@latest diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index fbb29dad..c771ff32 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -37,6 +37,12 @@ jobs: sudo apt-get update sudo apt install libasound2-dev libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev libxrandr-dev libxrender-dev libfreetype6-dev libglu1-mesa-dev libjack-jackd2-dev + - name: Set Xcode version + if: runner.os == 'MacOS' + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.2' + - name: Get latest CMake uses: lukka/get-cmake@latest diff --git a/.gitmodules b/.gitmodules index 48ab9976..5cc61885 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,9 +19,6 @@ [submodule "modules/chowdsp_wdf"] path = modules/chowdsp_wdf url = https://github.com/Chowdhury-DSP/chowdsp_wdf -[submodule "modules/fuzzysearchdatabase"] - path = modules/fuzzysearchdatabase - url = https://bitbucket.org/j_norberg/fuzzysearchdatabase.git [submodule "modules/ea_variant"] path = modules/ea_variant url = https://github.com/eyalamirmusic/Variant diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index 88bf1592..1543a73d 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -39,7 +39,9 @@ target_link_libraries(juce_plugin_modules chowdsp::chowdsp_rhythm chowdsp::chowdsp_presets chowdsp::chowdsp_serialization + chowdsp::chowdsp_logging chowdsp::chowdsp_units + chowdsp::chowdsp_fuzzy_search chowdsp::chowdsp_wdf chowdsp::chowdsp_visualizers RTNeural @@ -85,7 +87,6 @@ target_include_directories(juce_plugin_modules ${CMAKE_SOURCE_DIR}/modules/magic_enum/include ${CMAKE_SOURCE_DIR}/modules/RTNeural/modules/xsimd/include $ - ${CMAKE_SOURCE_DIR}/modules/fuzzysearchdatabase/src ) set_target_properties(juce_plugin_modules PROPERTIES diff --git a/modules/JUCE b/modules/JUCE index d054f0d1..a8ae6edd 160000 --- a/modules/JUCE +++ b/modules/JUCE @@ -1 +1 @@ -Subproject commit d054f0d14dcac387aebda44ce5d792b5e7a625b3 +Subproject commit a8ae6edda6d3be78a139ec5e429dc57ef047e82a diff --git a/modules/chowdsp_utils b/modules/chowdsp_utils index 4355c19f..b1ac3eb8 160000 --- a/modules/chowdsp_utils +++ b/modules/chowdsp_utils @@ -1 +1 @@ -Subproject commit 4355c19f1b59640dd50f37fa6179141c80a7daae +Subproject commit b1ac3eb802171e65d22151fbadce81d1f300616d diff --git a/modules/fuzzysearchdatabase b/modules/fuzzysearchdatabase deleted file mode 160000 index 23122d1f..00000000 --- a/modules/fuzzysearchdatabase +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 23122d1ff60d936fd766361a30210c954e0c5449 diff --git a/src/BYOD.cpp b/src/BYOD.cpp index ccc65155..31effc77 100644 --- a/src/BYOD.cpp +++ b/src/BYOD.cpp @@ -11,10 +11,12 @@ const String logFileNameRoot = "BYOD_Log_"; } // namespace BYODPaths BYOD::BYOD() : chowdsp::PluginBase (&undoManager), - logger ({ .logFileSubDir = BYODPaths::logFileSubDir, - .logFileNameRoot = BYODPaths::logFileNameRoot, - .crashLogAnalysisCallback = [this] (const File& logFile) - { crashLogFile.emplace (logFile); } }), + logger ({ + .logFileSubDir = BYODPaths::logFileSubDir, + .logFileNameRoot = BYODPaths::logFileNameRoot, + }, + [this] (const File& logFile) + { crashLogFile.emplace (logFile); }), procStore (&undoManager) { #if PERFETTO diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f44c1192..06ccbe4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -199,11 +199,20 @@ if (MSVC) target_compile_options(BYOD PRIVATE /bigobj) endif () -file(GLOB_RECURSE juce_module_sources +file(GLOB_RECURSE module_sources + # JUCE module format is already unity building ${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} + ${CMAKE_CURRENT_SOURCE_DIR}/../modules/JUCE/modules/chowdsp_utils/modules/*/chowdsp_*/*.cpp + + # files that include "byod_jai_lib.h" have issues with unity builds + ${CMAKE_CURRENT_SOURCE_DIR}/jai/SharedJaiContext.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/processors/other/krusher/Krusher.cpp + + # already a massive cpp file! + ${CMAKE_CURRENT_SOURCE_DIR}/processors/ProcessorStore.cpp +) +set_source_files_properties(${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/pedalboard/BoardComponent.cpp b/src/gui/pedalboard/BoardComponent.cpp index a10dad4a..88e8befa 100644 --- a/src/gui/pedalboard/BoardComponent.cpp +++ b/src/gui/pedalboard/BoardComponent.cpp @@ -112,8 +112,8 @@ void BoardComponent::resized() const auto thisEditorHeight = BoardDims::getScaleDim (BoardDims::editorHeight, scaleFactor); auto centreEditorHeight = (height - thisEditorHeight) / 2; - setEditorPosition (inputEditor.get(), Rectangle (BoardDims::editorPad, centreEditorHeight, thisEditorWidth / 2, thisEditorHeight)); - setEditorPosition (outputEditor.get(), Rectangle (width - (thisEditorWidth / 2 + BoardDims::editorPad), centreEditorHeight, thisEditorWidth / 2, thisEditorHeight)); + setEditorPosition (inputEditor.get(), juce::Rectangle (BoardDims::editorPad, centreEditorHeight, thisEditorWidth / 2, thisEditorHeight)); + setEditorPosition (outputEditor.get(), juce::Rectangle (width - (thisEditorWidth / 2 + BoardDims::editorPad), centreEditorHeight, thisEditorWidth / 2, thisEditorHeight)); for (auto* editor : processorEditors) setEditorPosition (editor); @@ -122,7 +122,7 @@ void BoardComponent::resized() cableView.updateCablePositions(); newProcButton.setBounds (width - BoardDims::newButtonWidth, 0, BoardDims::newButtonWidth, BoardDims::newButtonWidth); - infoComp.setBounds (Rectangle (jmin (400, width), jmin (250, height)).withCentre (getLocalBounds().getCentre())); + infoComp.setBounds (juce::Rectangle (jmin (400, width), jmin (250, height)).withCentre (getLocalBounds().getCentre())); repaint(); } @@ -299,7 +299,7 @@ ProcessorEditor* BoardComponent::findEditorForProcessor (const BaseProcessor* pr return nullptr; } -void BoardComponent::setEditorPosition (ProcessorEditor* editor, Rectangle bounds) +void BoardComponent::setEditorPosition (ProcessorEditor* editor, juce::Rectangle bounds) { const auto thisEditorWidth = BoardDims::getScaleDim (BoardDims::editorWidth, scaleFactor); const auto thisEditorHeight = BoardDims::getScaleDim (BoardDims::editorHeight, scaleFactor); @@ -308,8 +308,8 @@ void BoardComponent::setEditorPosition (ProcessorEditor* editor, Rectangle auto position = proc->getPosition (getBounds()); if (position == juce::Point (0, 0) && getWidth() > 0 && getHeight() > 0) // no position set yet { - if (bounds == Rectangle {}) - bounds = Rectangle (thisEditorWidth, thisEditorHeight).withCentre (nextEditorPosition); + if (bounds == juce::Rectangle {}) + bounds = juce::Rectangle (thisEditorWidth, thisEditorHeight).withCentre (nextEditorPosition); editor->setBounds (bounds); proc->setPosition (editor->getBounds().getTopLeft(), getBounds()); @@ -317,8 +317,8 @@ void BoardComponent::setEditorPosition (ProcessorEditor* editor, Rectangle } else { - if (bounds == Rectangle {}) - bounds = Rectangle (thisEditorWidth, thisEditorHeight); + if (bounds == juce::Rectangle {}) + bounds = juce::Rectangle (thisEditorWidth, thisEditorHeight); editor->setBounds (bounds.withPosition (position)); } diff --git a/src/gui/pedalboard/BoardComponent.h b/src/gui/pedalboard/BoardComponent.h index 1e182fc5..9894d997 100644 --- a/src/gui/pedalboard/BoardComponent.h +++ b/src/gui/pedalboard/BoardComponent.h @@ -36,7 +36,7 @@ class BoardComponent final : public Component private: void showNewProcMenu (PopupMenu& menu, PopupMenu::Options& options, juce::Point mousePos, ConnectionInfo* connectionInfo = nullptr); - void setEditorPosition (ProcessorEditor* editor, Rectangle bounds = {}); + void setEditorPosition (ProcessorEditor* editor, juce::Rectangle bounds = {}); void mouseDown (const MouseEvent& e) override; void mouseDrag (const MouseEvent& e) override; void mouseUp (const MouseEvent& e) override; diff --git a/src/gui/pedalboard/BoardViewport.cpp b/src/gui/pedalboard/BoardViewport.cpp index 3035b45f..2b745de4 100644 --- a/src/gui/pedalboard/BoardViewport.cpp +++ b/src/gui/pedalboard/BoardViewport.cpp @@ -94,7 +94,7 @@ void BoardViewport::resized() comp.setBounds (0, 0, width, height); constexpr int buttonDim = 34; - auto buttonRect = Rectangle { 0, height - buttonDim, buttonDim, buttonDim }; + auto buttonRect = juce::Rectangle { 0, height - buttonDim, buttonDim, buttonDim }; plusButton.setBounds (buttonRect.reduced (1)); minusButton.setBounds (buttonRect.withX (buttonDim).reduced (1)); scaleLabel.setBounds (2 * buttonDim, height - buttonDim, 100, buttonDim); diff --git a/src/gui/pedalboard/cables/Cable.cpp b/src/gui/pedalboard/cables/Cable.cpp index 6d33c5e7..6f85692f 100644 --- a/src/gui/pedalboard/cables/Cable.cpp +++ b/src/gui/pedalboard/cables/Cable.cpp @@ -152,7 +152,7 @@ void Cable::drawCableShadow (Graphics& g, float thickness) void Cable::drawCableEndCircle (Graphics& g, juce::Point centre, Colour colour) const { - auto circle = (Rectangle { minCableThickness, minCableThickness } * 2.4f * scaleFactor.load()).withCentre (centre); + auto circle = (juce::Rectangle { minCableThickness, minCableThickness } * 2.4f * scaleFactor.load()).withCentre (centre); g.setColour (colour); g.fillEllipse (circle); diff --git a/src/gui/pedalboard/cables/CableDrawingHelpers.cpp b/src/gui/pedalboard/cables/CableDrawingHelpers.cpp index 0e7ced33..f41d04c0 100644 --- a/src/gui/pedalboard/cables/CableDrawingHelpers.cpp +++ b/src/gui/pedalboard/cables/CableDrawingHelpers.cpp @@ -13,7 +13,7 @@ constexpr float glowSizeFactor = 2.5f; juce::Rectangle getPortGlowBounds (juce::Point location, float scaleFactor) { const auto glowDim = (float) getPortDistanceLimit (scaleFactor) * glowSizeFactor; - auto glowBounds = (Rectangle (glowDim, glowDim)).withCentre (location.toFloat()); + auto glowBounds = (juce::Rectangle (glowDim, glowDim)).withCentre (location.toFloat()); return glowBounds; } diff --git a/src/gui/pedalboard/editors/EditorSelector.cpp b/src/gui/pedalboard/editors/EditorSelector.cpp index 2b3f777b..3d6d6664 100644 --- a/src/gui/pedalboard/editors/EditorSelector.cpp +++ b/src/gui/pedalboard/editors/EditorSelector.cpp @@ -5,7 +5,7 @@ EditorSelector::EditorSelector (const BoardComponent& boardComp) : board (boardC { } -void EditorSelector::findLassoItemsInArea (Array& results, const Rectangle& area) +void EditorSelector::findLassoItemsInArea (Array& results, const juce::Rectangle& area) { const auto checkAndAddEditor = [&results, area] (ProcessorEditor* editor) { diff --git a/src/gui/pedalboard/editors/EditorSelector.h b/src/gui/pedalboard/editors/EditorSelector.h index 7dcf42f5..f428cb8c 100644 --- a/src/gui/pedalboard/editors/EditorSelector.h +++ b/src/gui/pedalboard/editors/EditorSelector.h @@ -8,7 +8,7 @@ class EditorSelector : public LassoSource public: explicit EditorSelector (const BoardComponent&); - void findLassoItemsInArea (Array& results, const Rectangle& area) override; + void findLassoItemsInArea (Array& results, const juce::Rectangle& area) override; SelectedItemSet& getLassoSelection() override { return selectedEditorSet; } private: diff --git a/src/gui/pedalboard/editors/KnobsComponent.cpp b/src/gui/pedalboard/editors/KnobsComponent.cpp index 1f78569c..b8a4e267 100644 --- a/src/gui/pedalboard/editors/KnobsComponent.cpp +++ b/src/gui/pedalboard/editors/KnobsComponent.cpp @@ -204,7 +204,7 @@ void KnobsComponent::paint (Graphics& g) font = Font (font.getHeight() - 0.5f).boldened(); g.setFont (font); - Rectangle nameBox (comp.getX(), comp.getY() - nameOffset + offset, comp.getWidth(), nameHeight); + juce::Rectangle nameBox (comp.getX(), comp.getY() - nameOffset + offset, comp.getWidth(), nameHeight); g.drawFittedText (name, nameBox, Justification::centred, 1); }; @@ -238,7 +238,7 @@ void KnobsComponent::resized() if (boxes.size() > 0) { compWidth = getWidth() - yDim; - boxes[0]->setBounds (Rectangle (compWidth, yDim).withCentre (getLocalBounds().getCentre())); + boxes[0]->setBounds (juce::Rectangle (compWidth, yDim).withCentre (getLocalBounds().getCentre())); } if (buttons.size() > 0) @@ -300,14 +300,14 @@ void KnobsComponent::resized() { int compIdx = 0; - Rectangle bounds[4]; + juce::Rectangle bounds[4]; const int sWidth = proportionOfWidth (0.308f); const int xOff = proportionOfWidth (0.231f); const int yOff = proportionOfHeight (0.143f); - bounds[0] = Rectangle { 0, yOff, sWidth, sWidth }; - bounds[1] = Rectangle { xOff, 2 * yOff, sWidth, sWidth }; - bounds[2] = Rectangle { 2 * xOff, yOff, sWidth, sWidth }; - bounds[3] = Rectangle { 3 * xOff, 2 * yOff, sWidth, sWidth }; + bounds[0] = juce::Rectangle { 0, yOff, sWidth, sWidth }; + bounds[1] = juce::Rectangle { xOff, 2 * yOff, sWidth, sWidth }; + bounds[2] = juce::Rectangle { 2 * xOff, yOff, sWidth, sWidth }; + bounds[3] = juce::Rectangle { 3 * xOff, 2 * yOff, sWidth, sWidth }; for (auto* s : sliders) { @@ -329,7 +329,7 @@ void KnobsComponent::resized() { int compIdx = 0; - Rectangle bounds[5]; + juce::Rectangle bounds[5]; const int sWidth = proportionOfWidth (0.215f); const int y1 = proportionOfHeight (0.25f); const int y2 = proportionOfHeight (0.60f); @@ -340,11 +340,11 @@ void KnobsComponent::resized() const int x4 = proportionOfWidth (0.75f); const int x5 = proportionOfWidth (0.39f); - bounds[0] = Rectangle { x1, y1, sWidth, sWidth }; - bounds[1] = Rectangle { x2, y2, sWidth, sWidth }; - bounds[2] = Rectangle { x3, y2, sWidth, sWidth }; - bounds[3] = Rectangle { x4, y1, sWidth, sWidth }; - bounds[4] = Rectangle { x5, y3, sWidth, sWidth }; + bounds[0] = juce::Rectangle { x1, y1, sWidth, sWidth }; + bounds[1] = juce::Rectangle { x2, y2, sWidth, sWidth }; + bounds[2] = juce::Rectangle { x3, y2, sWidth, sWidth }; + bounds[3] = juce::Rectangle { x4, y1, sWidth, sWidth }; + bounds[4] = juce::Rectangle { x5, y3, sWidth, sWidth }; for (auto* s : sliders) { @@ -359,7 +359,7 @@ void KnobsComponent::resized() { int compIdx = 0; - Rectangle bounds[5]; + juce::Rectangle bounds[5]; const int sWidth = proportionOfWidth (0.288f); const int y1 = proportionOfHeight (0.464f); const int y2 = proportionOfHeight (0.107f); @@ -372,11 +372,11 @@ void KnobsComponent::resized() const int xDim = proportionOfWidth (0.346f); const int yDim = proportionOfHeight (0.214f); - bounds[0] = Rectangle { 0, y1, sWidth, sWidth }; - bounds[1] = Rectangle { x1, y2, sWidth, sWidth }; - bounds[2] = Rectangle { x2, y1, sWidth, sWidth }; - bounds[3] = Rectangle { x3, y1, sWidth, sWidth }; - bounds[4] = Rectangle { x4, y3, xDim, yDim }; + bounds[0] = juce::Rectangle { 0, y1, sWidth, sWidth }; + bounds[1] = juce::Rectangle { x1, y2, sWidth, sWidth }; + bounds[2] = juce::Rectangle { x2, y1, sWidth, sWidth }; + bounds[3] = juce::Rectangle { x3, y1, sWidth, sWidth }; + bounds[4] = juce::Rectangle { x4, y3, xDim, yDim }; for (auto* s : sliders) { @@ -402,7 +402,7 @@ void KnobsComponent::resized() { s->setSliderStyle (Slider::SliderStyle::LinearVertical); s->setTextBoxStyle (Slider::TextBoxBelow, false, width - 2, proportionOfHeight (0.11f)); - auto bounds = Rectangle { x + 2, yPad, width - 4, getHeight() - yPad }; + auto bounds = juce::Rectangle { x + 2, yPad, width - 4, getHeight() - yPad }; x += width; s->setBounds (bounds); diff --git a/src/gui/pedalboard/editors/ProcessorEditor.cpp b/src/gui/pedalboard/editors/ProcessorEditor.cpp index 6eedfc09..80082ec7 100644 --- a/src/gui/pedalboard/editors/ProcessorEditor.cpp +++ b/src/gui/pedalboard/editors/ProcessorEditor.cpp @@ -201,9 +201,9 @@ void ProcessorEditor::resized() if (! isIOProcessor) { const auto xButtonSize = proportionOfWidth (0.1f); - settingsButton.setBounds (Rectangle { width - 3 * xButtonSize, 0, xButtonSize, xButtonSize }.reduced (proportionOfWidth (0.01f))); + settingsButton.setBounds (juce::Rectangle { width - 3 * xButtonSize, 0, xButtonSize, xButtonSize }.reduced (proportionOfWidth (0.01f))); powerButton.setBounds (width - 2 * xButtonSize, 0, xButtonSize, xButtonSize); - xButton.setBounds (Rectangle { width - xButtonSize, 0, xButtonSize, xButtonSize }.reduced (proportionOfWidth (0.015f))); + xButton.setBounds (juce::Rectangle { width - xButtonSize, 0, xButtonSize, xButtonSize }.reduced (proportionOfWidth (0.015f))); } const int portDim = proportionOfHeight (0.17f); diff --git a/src/gui/toolbar/presets/PresetSearchHelpers.cpp b/src/gui/toolbar/presets/PresetSearchHelpers.cpp index d6aee1bb..3f0af8be 100644 --- a/src/gui/toolbar/presets/PresetSearchHelpers.cpp +++ b/src/gui/toolbar/presets/PresetSearchHelpers.cpp @@ -2,6 +2,11 @@ namespace preset_search { +static std::string_view to_string_view (const juce::String& str) noexcept +{ + return { str.toRawUTF8(), str.getNumBytesAsUTF8() }; +} + void initialiseDatabase (const chowdsp::PresetManager& presetManager, Database& database) { enum SearchFields @@ -14,7 +19,7 @@ void initialiseDatabase (const chowdsp::PresetManager& presetManager, Database& juce::Logger::writeToLog ("Initializing preset search database..."); - database.reset(); + database.resetEntries (presetManager.getNumPresets()); database.setWeights ({ 1.0f, // Name 0.9f, // Vendor @@ -23,14 +28,14 @@ void initialiseDatabase (const chowdsp::PresetManager& presetManager, Database& database.setThreshold (0.5f); const auto t1 = std::chrono::steady_clock::now(); - std::vector fields (magic_enum::enum_count()); + std::array fields {}; for (const auto& [presetID, preset] : presetManager.getPresetMap()) { - fields[Name] = preset.getName().toStdString(); - fields[Vendor] = preset.getVendor().toStdString(); - fields[Category] = preset.getCategory().toStdString(); - database.addEntry (presetID, fields); // TODO: it would be cool if we could add entries in a batch? + fields[Name] = to_string_view (preset.getName()); + fields[Vendor] = to_string_view (preset.getVendor()); + fields[Category] = to_string_view (preset.getCategory()); + database.addEntry (presetID, fields); } const auto t2 = std::chrono::steady_clock::now(); @@ -38,13 +43,19 @@ void initialiseDatabase (const chowdsp::PresetManager& presetManager, Database& juce::Logger::writeToLog ("Finished scanning preset database in " + juce::String { fp_ms.count() } + " milliseconds"); + + database.prepareForSearch(); } Results getSearchResults (const chowdsp::PresetManager& presetManager, const Database& database, const juce::String& query) { + const auto searchResults = database.search (to_string_view (query)); + Results resultsVector; + resultsVector.reserve (searchResults.size()); + const auto& presetMap = presetManager.getPresetMap(); - for (const auto result : database.search (query.toStdString())) + for (const auto& result : searchResults) { const auto presetIter = presetMap.find (result.key); if (presetIter != presetMap.end()) diff --git a/src/gui/toolbar/presets/PresetSearchHelpers.h b/src/gui/toolbar/presets/PresetSearchHelpers.h index 8c377d36..5d7105df 100644 --- a/src/gui/toolbar/presets/PresetSearchHelpers.h +++ b/src/gui/toolbar/presets/PresetSearchHelpers.h @@ -4,7 +4,8 @@ namespace preset_search { -using Database = fuzzysearch::Database; +static constexpr size_t numPresetSearchFields = 3; +using Database = chowdsp::SearchDatabase; using Results = std::vector; void initialiseDatabase (const chowdsp::PresetManager& presetManager, Database& database); diff --git a/src/gui/toolbar/presets/PresetSearchWindow.cpp b/src/gui/toolbar/presets/PresetSearchWindow.cpp index 67c10056..ae8cdd2d 100644 --- a/src/gui/toolbar/presets/PresetSearchWindow.cpp +++ b/src/gui/toolbar/presets/PresetSearchWindow.cpp @@ -36,7 +36,7 @@ struct PresetSearchWindow::ResultsListModel : public ListBoxModel void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool rowIsSelected) override { - auto bounds = Rectangle { width, height }; + auto bounds = juce::Rectangle { width, height }; if (rowIsSelected) { g.setColour (Colour (0xFF0EDED4)); diff --git a/src/gui/toolbar/presets/PresetsSaveDialog.cpp b/src/gui/toolbar/presets/PresetsSaveDialog.cpp index 982f3825..c8d084f8 100644 --- a/src/gui/toolbar/presets/PresetsSaveDialog.cpp +++ b/src/gui/toolbar/presets/PresetsSaveDialog.cpp @@ -97,7 +97,7 @@ void PresetsSaveDialog::paint (Graphics& g) g.setFont ((float) PresetSaveDims::itemHeight * 0.35f); auto drawItemLabel = [&] (const Component& comp, const String& label) { - auto textBounds = Rectangle { PresetSaveDims::labelsWidth, comp.getHeight() }.withY (comp.getY()); + auto textBounds = juce::Rectangle { PresetSaveDims::labelsWidth, comp.getHeight() }.withY (comp.getY()); g.drawFittedText (label, textBounds, Justification::centredRight, 1); }; diff --git a/src/gui/toolbar/presets/PresetsSyncDialog.cpp b/src/gui/toolbar/presets/PresetsSyncDialog.cpp index b6765057..b6b81d9c 100644 --- a/src/gui/toolbar/presets/PresetsSyncDialog.cpp +++ b/src/gui/toolbar/presets/PresetsSyncDialog.cpp @@ -29,7 +29,7 @@ struct PresetsListModel : public ListBoxModel void paintListBoxItem (int rowNumber, Graphics& g, int width, int height, bool /*rowIsSelected*/) override { - auto bounds = Rectangle { width, height }; + auto bounds = juce::Rectangle { width, height }; g.setColour (Colours::white.withAlpha (0.4f)); g.drawLine (Line { bounds.getTopLeft(), bounds.getTopRight() }.toFloat(), 1.0f); diff --git a/src/gui/utils/LevelMeterComponent.cpp b/src/gui/utils/LevelMeterComponent.cpp index 5ee0c10b..347e0914 100644 --- a/src/gui/utils/LevelMeterComponent.cpp +++ b/src/gui/utils/LevelMeterComponent.cpp @@ -23,9 +23,9 @@ LevelMeterComponent::LevelMeterComponent (const LevelDataType& levelData) : rmsL startTimerHz (timerHz); } -Rectangle LevelMeterComponent::getMeterBounds() const +juce::Rectangle LevelMeterComponent::getMeterBounds() const { - return Rectangle { 35, getHeight() - 2 }.withCentre (getLocalBounds().getCentre()); + return juce::Rectangle { 35, getHeight() - 2 }.withCentre (getLocalBounds().getCentre()); } void LevelMeterComponent::paint (Graphics& g) diff --git a/src/gui/utils/LevelMeterComponent.h b/src/gui/utils/LevelMeterComponent.h index ccc23cd5..57fb081e 100644 --- a/src/gui/utils/LevelMeterComponent.h +++ b/src/gui/utils/LevelMeterComponent.h @@ -14,7 +14,7 @@ class LevelMeterComponent : public Component, void timerCallback() final; private: - Rectangle getMeterBounds() const; + juce::Rectangle getMeterBounds() const; const LevelDataType& rmsLevels; std::array dbLevels; diff --git a/src/gui/utils/LookAndFeels.cpp b/src/gui/utils/LookAndFeels.cpp index d5817d4e..2ce64116 100644 --- a/src/gui/utils/LookAndFeels.cpp +++ b/src/gui/utils/LookAndFeels.cpp @@ -1,7 +1,7 @@ #include "LookAndFeels.h" //================================================================== -void ByodLNF::drawPopupMenuItem (Graphics& g, const Rectangle& area, const bool isSeparator, const bool isActive, const bool isHighlighted, const bool /*isTicked*/, const bool hasSubMenu, const String& text, const String& shortcutKeyText, const Drawable* icon, const Colour* const textColourToUse) +void ByodLNF::drawPopupMenuItem (Graphics& g, const juce::Rectangle& area, const bool isSeparator, const bool isActive, const bool isHighlighted, const bool /*isTicked*/, const bool hasSubMenu, const String& text, const String& shortcutKeyText, const Drawable* icon, const Colour* const textColourToUse) { LookAndFeel_V4::drawPopupMenuItem (g, area, isSeparator, isActive, isHighlighted, false /*isTicked*/, hasSubMenu, text, shortcutKeyText, icon, textColourToUse); } @@ -49,7 +49,7 @@ void ProcessorLNF::positionComboBoxText (ComboBox& box, Label& label) void ProcessorLNF::drawComboBox (Graphics& g, int width, int height, bool, int, int, int, int, ComboBox& box) { auto cornerSize = box.findParentComponentOfClass() != nullptr ? 0.0f : 3.0f; - Rectangle boxBounds (0, 0, width, height); + juce::Rectangle boxBounds (0, 0, width, height); g.setColour (box.findColour (ComboBox::backgroundColourId)); g.fillRoundedRectangle (boxBounds.toFloat(), cornerSize); diff --git a/src/gui/utils/LookAndFeels.h b/src/gui/utils/LookAndFeels.h index e9589891..a574c593 100644 --- a/src/gui/utils/LookAndFeels.h +++ b/src/gui/utils/LookAndFeels.h @@ -8,7 +8,7 @@ class ByodLNF : public chowdsp::ChowLNF ByodLNF() = default; ~ByodLNF() override = default; - void drawPopupMenuItem (Graphics& g, const Rectangle& area, const bool isSeparator, const bool isActive, const bool isHighlighted, const bool /*isTicked*/, const bool hasSubMenu, const String& text, const String& shortcutKeyText, const Drawable* icon, const Colour* const textColourToUse) override; + void drawPopupMenuItem (Graphics& g, const juce::Rectangle& area, const bool isSeparator, const bool isActive, const bool isHighlighted, const bool /*isTicked*/, const bool hasSubMenu, const String& text, const String& shortcutKeyText, const Drawable* icon, const Colour* const textColourToUse) override; void drawPopupMenuBackground (Graphics& g, int width, int height) override; void drawButtonBackground (Graphics& g, Button& button, const Colour& backgroundColour, bool shouldDrawButtonAsHighlighted, bool shouldDrawButtonAsDown) override; diff --git a/src/headless/ScreenshotGenerator.cpp b/src/headless/ScreenshotGenerator.cpp index a327941a..c3aa3a7e 100644 --- a/src/headless/ScreenshotGenerator.cpp +++ b/src/headless/ScreenshotGenerator.cpp @@ -34,7 +34,7 @@ void ScreenshotGenerator::takeScreenshots (const ArgumentList& args) plugin->editorBeingDeleted (editor.get()); } -void ScreenshotGenerator::screenshotForBounds (Component* editor, Rectangle bounds, const File& dir, const String& filename) +void ScreenshotGenerator::screenshotForBounds (Component* editor, juce::Rectangle bounds, const File& dir, const String& filename) { auto screenshot = editor->createComponentSnapshot (bounds); diff --git a/src/headless/ScreenshotGenerator.h b/src/headless/ScreenshotGenerator.h index e72a4c9b..4c404710 100644 --- a/src/headless/ScreenshotGenerator.h +++ b/src/headless/ScreenshotGenerator.h @@ -12,7 +12,7 @@ class ScreenshotGenerator : public ConsoleApplication::Command static void takeScreenshots (const ArgumentList& args); /** Take a single screenshot for a given rectangle */ - static void screenshotForBounds (Component* editor, Rectangle bounds, const File& dir, const String& filename); + static void screenshotForBounds (Component* editor, juce::Rectangle bounds, const File& dir, const String& filename); JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ScreenshotGenerator) }; diff --git a/src/pch.h b/src/pch.h index c4dbf6e4..1decd1d8 100644 --- a/src/pch.h +++ b/src/pch.h @@ -15,8 +15,6 @@ #include // Any other widely used headers that don't change... -#include - JUCE_BEGIN_IGNORE_WARNINGS_GCC_LIKE ("-Wzero-as-null-pointer-constant", "-Wsign-conversion") #include diff --git a/src/processors/BaseProcessor.cpp b/src/processors/BaseProcessor.cpp index 726d05a4..3282194e 100644 --- a/src/processors/BaseProcessor.cpp +++ b/src/processors/BaseProcessor.cpp @@ -363,7 +363,7 @@ PortType BaseProcessor::getOutputPortType (int portIndex) const return outputPortTypes[(size_t) portIndex]; } -void BaseProcessor::setPosition (juce::Point pos, Rectangle parentBounds) +void BaseProcessor::setPosition (juce::Point pos, juce::Rectangle parentBounds) { if (parentBounds.getWidth() <= 0 || parentBounds.getHeight() <= 0) return; // out of bounds! @@ -378,7 +378,7 @@ void BaseProcessor::setPosition (juce::Point pos, Rectangle parentBoun editorPosition.y = jlimit (0.0f, 0.9f, editorPosition.y); } -juce::Point BaseProcessor::getPosition (Rectangle parentBounds) +juce::Point BaseProcessor::getPosition (juce::Rectangle parentBounds) { return (editorPosition * juce::Point { (float) parentBounds.getWidth(), (float) parentBounds.getHeight() }).toInt(); } diff --git a/src/processors/BaseProcessor.h b/src/processors/BaseProcessor.h index bb67d951..711b997a 100644 --- a/src/processors/BaseProcessor.h +++ b/src/processors/BaseProcessor.h @@ -181,9 +181,9 @@ class BaseProcessor : private JuceProcWrapper PortType getInputPortType (int portIndex) const; PortType getOutputPortType (int portIndex) const; - void setPosition (juce::Point pos, Rectangle parentBounds); + void setPosition (juce::Point pos, juce::Rectangle parentBounds); void setPosition (const BaseProcessor& other) { editorPosition = other.editorPosition; } - juce::Point getPosition (Rectangle parentBounds); + juce::Point getPosition (juce::Rectangle parentBounds); const auto& getParameters() const { return AudioProcessor::getParameters(); } int getForwardingParameterSlotIndex() const noexcept { return forwardingParamsSlotIndex; } diff --git a/src/processors/ProcessorStore.cpp b/src/processors/ProcessorStore.cpp index 64bdd4c1..ad913f0c 100644 --- a/src/processors/ProcessorStore.cpp +++ b/src/processors/ProcessorStore.cpp @@ -1,3 +1,6 @@ +// Jai modules need to go first! +#include "other/krusher/Krusher.h" + #include "ProcessorStore.h" #include "drive/BassFace.h" @@ -60,7 +63,6 @@ #include "other/ShimmerReverb.h" #include "other/SmoothReverb.h" #include "other/cry_baby/CryBaby.h" -#include "other/krusher/Krusher.h" #include "other/poly_octave/PolyOctave.h" #include "other/spring_reverb/SpringReverbProcessor.h" diff --git a/src/processors/modulation/MIDIModulator.cpp b/src/processors/modulation/MIDIModulator.cpp index 62c277b3..104e7ba3 100644 --- a/src/processors/modulation/MIDIModulator.cpp +++ b/src/processors/modulation/MIDIModulator.cpp @@ -157,7 +157,7 @@ bool MidiModulator::getCustomComponents (OwnedArray& customComps, cho return degreesToRadians (120.0f * value - 60.0f); } - static void drawControlVizBackground (Graphics& g, Rectangle bounds, bool isBipolar) + static void drawControlVizBackground (Graphics& g, juce::Rectangle bounds, bool isBipolar) { g.setColour (Colours::grey.brighter()); @@ -198,7 +198,7 @@ bool MidiModulator::getCustomComponents (OwnedArray& customComps, cho } } - static void drawControlLine (Graphics& g, Rectangle bounds, float value, bool isBipolar) + static void drawControlLine (Graphics& g, juce::Rectangle bounds, float value, bool isBipolar) { const auto height = (float) bounds.getHeight(); const auto lineLength = height * 0.925f; diff --git a/src/processors/modulation/phaser/Phaser4.cpp b/src/processors/modulation/phaser/Phaser4.cpp index 14b6a645..e23a8955 100644 --- a/src/processors/modulation/phaser/Phaser4.cpp +++ b/src/processors/modulation/phaser/Phaser4.cpp @@ -14,23 +14,23 @@ const String mixTag = "mix"; } // namespace Phaser4Tags Phaser4::Phaser4 (UndoManager* um) : BaseProcessor ( - "Phaser4", - createParameterLayout(), - InputPort {}, - OutputPort {}, - um, - [] (InputPort port) - { - if (port == InputPort::ModulationInput) - return PortType::modulation; - return PortType::audio; - }, - [] (OutputPort port) - { - if (port == OutputPort::ModulationOutput) - return PortType::modulation; - return PortType::audio; - }) + "Phaser4", + createParameterLayout(), + InputPort {}, + OutputPort {}, + um, + [] (InputPort port) + { + if (port == InputPort::ModulationInput) + return PortType::modulation; + return PortType::audio; + }, + [] (OutputPort port) + { + if (port == OutputPort::ModulationOutput) + return PortType::modulation; + return PortType::audio; + }) { using namespace ParameterHelpers; loadParameterPointer (rateHzParam, vts, Phaser4Tags::rateTag); diff --git a/src/processors/other/krusher/Krusher.h b/src/processors/other/krusher/Krusher.h index d7eb0cc3..55ba487a 100644 --- a/src/processors/other/krusher/Krusher.h +++ b/src/processors/other/krusher/Krusher.h @@ -1,7 +1,5 @@ #pragma once -#include "processors/BaseProcessor.h" - #define KRUSHER_USE_JAI_IMPL BYOD_BUILDING_JAI_MODULES #if KRUSHER_USE_JAI_IMPL @@ -10,6 +8,8 @@ #include "krusher_fallback_impl.h" #endif +#include "processors/BaseProcessor.h" + class Krusher : public BaseProcessor { public: diff --git a/src/processors/other/krusher/krusher_fallback_impl.h b/src/processors/other/krusher/krusher_fallback_impl.h index 96c318a7..d2f915c4 100644 --- a/src/processors/other/krusher/krusher_fallback_impl.h +++ b/src/processors/other/krusher/krusher_fallback_impl.h @@ -1,5 +1,10 @@ #pragma once +#include +#include +#include +#include + struct Krusher_Lofi_Resample_State { double upsample_overshoot = 0.0; @@ -157,7 +162,6 @@ inline void bit_reduce_decode (const Bit_Reduction_Block& br_block, break; default: - jassertfalse; break; } } diff --git a/src/processors/other/poly_octave/PolyOctave.cpp b/src/processors/other/poly_octave/PolyOctave.cpp index 69b46dc3..d16b0a6e 100644 --- a/src/processors/other/poly_octave/PolyOctave.cpp +++ b/src/processors/other/poly_octave/PolyOctave.cpp @@ -97,7 +97,7 @@ void PolyOctave::processAudio (AudioBuffer& buffer) auto* up2Data = up2OctaveBuffer.getWritePointer (ch); auto* up2DataSIMD = reinterpret_cast (up2OctaveBuffer.getWritePointer (ch)); - jassert (juce::snapPointerToAlignment (up2DataSIMD, xsimd::default_arch::alignment()) == upDataSIMD); + jassert (juce::snapPointerToAlignment (up2DataSIMD, xsimd::default_arch::alignment()) == up2DataSIMD); std::fill (up2DataSIMD, up2DataSIMD + numSamples, float_2 {}); auto& upFilterBank = octaveUpFilterBank[static_cast (ch)]; diff --git a/src/processors/utility/Oscilloscope.cpp b/src/processors/utility/Oscilloscope.cpp index 3b81ad8c..09c771ba 100644 --- a/src/processors/utility/Oscilloscope.cpp +++ b/src/processors/utility/Oscilloscope.cpp @@ -91,7 +91,7 @@ void Oscilloscope::ScopeBackgroundTask::runTask (const AudioBuffer& buffe // update path ScopedLock sl (crit); - if (bounds == Rectangle {}) + if (bounds == juce::Rectangle {}) return; scopePath.clear(); @@ -100,7 +100,7 @@ void Oscilloscope::ScopeBackgroundTask::runTask (const AudioBuffer& buffe scopePath.lineTo (mapXY (i, data[triggerOffset + i])); } -void Oscilloscope::ScopeBackgroundTask::setBounds (Rectangle newBounds) +void Oscilloscope::ScopeBackgroundTask::setBounds (juce::Rectangle newBounds) { ScopedLock sl (crit); bounds = newBounds.toFloat(); diff --git a/src/processors/utility/Oscilloscope.h b/src/processors/utility/Oscilloscope.h index 618f01e6..74a634cf 100644 --- a/src/processors/utility/Oscilloscope.h +++ b/src/processors/utility/Oscilloscope.h @@ -26,13 +26,13 @@ class Oscilloscope : public BaseProcessor void runTask (const AudioBuffer& data) override; juce::Point mapXY (int sampleIndex, float yVal) const; - void setBounds (Rectangle newBounds); + void setBounds (juce::Rectangle newBounds); Path getScopePath() const noexcept; private: CriticalSection crit; Path scopePath; - Rectangle bounds {}; + juce::Rectangle bounds {}; int samplesToDisplay = 0; int triggerBuffer = 0; diff --git a/src/processors/utility/Tuner.cpp b/src/processors/utility/Tuner.cpp index f2425052..105dc1db 100644 --- a/src/processors/utility/Tuner.cpp +++ b/src/processors/utility/Tuner.cpp @@ -104,7 +104,7 @@ bool Tuner::getCustomComponents (OwnedArray& customComps, chowdsp::Ho return degreesToRadians (60.0f * centsNorm); } - static void drawTunerVizBackground (Graphics& g, Rectangle bounds) + static void drawTunerVizBackground (Graphics& g, juce::Rectangle bounds) { g.setColour (Colours::grey.brighter()); @@ -130,7 +130,7 @@ bool Tuner::getCustomComponents (OwnedArray& customComps, chowdsp::Ho } } - static void drawTunerLine (Graphics& g, Rectangle bounds, int cents) + static void drawTunerLine (Graphics& g, juce::Rectangle bounds, int cents) { const auto height = (float) bounds.getHeight(); const auto lineLength = height * 0.925f;