From 26fe46e4b0db0fccce6b0744e7cf85f5ab4314bb Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Fri, 15 Mar 2024 22:50:27 +0100 Subject: [PATCH 01/21] Added JUCE and StoneyDSP as git submodules --- .gitmodules | 6 ++++++ CMakeLists.txt | 3 +++ modules/JUCE | 1 + modules/StoneyDSP | 1 + 4 files changed, 11 insertions(+) create mode 100644 .gitmodules create mode 160000 modules/JUCE create mode 160000 modules/StoneyDSP diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ec15c49 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "modules/StoneyDSP"] + path = modules/StoneyDSP + url = https://github.com/StoneyDSP/StoneyDSP +[submodule "modules/JUCE"] + path = modules/JUCE + url = https://github.com/juce-framework/JUCE.git diff --git a/CMakeLists.txt b/CMakeLists.txt index b2d3882..2b44b9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -205,8 +205,11 @@ list (APPEND STONEYDSP_BIQUADS_TARGETS Biquads) #[=============================================================================[ Helpers ]=============================================================================]# + juce_generate_juce_header (Biquads) +juce_enable_vst3_manifest_step (Biquads) + unset(STONEYDSP_BIQUADS_INCLUDEDIR) set(STONEYDSP_BIQUADS_INCLUDEDIR $ diff --git a/modules/JUCE b/modules/JUCE new file mode 160000 index 0000000..a8ae6ed --- /dev/null +++ b/modules/JUCE @@ -0,0 +1 @@ +Subproject commit a8ae6edda6d3be78a139ec5e429dc57ef047e82a diff --git a/modules/StoneyDSP b/modules/StoneyDSP new file mode 160000 index 0000000..9548e94 --- /dev/null +++ b/modules/StoneyDSP @@ -0,0 +1 @@ +Subproject commit 9548e94f7e8ed375c6936e70ee9280fd812d95ec From 16629beb2068b3d1e4938fb7678377d24c4b6cfa Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sat, 16 Mar 2024 05:03:41 +0100 Subject: [PATCH 02/21] Moved all DSP into 'stoneydsp_audio' module --- CMakeLists.txt | 30 +- README.md | 4 +- VERSION | 2 +- include/StoneyDSP/Biquads.hpp | 4 +- include/StoneyDSP/Biquads/Editor.hpp | 4 +- include/StoneyDSP/Biquads/Parameters.hpp | 4 +- include/StoneyDSP/Biquads/Processor.hpp | 11 +- include/StoneyDSP/Biquads/Wrapper.hpp | 104 +--- .../filter/stoneydsp_Biquads.cpp | 544 ------------------ .../filter/stoneydsp_Biquads.hpp | 181 ------ .../filter/stoneydsp_FilterTypes.hpp | 51 -- .../filter/stoneydsp_TransformationTypes.hpp | 36 -- modules/stoneydsp_audio/stoneydsp_audio.cpp | 4 +- modules/stoneydsp_audio/stoneydsp_audio.h | 8 +- .../widgets/stoneydsp_Biquads.cpp | 504 ++++++++++++++++ .../widgets/stoneydsp_Biquads.hpp | 218 +++++++ package.json | 2 +- src/StoneyDSP/Biquads.cpp | 20 +- src/StoneyDSP/Biquads/Editor.cpp | 4 +- src/StoneyDSP/Biquads/Parameters.cpp | 4 +- src/StoneyDSP/Biquads/Processor.cpp | 21 +- src/StoneyDSP/Biquads/Wrapper.cpp | 487 ++-------------- vcpkg.json | 2 +- 23 files changed, 826 insertions(+), 1423 deletions(-) delete mode 100644 modules/stoneydsp_audio/filter/stoneydsp_Biquads.cpp delete mode 100644 modules/stoneydsp_audio/filter/stoneydsp_Biquads.hpp delete mode 100644 modules/stoneydsp_audio/filter/stoneydsp_FilterTypes.hpp delete mode 100644 modules/stoneydsp_audio/filter/stoneydsp_TransformationTypes.hpp create mode 100644 modules/stoneydsp_audio/widgets/stoneydsp_Biquads.cpp create mode 100644 modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b44b9f..eea61e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,25 +14,26 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . -. + ]=============================================================================]# cmake_minimum_required (VERSION 3.22...3.29 FATAL_ERROR) list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/share/cmake/Modules") -include(GetGitRevListCount) -get_git_rev_list_count() +include (GetGitRevListCount) +get_git_rev_list_count () -project (STONEYDSP_BIQUADS VERSION 1.2.1.${_git_rev_list_count} +project (STONEYDSP_BIQUADS + VERSION 1.2.2.${_git_rev_list_count} DESCRIPTION "Simple two-pole equalizer with variable oversampling." HOMEPAGE_URL "https://github.com/nathanjhood/Biquads" LANGUAGES C;CXX ) -include(StoneyDSPBiquadsWriteVersionFile) -stoneydsp_biquads_write_version_file() -unset(_git_rev_list_count) +include (StoneyDSPBiquadsWriteVersionFile) +stoneydsp_biquads_write_version_file () +unset (_git_rev_list_count) message (STATUS "Configuring StoneyDSP Biquads v${STONEYDSP_BIQUADS_VERSION}...") @@ -78,6 +79,8 @@ juce_add_plugin (Biquads # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone # ICON_SMALL ... + VST3_AUTO_MANIFEST FALSE + IS_SYNTH FALSE # Is this a synth or an effect? NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input? NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output? @@ -90,7 +93,7 @@ juce_add_plugin (Biquads FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 PRODUCT_NAME "Biquads" # The name of the final executable, which can differ from the target name - COMPANY_NAME StoneyDSP # Specify the name of the plugin's author + COMPANY_NAME "StoneyDSP" # Specify the name of the plugin's author ) set (STONEYDSP_BIQUADS_INCLUDEDIR "") @@ -114,7 +117,6 @@ list (APPEND STONEYDSP_BIQUADS_UNIT_FILES foreach (STONEYDSP_BIQUADS_UNIT_FILE IN LISTS STONEYDSP_BIQUADS_UNIT_FILES) string (REGEX REPLACE "[/]" "_" _stoneydsp_biquads_unit_transformed "${STONEYDSP_BIQUADS_UNIT_FILE}") - # set (_stoneydsp_biquads_unit_transformed ${_stoneydsp_biquads_unit_transformed}) string (TOUPPER "${_stoneydsp_biquads_unit_transformed}" _stoneydsp_biquads_unit_transformed_upper) message (DEBUG "Biquads: ${_stoneydsp_biquads_unit_transformed_upper} found at ${_stoneydsp_biquads_unit_transformed}") @@ -210,10 +212,10 @@ juce_generate_juce_header (Biquads) juce_enable_vst3_manifest_step (Biquads) -unset(STONEYDSP_BIQUADS_INCLUDEDIR) -set(STONEYDSP_BIQUADS_INCLUDEDIR - $ - $ +unset (STONEYDSP_BIQUADS_INCLUDEDIR) +set (STONEYDSP_BIQUADS_INCLUDEDIR + $ + $ ) #[=============================================================================[ @@ -245,7 +247,6 @@ endif () include(GNUInstallDirs) -# set(STONEYDSP_BIQUADS_HEADER "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP/Biquads.hpp") write_basic_package_version_file( "${STONEYDSP_BIQUADS_BINARY_DIR}/StoneyDSPBiquadsConfigVersion.cmake" @@ -312,7 +313,6 @@ install(FILES DESTINATION "${STONEYDSP_BIQUADS_INSTALL_DESTINATION}" ) -# offer a basic/messy CPack set(STONEYDSP_BIQUADS_CPACK_GENERATORS "") list(APPEND STONEYDSP_BIQUADS_CPACK_GENERATORS "ZIP" diff --git a/README.md b/README.md index ca92fc8..84ea782 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@
-![Biquads-1-2-1](https://stoneydsp.com/resources/projects/biquads/biquad-1-1-0.png) +![Biquads-1-2-2](https://stoneydsp.com/resources/projects/biquads/biquad-1-1-0.png) -| Latest release: | [v.1.2.1](https://github.com/nathanjhood/Biquads/tree/v1.2.1) | +| Latest release: | [v.1.2.2](https://github.com/nathanjhood/Biquads/tree/v1.2.2) | | :-: | :-: | | Latest development: | Formats: | [![windows-latest](https://github.com/nathanjhood/Biquads/actions/workflows/windows-latest.yaml/badge.svg?branch=development&event=push)](https://github.com/nathanjhood/Biquads/actions/workflows/windows-latest.yaml) | VST3, Standalone | diff --git a/VERSION b/VERSION index 80fd3df..41e46dd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.1.148 +1.2.2.151 diff --git a/include/StoneyDSP/Biquads.hpp b/include/StoneyDSP/Biquads.hpp index 1f59e63..3d03ea6 100644 --- a/include/StoneyDSP/Biquads.hpp +++ b/include/StoneyDSP/Biquads.hpp @@ -2,8 +2,8 @@ * @file Biquads.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood diff --git a/include/StoneyDSP/Biquads/Editor.hpp b/include/StoneyDSP/Biquads/Editor.hpp index c7ddd5b..d3bdae7 100644 --- a/include/StoneyDSP/Biquads/Editor.hpp +++ b/include/StoneyDSP/Biquads/Editor.hpp @@ -2,8 +2,8 @@ * @file Editor.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood diff --git a/include/StoneyDSP/Biquads/Parameters.hpp b/include/StoneyDSP/Biquads/Parameters.hpp index 33bb6e4..6b6c5c4 100644 --- a/include/StoneyDSP/Biquads/Parameters.hpp +++ b/include/StoneyDSP/Biquads/Parameters.hpp @@ -2,8 +2,8 @@ * @file Parameters.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood diff --git a/include/StoneyDSP/Biquads/Processor.hpp b/include/StoneyDSP/Biquads/Processor.hpp index 4ef89f6..0f3e595 100644 --- a/include/StoneyDSP/Biquads/Processor.hpp +++ b/include/StoneyDSP/Biquads/Processor.hpp @@ -2,8 +2,8 @@ * @file Processor.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -25,11 +25,6 @@ #ifndef STONEYDSP_BIQUADS_PROCESSOR_HPP_INCLUDED #define STONEYDSP_BIQUADS_PROCESSOR_HPP_INCLUDED -// #include "StoneyDSP/Biquads.hpp" - -// #include "Parameters.hpp" -// #include "Wrapper.hpp" - namespace StoneyDSP { /** @addtogroup StoneyDSP @{ */ @@ -110,7 +105,7 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor juce::AudioParameterFloat* gainPtr { nullptr }; juce::AudioParameterChoice* typePtr { nullptr }; juce::AudioParameterChoice* transformPtr { nullptr }; - // juce::AudioParameterChoice* osPtr { nullptr }; + juce::AudioParameterChoice* osPtr { nullptr }; juce::AudioParameterFloat* outputPtr { nullptr }; juce::AudioParameterFloat* mixPtr { nullptr }; juce::AudioParameterBool* bypassPtr { nullptr }; diff --git a/include/StoneyDSP/Biquads/Wrapper.hpp b/include/StoneyDSP/Biquads/Wrapper.hpp index 2e250fb..061c595 100644 --- a/include/StoneyDSP/Biquads/Wrapper.hpp +++ b/include/StoneyDSP/Biquads/Wrapper.hpp @@ -2,8 +2,8 @@ * @file Wrapper.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -37,19 +37,16 @@ template class AudioPluginAudioProcessorWrapper { public: - using filterType = StoneyDSP::Audio::FilterType; - using transformationType = StoneyDSP::Audio::TransformationType; //============================================================================== - /** Constructor. */ + /** + * @brief Construct a new ```StoneyDSP::Audio::AudioPluginAudioProcessorWrapper``` object. + * + * @param p + * @param apvts + * @param spec + */ AudioPluginAudioProcessorWrapper(AudioPluginAudioProcessor& p, juce::AudioProcessorValueTreeState& apvts, juce::dsp::ProcessSpec& spec); - //============================================================================== - void setFrequency(SampleType newFreq); - void setResonance(SampleType newRes); - void setGain(SampleType newGain); - void setFilterType(filterType newFiltType); - void setTransformType(transformationType newTransformType); - //============================================================================== /** Initialises the processor. */ void prepare(juce::dsp::ProcessSpec& spec); @@ -105,44 +102,6 @@ class AudioPluginAudioProcessorWrapper SampleType processSample(int channel, SampleType inputValue); - //========================================================================== - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType geta0() { return a0.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType getb0() { return b0.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType geta1() { return a1.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType getb1() { return b1.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType geta2() { return a2.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType getb2() { return b2.get(); } - //============================================================================== /** Updates the internal state variables of the processor. */ void update(); @@ -154,12 +113,8 @@ class AudioPluginAudioProcessorWrapper // SampleType getLatencySamples() const noexcept; private: - void calculateCoefficients(); - - SampleType directFormI (int channel, SampleType inputValue); - SampleType directFormII (int channel, SampleType inputValue); - SampleType directFormITransposed (int channel, SampleType inputValue); - SampleType directFormIITransposed (int channel, SampleType inputValue); + //============================================================================== + AudioPluginAudioProcessorWrapper() = delete; //============================================================================== // This reference is provided as a quick way for the wrapper to @@ -172,16 +127,7 @@ class AudioPluginAudioProcessorWrapper //============================================================================== // std::unique_ptr> oversampler[5]; juce::dsp::DryWetMixer mixer; - - //============================================================================== - /** Unit-delay object(s). */ - std::vector Wn_1, Wn_2, Xn_1, Xn_2, Yn_1, Yn_2; - - /** Coefficient gain(s). */ - StoneyDSP::Maths::Coefficient b0, b1, b2, a0, a1, a2; - - /** Coefficient calculation(s). */ - StoneyDSP::Maths::Coefficient b_0, b_1, b_2, a_0, a_1, a_2; + StoneyDSP::Audio::Biquads biquads; //============================================================================== /** Parameter pointers. */ @@ -190,38 +136,14 @@ class AudioPluginAudioProcessorWrapper juce::AudioParameterFloat* gainPtr; juce::AudioParameterChoice* typePtr; juce::AudioParameterChoice* transformPtr; - // juce::AudioParameterChoice* osPtr; + juce::AudioParameterChoice* osPtr; juce::AudioParameterFloat* outputPtr; juce::AudioParameterFloat* mixPtr; - filterType filterTypeParamValue { filterType::lowPass2 }; - transformationType transformationParamValue { transformationType::directFormIItransposed }; - bool bypassParamValue { false }; - //============================================================================== - /** Initialised parameter(s) */ - SampleType - loop = static_cast(0.0) - , outputSample = static_cast(0.0) - , minFreq = static_cast(20.0) - , maxFreq = static_cast(20000.0) - , hz = static_cast(1000.0) - , q = static_cast(0.5) - , g = static_cast(0.0) - ; - - SampleType omega, cos, sin, tan, alpha, a, sqrtA { static_cast(0.0) }; - //============================================================================== /** Initialised constant */ - const SampleType zero = StoneyDSP::Maths::Constants::zero; - const SampleType one = StoneyDSP::Maths::Constants::one; - const SampleType two = StoneyDSP::Maths::Constants::two; - const SampleType minusOne = StoneyDSP::Maths::Constants::minusOne; - const SampleType minusTwo = StoneyDSP::Maths::Constants::minusTwo; - - const SampleType pi = juce::MathConstants::pi; double sampleRate = 0.0; // int curOS = 0, prevOS = 0, oversamplingFactor = 1; diff --git a/modules/stoneydsp_audio/filter/stoneydsp_Biquads.cpp b/modules/stoneydsp_audio/filter/stoneydsp_Biquads.cpp deleted file mode 100644 index d9f3e33..0000000 --- a/modules/stoneydsp_audio/filter/stoneydsp_Biquads.cpp +++ /dev/null @@ -1,544 +0,0 @@ -/** - * @file stoneydsp_Biquads.cpp - * @author Nathan J. Hood (nathanjhood@googlemail.com) - * @brief - * @version 0.1 - * @date 2023-09-07 - * - * @copyright Copyright (c) 2023 - * - */ - -namespace StoneyDSP -{ -/** @addtogroup StoneyDSP - * @{ - */ - -namespace Audio -{ -/** @addtogroup Audio - * @{ - */ - -/** - * @brief Construct a new 'Biquads' object. - * - * @tparam SampleType - */ -template -Biquads::Biquads() - : b0 (static_cast (1.0)) - , b1 (static_cast (0.0)) - , b2 (static_cast (0.0)) - , a0 (static_cast (1.0)) - , a1 (static_cast (0.0)) - , a2 (static_cast (0.0)) - , b_0 (static_cast (1.0)) - , b_1 (static_cast (0.0)) - , b_2 (static_cast (0.0)) - , a_0 (static_cast (1.0)) - , a_1 (static_cast (0.0)) - , a_2 (static_cast (0.0)) - , loop (static_cast (0.0)) - , outputSample (static_cast (0.0)) - , minFreq (static_cast (20.0)) - , maxFreq (static_cast (20000.0)) - , hz (static_cast (1000.0)) - , q (static_cast (0.5)) - , g (static_cast (0.0)) -{ - reset(); -} - -/** - * @brief Sets the centre Frequency of the filter. - * - * @tparam SampleType - * @param newFreq Frequency in Hz. Range = 20..20000. - */ -template -void Biquads::setFrequency (SampleType newFreq) -{ - jassert(minFreq <= newFreq && newFreq <= maxFreq); - - // if (hz != newFreq) - // { - hz = juce::jlimit(minFreq, maxFreq, newFreq); - - omega = (hz * ((pi * two) / static_cast (sampleRate))); - cos = (std::cos(omega)); - sin = (std::sin(omega)); - - calculateCoefficients(); - // } -} - -/** - * @brief Sets the resonance of the filter. - * - * @tparam SampleType - * @param newRes Range = 0..1. - */ -template -void Biquads::setResonance(SampleType newRes) -{ - jassert(zero <= newRes && newRes <= one); - - // if (q != newRes) - // { - q = juce::jlimit(SampleType(0.0), SampleType(1.0), newRes); - - calculateCoefficients(); - // } -} - -/** - * @brief Sets the centre Frequency gain of the filter - * (Peak and shelf modes only). - * - * @tparam SampleType - * @param newGain Filter gain in dB. - */ -template -void Biquads::setGain(SampleType newGain) -{ - // if (g != newGain) - // { - g = newGain; - - calculateCoefficients(); - // } -} - -/** - * @brief Sets the type of the filter. - * - * @tparam SampleType - * @param newFiltType See 'FilterType' enum for available types. - */ -template -void Biquads::setFilterType(filterType newFiltType) -{ - if (filtType != newFiltType) - { - filtType = newFiltType; - - reset(); - calculateCoefficients(); - } -} - -/** - * @brief Sets the BiLinear Transform for the filter to use. - * - * @tparam SampleType - * @param newTransformType See enum for available types. - */ -template -void Biquads::setTransformType(transformationType newTransformType) -{ - if (transformType != newTransformType) - { - transformType = newTransformType; - reset(); - } -} - -/** - * @brief Initialises the processor. - * - * @tparam SampleType - * @param spec - */ -template -void Biquads::prepare(juce::dsp::ProcessSpec& spec) -{ - jassert(spec.sampleRate > 0); - jassert(spec.numChannels > 0); - - sampleRate = spec.sampleRate; - - Wn_1.resize(spec.numChannels); - Wn_2.resize(spec.numChannels); - Xn_1.resize(spec.numChannels); - Xn_2.resize(spec.numChannels); - Yn_1.resize(spec.numChannels); - Yn_2.resize(spec.numChannels); - - minFreq = static_cast (sampleRate / 24576.0); - maxFreq = static_cast (sampleRate / 2.125); - - jassert(static_cast (20.0) >= minFreq && minFreq <= static_cast (20000.0)); - jassert(static_cast (20.0) <= maxFreq && maxFreq >= static_cast (20000.0)); - - reset(); - - setFrequency(hz); - setResonance(q); - setGain(g); - setFilterType(filtType); - setTransformType(transformType); -} - -/** - * @brief Resets the internal state variables of the processor. - * - * @tparam SampleType - * @param initialValue - */ -template -void Biquads::reset(SampleType initialValue) -{ - for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) - std::fill(v->begin(), v->end(), initialValue); -} - -/** - * @brief Processes one sample at a time on a given channel. - * - * @tparam SampleType - * @param channel - * @param inputValue - * @return SampleType - */ -template -SampleType Biquads::processSample(int channel, SampleType inputValue) -{ - jassert(juce::isPositiveAndBelow(channel, Wn_1.size())); - jassert(juce::isPositiveAndBelow(channel, Wn_2.size())); - jassert(juce::isPositiveAndBelow(channel, Xn_1.size())); - jassert(juce::isPositiveAndBelow(channel, Xn_2.size())); - jassert(juce::isPositiveAndBelow(channel, Yn_1.size())); - jassert(juce::isPositiveAndBelow(channel, Yn_1.size())); - - switch (transformType) - { - case TransformationType::directFormI: - inputValue = directFormI(channel, inputValue); - break; - case TransformationType::directFormII: - inputValue = directFormII(channel, inputValue); - break; - case TransformationType::directFormItransposed: - inputValue = directFormITransposed(channel, inputValue); - break; - case TransformationType::directFormIItransposed: - inputValue = directFormIITransposed(channel, inputValue); - break; - default: - inputValue = directFormIITransposed(channel, inputValue); - } - - return inputValue; -} - -template -SampleType Biquads::directFormI(int channel, SampleType inputSample) -{ - auto& Xn1 = Xn_1[(size_t)channel]; - auto& Xn2 = Xn_2[(size_t)channel]; - auto& Yn1 = Yn_1[(size_t)channel]; - auto& Yn2 = Yn_2[(size_t)channel]; - - auto& Xn = inputSample; - auto& Yn = outputSample; - - Yn = ((Xn * b0) + (Xn1 * b1) + (Xn2 * b2) + (Yn1 * a1) + (Yn2 * a2)); - - Xn2 = Xn1, Yn2 = Yn1; - Xn1 = Xn, Yn1 = Yn; - - return Yn; -} - -template -SampleType Biquads::directFormII(int channel, SampleType inputSample) -{ - auto& Wn1 = Wn_1[(size_t)channel]; - auto& Wn2 = Wn_2[(size_t)channel]; - - auto& Wn = loop; - auto& Xn = inputSample; - auto& Yn = outputSample; - - Wn = (Xn + ((Wn1 * a1) + (Wn2 * a2))); - Yn = ((Wn * b0) + (Wn1 * b1) + (Wn2 * b2)); - - Wn2 = Wn1; - Wn1 = Wn; - - return Yn; -} - -template -SampleType Biquads::directFormITransposed(int channel, SampleType inputSample) -{ - auto& Wn1 = Wn_1[(size_t)channel]; - auto& Wn2 = Wn_2[(size_t)channel]; - auto& Xn1 = Xn_1[(size_t)channel]; - auto& Xn2 = Xn_2[(size_t)channel]; - - auto& Wn = loop; - auto& Xn = inputSample; - auto& Yn = outputSample; - - Wn = (Xn + Wn2); - Yn = ((Wn * b0) + Xn2); - - Xn2 = ((Wn * b1) + Xn1), Wn2 = ((Wn * a1) + Wn1); - Xn1 = (Wn * b2), Wn1 = (Wn * a2); - - return Yn; -} - -template -SampleType Biquads::directFormIITransposed(int channel, SampleType inputSample) -{ - auto& Xn1 = Xn_1[(size_t)channel]; - auto& Xn2 = Xn_2[(size_t)channel]; - - auto& Xn = inputSample; - auto& Yn = outputSample; - - Yn = ((Xn * b0) + (Xn2)); - - Xn2 = ((Xn * b1) + (Xn1) + (Yn * a1)); - Xn1 = ((Xn * b2) + (Yn * a2)); - - return Yn; -} - -template -void Biquads::calculateCoefficients() -{ - alpha = (sin * (one - q)); - a = (std::pow(SampleType(10), (g * SampleType(0.05)))); - sqrtA = ((std::sqrt(a) * two) * alpha); - - switch (filtType) - { - case filterType::lowPass2: - - b_0 = (one - cos) / two; - b_1 = one - cos; - b_2 = (one - cos) / two; - a_0 = one + alpha; - a_1 = minusTwo * cos; - a_2 = one - alpha; - - break; - - - case filterType::lowPass1: - - b_0 = omega / (one + omega); - b_1 = omega / (one + omega); - b_2 = zero; - a_0 = one; - a_1 = minusOne * ((one - omega) / (one + omega)); - a_2 = zero; - - break; - - - case filterType::highPass2: - - b_0 = (one + cos) / two; - b_1 = minusOne * (one + cos); - b_2 = (one + cos) / two; - a_0 = one + alpha; - a_1 = minusTwo * cos; - a_2 = one - alpha; - - break; - - - case filterType::highPass1: - - b_0 = one / (one + omega); - b_1 = (one / (one + omega)) * minusOne; - b_2 = zero; - a_0 = one; - a_1 = ((one - omega) / (one + omega)) * minusOne; - a_2 = zero; - - break; - - - case filterType::bandPass: - - b_0 = sin / two; - b_1 = zero; - b_2 = minusOne * (sin / two); - a_0 = one + alpha; - a_1 = minusTwo * cos; - a_2 = one - alpha; - - break; - - - case filterType::bandPassQ: - - b_0 = alpha; - b_1 = zero; - b_2 = minusOne * alpha; - a_0 = one + alpha; - a_1 = minusTwo * cos; - a_2 = one - alpha; - - break; - - - case filterType::lowShelf2: - - b_0 = (((a + one) - ((a - one) * cos)) + sqrtA) * a; - b_1 = (((a - one) - ((a + one) * cos)) * two) * a; - b_2 = (((a + one) - ((a - one) * cos)) - sqrtA) * a; - a_0 = ((a + one) + ((a - one) * cos)) + sqrtA; - a_1 = ((a - one) + ((a + one) * cos)) * minusTwo; - a_2 = ((a + one) + ((a - one) * cos)) - sqrtA; - - break; - - - case filterType::lowShelf1: - - b_0 = one + ((omega / (one + omega)) * (minusOne + (a * a))); - b_1 = (((omega / (one + omega)) * (minusOne + (a * a))) - ((one - omega) / (one + omega))); - b_2 = zero; - a_0 = one; - a_1 = minusOne * ((one - omega) / (one + omega)); - a_2 = zero; - - break; - - - case filterType::lowShelf1C: - - b_0 = one + ((omega / a) / (one + (omega / a)) * (minusOne + (a * a))); - b_1 = ((((omega / a) / (one + (omega / a))) * (minusOne + (a * a))) - ((one - (omega / a)) / (one + (omega / a)))); - b_2 = zero; - a_0 = one; - a_1 = minusOne * ((one - (omega / a)) / (one + (omega / a))); - a_2 = zero; - - break; - - - case filterType::highShelf2: - - b_0 = (((a + one) + ((a - one) * cos)) + sqrtA) * a; - b_1 = (((a - one) + ((a + one) * cos)) * minusTwo) * a; - b_2 = (((a + one) + ((a - one) * cos)) - sqrtA) * a; - a_0 = ((a + one) - ((a - one) * cos)) + sqrtA; - a_1 = ((a - one) - ((a + one) * cos)) * two; - a_2 = ((a + one) - ((a - one) * cos)) - sqrtA; - - break; - - - case filterType::highShelf1: - - b_0 = one + ((minusOne + (a * a)) / (one + omega)); - b_1 = minusOne * (((one - omega) / (one + omega)) + ((minusOne + (a * a)) / (one + omega))); - b_2 = zero; - a_0 = one; - a_1 = minusOne * ((one - omega) / (one + omega)); - a_2 = zero; - - break; - - - case filterType::highShelf1C: - - b_0 = one + ((minusOne + (a * a)) / (one + (omega * a))); - b_1 = minusOne * (((one - (omega * a)) / (one + (omega * a))) + ((minusOne + (a * a)) / (one + (omega * a)))); - b_2 = zero; - a_0 = one; - a_1 = minusOne * ((one - (omega * a)) / (one + (omega * a))); - a_2 = zero; - - break; - - - case filterType::peak: - - b_0 = one + (alpha * a); - b_1 = minusTwo * cos; - b_2 = one - (alpha * a); - a_0 = one + (alpha / a); - a_1 = minusTwo * cos; - a_2 = one - (alpha / a); - - break; - - - case filterType::notch: - - b_0 = one; - b_1 = minusTwo * cos; - b_2 = one; - a_0 = one + alpha; - a_1 = minusTwo * cos; - a_2 = one - alpha; - - break; - - - case filterType::allPass: - - b_0 = one - alpha; - b_1 = minusTwo * cos; - b_2 = one + alpha; - a_0 = one + alpha; - a_1 = minusTwo * cos; - a_2 = one - alpha; - - break; - - - default: - - b_0 = one; - b_1 = zero; - b_2 = zero; - a_0 = one; - a_1 = zero; - a_2 = zero; - - break; - } - - a0 = (one / a_0); - a1 = ((-a_1) * a0); - a2 = ((-a_2) * a0); - b0 = (b_0 * a0); - b1 = (b_1 * a0); - b2 = (b_2 * a0); -} - -/** - * @brief Ensure that the state variables are rounded to zero if the state - * variables are denormals. This is only needed if you are doing sample - * by sample processing. - * - * @tparam SampleType - */ -template -void Biquads::snapToZero() noexcept -{ - for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) - for (auto& element : *v) - juce::dsp::util::snapToZero(element); -} - -//============================================================================== -template class Biquads; -template class Biquads; - - /// @} group Audio -} // namespace Audio - - /// @} group StoneyDSP -} // namespace StoneyDSP diff --git a/modules/stoneydsp_audio/filter/stoneydsp_Biquads.hpp b/modules/stoneydsp_audio/filter/stoneydsp_Biquads.hpp deleted file mode 100644 index b92d44d..0000000 --- a/modules/stoneydsp_audio/filter/stoneydsp_Biquads.hpp +++ /dev/null @@ -1,181 +0,0 @@ -/** - * @file stoneydsp_Biquads.hpp - * @author Nathan J. Hood (nathanjhood@googlemail.com) - * @brief - * @version 0.1 - * @date 2023-09-07 - * - * @copyright Copyright (c) 2023 - * - */ - -namespace StoneyDSP -{ -/** @addtogroup StoneyDSP - * @{ - */ - -namespace Audio -{ -/** @addtogroup Audio - * @{ - */ - -/** - * @brief The 'Biquads' class. - * - * @tparam SampleType - */ -template -class Biquads -{ -public: - - using filterType = FilterType; - using transformationType = TransformationType; - - Biquads(); - - void setFrequency(SampleType newFreq); - void setResonance(SampleType newRes); - void setGain(SampleType newGain); - void setFilterType(filterType newFiltType); - void setTransformType(transformationType newTransformType); - - void prepare(juce::dsp::ProcessSpec& spec); - void reset(SampleType initialValue = { 0.0 }); - void snapToZero() noexcept; - - /** - * @brief Processes the input and output samples supplied in the - * processing context. - * - * @tparam ProcessContext - * @param context - */ - template - void process(const ProcessContext& context) noexcept - { - const auto& inputBlock = context.getInputBlock(); - auto& outputBlock = context.getOutputBlock(); - const auto numChannels = outputBlock.getNumChannels(); - const auto numSamples = outputBlock.getNumSamples(); - //const auto len = inputBlock.getNumSamples(); - - jassert(inputBlock.getNumChannels() == numChannels); - jassert(inputBlock.getNumSamples() == numSamples); - - if (context.isBypassed) - { - outputBlock.copyFrom(inputBlock); - return; - } - - for (size_t channel = 0; channel < numChannels; ++channel) - { - auto* inputSamples = inputBlock.getChannelPointer(channel); - auto* outputSamples = outputBlock.getChannelPointer(channel); - - for (size_t i = 0; i < numSamples; ++i) - outputSamples[i] = processSample((int)channel, inputSamples[i]); - } - -#if JUCE_DSP_ENABLE_SNAP_TO_ZERO - snapToZero(); -#endif - } - - SampleType processSample(int channel, SampleType inputValue); - - //========================================================================== - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType geta0() { return a0.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType getb0() { return b0.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType geta1() { return a1.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType getb1() { return b1.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType geta2() { return a2.get(); } - /** - * @brief Coefficient current value. Safe to pass i.e. to the display thread. - * - * @return SampleType - */ - SampleType getb2() { return b2.get(); } - -private: - - void calculateCoefficients(); - - SampleType directFormI(int channel, SampleType inputValue); - SampleType directFormII(int channel, SampleType inputValue); - SampleType directFormITransposed(int channel, SampleType inputValue); - SampleType directFormIITransposed(int channel, SampleType inputValue); - - /** - * @brief Unit-delay object(s). - * - */ - std::vector Wn_1, Wn_2, Xn_1, Xn_2, Yn_1, Yn_2; - - /** - * @brief Coefficient gain(s). - * - */ - StoneyDSP::Maths::Coefficient b0, b1, b2, a0, a1, a2; - - /** Coefficient calculation(s). */ - StoneyDSP::Maths::Coefficient b_0, b_1, b_2, a_0, a_1, a_2; - - /** Initialised parameter(s) */ - SampleType - loop = 0.0 - , outputSample = 0.0 - , minFreq = 20.0 - , maxFreq = 20000.0 - , hz = 1000.0 - , q = 0.5 - , g = 0.0 - ; - - filterType filtType = filterType::lowPass2; - transformationType transformType = transformationType::directFormIItransposed; - - SampleType omega, cos, sin, tan, alpha, a, sqrtA { 0.0 }; - - //========================================================================== - /** Initialised constant */ - const SampleType zero = 0.0, one = 1.0, two = 2.0, minusOne = -1.0, minusTwo = -2.0; - const SampleType pi = juce::MathConstants::pi; - double sampleRate = 48000.0; - - JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Biquads) -}; - - /// @} group Audio -} // namespace Audio - - /// @} group StoneyDSP -} // namespace StoneyDSP diff --git a/modules/stoneydsp_audio/filter/stoneydsp_FilterTypes.hpp b/modules/stoneydsp_audio/filter/stoneydsp_FilterTypes.hpp deleted file mode 100644 index 0c7510c..0000000 --- a/modules/stoneydsp_audio/filter/stoneydsp_FilterTypes.hpp +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @file stoneydsp_FilterTypes.hpp - * @author Nathan J. Hood (nathanjhood@googlemail.com) - * @brief - * @version 1.1.0 - * @date 2024-03-13 - * - * @copyright Copyright (c) 2024 - * - */ - -namespace StoneyDSP -{ -/** @addtogroup StoneyDSP - * @{ - */ - -namespace Audio -{ -/** @addtogroup Audio - * @{ - */ - -/** - * @brief A list of the types of the filter. - * - */ -enum struct FilterType -{ - lowPass2 = 0, - lowPass1 = 1, - highPass2 = 2, - highPass1 = 3, - bandPass = 4, - bandPassQ = 5, - lowShelf2 = 6, - lowShelf1 = 7, - lowShelf1C = 8, - highShelf2 = 9, - highShelf1 = 10, - highShelf1C = 11, - peak = 12, - notch = 13, - allPass = 14 -}; - - /// @} group Audio -} // namespace Audio - - /// @} group StoneyDSP -} // namespace StoneyDSP diff --git a/modules/stoneydsp_audio/filter/stoneydsp_TransformationTypes.hpp b/modules/stoneydsp_audio/filter/stoneydsp_TransformationTypes.hpp deleted file mode 100644 index fc88773..0000000 --- a/modules/stoneydsp_audio/filter/stoneydsp_TransformationTypes.hpp +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @file stoneydsp_TransformationTypes.hpp - * @author Nathan J. Hood (nathanjhood@googlemail.com) - * @brief - * @version 1.1.0 - * @date 2024-03-13 - * - * @copyright Copyright (c) 2024 - * - */ - -namespace StoneyDSP -{ -/** @addtogroup StoneyDSP - * @{ - */ - -namespace Audio -{ -/** @addtogroup Audio - * @{ - */ - -enum struct TransformationType -{ - directFormI = 0, - directFormII = 1, - directFormItransposed = 2, - directFormIItransposed = 3 -}; - - /// @} group Audio -} // namespace Audio - - /// @} group StoneyDSP -} // namespace StoneyDSP diff --git a/modules/stoneydsp_audio/stoneydsp_audio.cpp b/modules/stoneydsp_audio/stoneydsp_audio.cpp index fd7a8a1..0fd02bb 100644 --- a/modules/stoneydsp_audio/stoneydsp_audio.cpp +++ b/modules/stoneydsp_audio/stoneydsp_audio.cpp @@ -35,4 +35,6 @@ #include "stoneydsp_audio.h" -#include "filter/stoneydsp_Biquads.cpp" +// #include "filter/stoneydsp_Biquads.cpp" + +#include "widgets/stoneydsp_Biquads.cpp" diff --git a/modules/stoneydsp_audio/stoneydsp_audio.h b/modules/stoneydsp_audio/stoneydsp_audio.h index 5f62dc1..153c8c9 100644 --- a/modules/stoneydsp_audio/stoneydsp_audio.h +++ b/modules/stoneydsp_audio/stoneydsp_audio.h @@ -67,6 +67,8 @@ namespace Audio } // namespace Audio } // namespace StoneyDSP -#include "filter/stoneydsp_FilterTypes.hpp" -#include "filter/stoneydsp_TransformationTypes.hpp" -#include "filter/stoneydsp_Biquads.hpp" +// #include "filter/stoneydsp_FilterTypes.hpp" +// #include "filter/stoneydsp_TransformationTypes.hpp" +// #include "filter/stoneydsp_Biquads.hpp" + +#include "widgets/stoneydsp_Biquads.hpp" diff --git a/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.cpp b/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.cpp new file mode 100644 index 0000000..6514c88 --- /dev/null +++ b/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.cpp @@ -0,0 +1,504 @@ +/***************************************************************************//** + * @file stoneydsp_Biquads.hpp + * @author Nathan J. Hood + * @brief + * @version 1.0.0 + * @date 2024-02-21 + * + * @copyright Copyright (c) 2024 + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + ******************************************************************************/ + +namespace StoneyDSP { +/** @addtogroup StoneyDSP @{ */ + +namespace Audio { +/** @addtogroup StoneyDSP::Audio @{ */ + +template +Biquads::Biquads() +: b0 (StoneyDSP::Maths::Constants::one) +, b1 (StoneyDSP::Maths::Constants::zero) +, b2 (StoneyDSP::Maths::Constants::zero) +, a0 (StoneyDSP::Maths::Constants::one) +, a1 (StoneyDSP::Maths::Constants::zero) +, a2 (StoneyDSP::Maths::Constants::zero) +, b_0 (StoneyDSP::Maths::Constants::one) +, b_1 (StoneyDSP::Maths::Constants::zero) +, b_2 (StoneyDSP::Maths::Constants::zero) +, a_0 (StoneyDSP::Maths::Constants::one) +, a_1 (StoneyDSP::Maths::Constants::zero) +, a_2 (StoneyDSP::Maths::Constants::zero) +, loop (StoneyDSP::Maths::Constants::zero) +, outputSample (StoneyDSP::Maths::Constants::zero) +, minFrequency (static_cast (20.0)) +, maxFrequency (static_cast (20000.0)) +, hz (static_cast (1000.0)) +, q (static_cast (0.5)) +, g (StoneyDSP::Maths::Constants::zero) +{ + reset(zero); + update(); +} + + +template +void Biquads::setFrequency (SampleType newFrequency) +{ + jassert(minFrequency <= newFrequency && newFrequency <= maxFrequency); + + hz = juce::jlimit(minFrequency, maxFrequency, newFrequency); + + omega = (hz * ((pi * two) / static_cast (sampleRate))); + cos = (std::cos(omega)); + sin = (std::sin(omega)); + + update(); // calculateCoefficients(); +} + +template +void Biquads::setResonance(SampleType newResonance) +{ + jassert(zero <= newResonance && newResonance <= one); + + q = juce::jlimit(zero, one, newResonance); + update(); // calculateCoefficients(); +} + +template +void Biquads::setGain(SampleType newGain) +{ + g = newGain; + update(); // calculateCoefficients(); +} + +template +void Biquads::setFilterType(filterType newFilterType) +{ + if (filterTypeParamValue != newFilterType) + { + filterTypeParamValue = newFilterType; + + reset(zero); + update(); // calculateCoefficients(); + } +} + +template +void Biquads::setTransformType(transformationType newTransformationType) +{ + if (transformationParamValue != newTransformationType) + { + transformationParamValue = newTransformationType; + reset(zero); + update(); // calculateCoefficients(); + } +} + +template +void Biquads::prepare(juce::dsp::ProcessSpec& spec) +{ + jassert(spec.sampleRate > 0); + jassert(spec.numChannels > 0); + + sampleRate = spec.sampleRate; + + Wn_1.resize(spec.numChannels); + Wn_2.resize(spec.numChannels); + Xn_1.resize(spec.numChannels); + Xn_2.resize(spec.numChannels); + Yn_1.resize(spec.numChannels); + Yn_2.resize(spec.numChannels); + + minFrequency = static_cast (sampleRate / 24576.0); + maxFrequency = static_cast (sampleRate / 2.125); + + jassert(static_cast (20.0) >= minFrequency && minFrequency <= static_cast (20000.0)); + jassert(static_cast (20.0) <= maxFrequency && maxFrequency >= static_cast (20000.0)); + + reset(zero); + + setFrequency(hz); + setResonance(q); + setGain(g); + setFilterType(filterTypeParamValue); + setTransformType(transformationParamValue); + + update(); // calculateCoefficients(); +} + +template +void Biquads::reset() +{ + SampleType initialValue = zero; + + for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) + std::fill(v->begin(), v->end(), initialValue); +} + +template +void Biquads::reset(SampleType initialValue) +{ + for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) + std::fill(v->begin(), v->end(), initialValue); +} + +template +SampleType Biquads::processSample(int channel, SampleType inputValue) +{ + jassert(juce::isPositiveAndBelow(channel, Wn_1.size())); + jassert(juce::isPositiveAndBelow(channel, Wn_2.size())); + jassert(juce::isPositiveAndBelow(channel, Xn_1.size())); + jassert(juce::isPositiveAndBelow(channel, Xn_2.size())); + jassert(juce::isPositiveAndBelow(channel, Yn_1.size())); + jassert(juce::isPositiveAndBelow(channel, Yn_1.size())); + + switch (transformationParamValue) + { + case StoneyDSP::Audio::BiquadsBiLinearTransformationType::directFormI: + inputValue = directFormI(channel, inputValue); + break; + case StoneyDSP::Audio::BiquadsBiLinearTransformationType::directFormII: + inputValue = directFormII(channel, inputValue); + break; + case StoneyDSP::Audio::BiquadsBiLinearTransformationType::directFormItransposed: + inputValue = directFormITransposed(channel, inputValue); + break; + case StoneyDSP::Audio::BiquadsBiLinearTransformationType::directFormIItransposed: + inputValue = directFormIITransposed(channel, inputValue); + break; + default: + inputValue = directFormIITransposed(channel, inputValue); + } + + return inputValue; +} + +template +SampleType Biquads::directFormI(int channel, SampleType inputSample) +{ + auto& Xn1 = Xn_1[(size_t)channel]; + auto& Xn2 = Xn_2[(size_t)channel]; + auto& Yn1 = Yn_1[(size_t)channel]; + auto& Yn2 = Yn_2[(size_t)channel]; + + auto& Xn = inputSample; + auto& Yn = outputSample; + + Yn = ((Xn * b0) + (Xn1 * b1) + (Xn2 * b2) + (Yn1 * a1) + (Yn2 * a2)); + + Xn2 = Xn1, Yn2 = Yn1; + Xn1 = Xn, Yn1 = Yn; + + return Yn; +} + +template +SampleType Biquads::directFormII(int channel, SampleType inputSample) +{ + auto& Wn1 = Wn_1[(size_t)channel]; + auto& Wn2 = Wn_2[(size_t)channel]; + + auto& Wn = loop; + auto& Xn = inputSample; + auto& Yn = outputSample; + + Wn = ( Xn + ((Wn1 * a1) + (Wn2 * a2))); + Yn = ((Wn * b0) + (Wn1 * b1) + (Wn2 * b2)); + + Wn2 = Wn1; + Wn1 = Wn; + + return Yn; +} + +template +SampleType Biquads::directFormITransposed(int channel, SampleType inputSample) +{ + auto& Wn1 = Wn_1[(size_t)channel]; + auto& Wn2 = Wn_2[(size_t)channel]; + auto& Xn1 = Xn_1[(size_t)channel]; + auto& Xn2 = Xn_2[(size_t)channel]; + + auto& Wn = loop; + auto& Xn = inputSample; + auto& Yn = outputSample; + + Wn = ( Xn + Wn2); + Yn = ((Wn * b0) + Xn2); + + Xn2 = ((Wn * b1) + Xn1), Wn2 = ((Wn * a1) + Wn1); + Xn1 = ( Wn * b2), Wn1 = ( Wn * a2); + + return Yn; +} + +template +SampleType Biquads::directFormIITransposed(int channel, SampleType inputSample) +{ + auto& Xn1 = Xn_1[(size_t)channel]; + auto& Xn2 = Xn_2[(size_t)channel]; + + auto& Xn = inputSample; + auto& Yn = outputSample; + + Yn = ((Xn * b0) + (Xn2)); + + Xn2 = ((Xn * b1) + (Xn1) + (Yn * a1)); + Xn1 = ((Xn * b2) + (Yn * a2)); + + return Yn; +} + +template +void Biquads::calculateCoefficients() +{ + alpha = (sin * (one - q)); + a = (std::pow(SampleType(10), (g * SampleType(0.05)))); + sqrtA = ((std::sqrt(a) * two) * alpha); + + switch (filterTypeParamValue) + { + case filterType::lowPass2: + + b_0 = ((one - cos) / two); + b_1 = (one - cos); + b_2 = ((one - cos) / two); + a_0 = (one + alpha); + a_1 = (minusTwo * cos); + a_2 = (one - alpha); + + break; + + + case filterType::lowPass1: + + b_0 = (omega / (one + omega)); + b_1 = (omega / (one + omega)); + b_2 = (zero); + a_0 = (one); + a_1 = (minusOne * ((one - omega) / (one + omega))); + a_2 = (zero); + + break; + + + case filterType::highPass2: + + b_0 = (one + cos) / two; + b_1 = (minusOne * (one + cos)); + b_2 = ((one + cos) / two); + a_0 = (one + alpha); + a_1 = (minusTwo * cos); + a_2 = (one - alpha); + + break; + + + case filterType::highPass1: + + b_0 = (one / (one + omega)); + b_1 = ((one / (one + omega)) * minusOne); + b_2 = (zero); + a_0 = (one); + a_1 = (((one - omega) / (one + omega)) * minusOne); + a_2 = (zero); + + break; + + + case filterType::bandPass: + + b_0 = (sin / two); + b_1 = (zero); + b_2 = (minusOne * (sin / two)); + a_0 = (one + alpha); + a_1 = (minusTwo * cos); + a_2 = (one - alpha); + + break; + + + case filterType::bandPassQ: + + b_0 = (alpha); + b_1 = (zero); + b_2 = (minusOne * alpha); + a_0 = (one + alpha); + a_1 = (minusTwo * cos); + a_2 = (one - alpha); + + break; + + + case filterType::lowShelf2: + + b_0 = ((((a + one) - ((a - one) * cos)) + sqrtA) * a); + b_1 = ((((a - one) - ((a + one) * cos)) * two) * a); + b_2 = ((((a + one) - ((a - one) * cos)) - sqrtA) * a); + a_0 = (((a + one) + ((a - one) * cos)) + sqrtA); + a_1 = (((a - one) + ((a + one) * cos)) * minusTwo); + a_2 = (((a + one) + ((a - one) * cos)) - sqrtA); + + break; + + + case filterType::lowShelf1: + + b_0 = (one + ((omega / (one + omega)) * (minusOne + (a * a)))); + b_1 = ((((omega / (one + omega)) * (minusOne + (a * a))) - ((one - omega) / (one + omega)))); + b_2 = (zero); + a_0 = (one); + a_1 = (minusOne * ((one - omega) / (one + omega))); + a_2 = (zero); + + break; + + + case filterType::lowShelf1C: + + b_0 = (one + ((omega / a) / (one + (omega / a)) * (minusOne + (a * a)))); + b_1 = (((((omega / a) / (one + (omega / a))) * (minusOne + (a * a))) - ((one - (omega / a)) / (one + (omega / a))))); + b_2 = (zero); + a_0 = (one); + a_1 = (minusOne * ((one - (omega / a)) / (one + (omega / a)))); + a_2 = (zero); + + break; + + + case filterType::highShelf2: + + b_0 = ((((a + one) + ((a - one) * cos)) + sqrtA) * a); + b_1 = ((((a - one) + ((a + one) * cos)) * minusTwo) * a); + b_2 = ((((a + one) + ((a - one) * cos)) - sqrtA) * a); + a_0 = (((a + one) - ((a - one) * cos)) + sqrtA); + a_1 = (((a - one) - ((a + one) * cos)) * two); + a_2 = (((a + one) - ((a - one) * cos)) - sqrtA); + + break; + + + case filterType::highShelf1: + + b_0 = (one + ((minusOne + (a * a)) / (one + omega))); + b_1 = (minusOne * (((one - omega) / (one + omega)) + ((minusOne + (a * a)) / (one + omega)))); + b_2 = (zero); + a_0 = (one); + a_1 = (minusOne * ((one - omega) / (one + omega))); + a_2 = (zero); + + break; + + + case filterType::highShelf1C: + + b_0 = (one + ((minusOne + (a * a)) / (one + (omega * a)))); + b_1 = (minusOne * (((one - (omega * a)) / (one + (omega * a))) + ((minusOne + (a * a)) / (one + (omega * a))))); + b_2 = (zero); + a_0 = (one); + a_1 = (minusOne * ((one - (omega * a)) / (one + (omega * a)))); + a_2 = (zero); + + break; + + + case filterType::peak: + + b_0 = (one + (alpha * a)); + b_1 = (minusTwo * cos); + b_2 = (one - (alpha * a)); + a_0 = (one + (alpha / a)); + a_1 = (minusTwo * cos); + a_2 = (one - (alpha / a)); + + break; + + + case filterType::notch: + + b_0 = (one); + b_1 = (minusTwo * cos); + b_2 = (one); + a_0 = (one + alpha); + a_1 = (minusTwo * cos); + a_2 = (one - alpha); + + break; + + + case filterType::allPass: + + b_0 = (one - alpha); + b_1 = (minusTwo * cos); + b_2 = (one + alpha); + a_0 = (one + alpha); + a_1 = (minusTwo * cos); + a_2 = (one - alpha); + + break; + + + default: + + b_0 = one; + b_1 = zero; + b_2 = zero; + a_0 = one; + a_1 = zero; + a_2 = zero; + + break; + } + + a0 = ( one / a_0); + a1 = ((-a_1) * a0); + a2 = ((-a_2) * a0); + b0 = ( b_0 * a0); + b1 = ( b_1 * a0); + b2 = ( b_2 * a0); +} + +template +void Biquads::snapToZero() noexcept +{ + for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) + for (auto& element : *v) + juce::dsp::util::snapToZero(element); +} + +template +void Biquads::update() +{ + calculateCoefficients(); +} + +//============================================================================== +template class Biquads; +template class Biquads; + + /// @} group StoneyDSP::Audio +} // namespace Audio + + /// @} group StoneyDSP +} // namespace StoneyDSP diff --git a/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp b/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp new file mode 100644 index 0000000..34bb13d --- /dev/null +++ b/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp @@ -0,0 +1,218 @@ +/***************************************************************************//** + * @file stoneydsp_Biquads.hpp + * @author Nathan J. Hood + * @brief + * @version 1.0.0 + * @date 2024-02-21 + * + * @copyright Copyright (c) 2024 + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + ******************************************************************************/ + +namespace StoneyDSP { +/** @addtogroup StoneyDSP @{ */ + +namespace Audio { +/** @addtogroup StoneyDSP::Audio @{ */ + +/** @brief A list of the types of the filter. */ +enum struct BiquadsFilterType +{ + lowPass2 = 0, + lowPass1 = 1, + highPass2 = 2, + highPass1 = 3, + bandPass = 4, + bandPassQ = 5, + lowShelf2 = 6, + lowShelf1 = 7, + lowShelf1C = 8, + highShelf2 = 9, + highShelf1 = 10, + highShelf1C = 11, + peak = 12, + notch = 13, + allPass = 14 +}; + +enum struct BiquadsBiLinearTransformationType +{ + directFormI = 0, + directFormII = 1, + directFormItransposed = 2, + directFormIItransposed = 3 +}; + +/** + * @brief The 'Biquads' class. + * + * @tparam SampleType + */ +template +class Biquads +{ +public: + using filterType = StoneyDSP::Audio::BiquadsFilterType; + using transformationType = StoneyDSP::Audio::BiquadsBiLinearTransformationType; + //============================================================================== + /** Constructor. */ + Biquads(); + + //============================================================================== + /** + * @brief Sets the cutoff frequency of the filter. + * @param newFrequencyHz the new cutoff frequency in Hz. + */ + void setFrequency(SampleType newFrequencyHz); + /** + * @brief Sets the resonance of the filter. + * @param newResonance the new resonance amount from 0 (min) to 1 (max). + */ + void setResonance(SampleType newResonance); + /** + * @brief Sets the gain of the filter. + * @param newGain the new gain amount in Decibels. + */ + void setGain(SampleType newGain); + /** + * @brief Sets the type of the filter. + * @param newFilterType the new filter type. + */ + void setFilterType(filterType newFilterType); + /** + * @brief Sets the BiLinear Transform type of the filter. + * @param newTransformType the new transformation type. + */ + void setTransformType(transformationType newTransformType); + + //============================================================================== + /** Initialises the processor. */ + void prepare(juce::dsp::ProcessSpec& spec); + + /** Resets the internal state variables of the processor. */ + void reset(); + /** + * @brief Resets the internal state variables of the processor to the + * passed-in value. + * + * @param initialValue + */ + void reset(SampleType initialValue = { 0.0 }); + /** + * @brief Ensure that the state variables are rounded to zero if the state + * variables are denormals. This is only needed if you are doing sample by + * sample processing. + * + */ + void snapToZero() noexcept; + + //============================================================================== + /** Processes the input and output samples supplied in the processing context. */ + template + void process (const ProcessContext& context) noexcept + { + const auto& inputBlock = context.getInputBlock(); + auto& outputBlock = context.getOutputBlock(); + const auto numChannels = outputBlock.getNumChannels(); + const auto numSamples = outputBlock.getNumSamples(); + + jassert (inputBlock.getNumChannels() == numChannels); + jassert (inputBlock.getNumSamples() == numSamples); + + if (context.isBypassed) + { + outputBlock.copyFrom (inputBlock); + return; + } + + for (size_t channel = 0; channel < numChannels; ++channel) + { + auto* inputSamples = inputBlock .getChannelPointer (channel); + auto* outputSamples = outputBlock.getChannelPointer (channel); + + for (size_t i = 0; i < numSamples; ++i) + outputSamples[i] = processSample ((int) channel, inputSamples[i]); + } + } + + /** Performs the processing operation on a single sample at a time. */ + SampleType processSample (int channel, SampleType inputValue); + +private: + //============================================================================== + /** Updates the internal state variables of the processor. */ + void update(); + + void calculateCoefficients(); + + SampleType directFormI (int channel, SampleType inputValue); + SampleType directFormII (int channel, SampleType inputValue); + SampleType directFormITransposed (int channel, SampleType inputValue); + SampleType directFormIITransposed (int channel, SampleType inputValue); + + //============================================================================== + /** Unit-delay object(s). */ + std::vector Wn_1, Wn_2, Xn_1, Xn_2, Yn_1, Yn_2; + + /** Coefficient gain(s). */ + StoneyDSP::Maths::Coefficient b0, b1, b2, a0, a1, a2; + + /** Coefficient calculation(s). */ + StoneyDSP::Maths::Coefficient b_0, b_1, b_2, a_0, a_1, a_2; + + filterType filterTypeParamValue = { filterType::lowPass2 }; + transformationType transformationParamValue = { transformationType::directFormIItransposed }; + + //============================================================================== + /** Initialised parameter(s) */ + SampleType + loop = static_cast(0.0) + , outputSample = static_cast(0.0) + , minFrequency = static_cast(20.0) + , maxFrequency = static_cast(20000.0) + , hz = static_cast(1000.0) + , q = static_cast(0.5) + , g = static_cast(0.0) + ; + + SampleType omega, cos, sin, tan, alpha, a, sqrtA { static_cast(0.0) }; + + //============================================================================== + /** Initialised constant */ + const SampleType zero = StoneyDSP::Maths::Constants::zero; + const SampleType one = StoneyDSP::Maths::Constants::one; + const SampleType two = StoneyDSP::Maths::Constants::two; + const SampleType minusOne = StoneyDSP::Maths::Constants::minusOne; + const SampleType minusTwo = StoneyDSP::Maths::Constants::minusTwo; + + const SampleType pi = juce::MathConstants::pi; + double sampleRate = 0.0; + + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Biquads) +}; + + /// @} group StoneyDSP::Audio +} // namespace Audio + + /// @} group StoneyDSP +} // namespace StoneyDSP diff --git a/package.json b/package.json index b2854bf..67888e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stoneydsp/biquads", - "version": "1.2.1.148", + "version": "1.2.2.151", "main": "index.js", "author": { "email": "nathanjhood@googlemail.com", diff --git a/src/StoneyDSP/Biquads.cpp b/src/StoneyDSP/Biquads.cpp index e13d4ca..99bbf96 100644 --- a/src/StoneyDSP/Biquads.cpp +++ b/src/StoneyDSP/Biquads.cpp @@ -2,8 +2,8 @@ * @file Biquads.cpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -38,8 +38,8 @@ namespace ProjectInfo { extern const char* const projectName = "Biquads"; extern const char* const companyName = "StoneyDSP"; - extern const char* const versionString = "1.2.1.148"; - extern const int versionNumber = 0x1020194; + extern const char* const versionString = "1.2.2.151"; + extern const int versionNumber = 0x1020297; } /// @} group Biquads @@ -55,9 +55,9 @@ namespace ProjectInfo #include "Biquads/Editor.cpp" #endif -// //============================================================================== -// // This creates new instances of the plugin.. -// juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() -// { -// return new StoneyDSP::Biquads::AudioPluginAudioProcessor(); -// } +//============================================================================== +// This creates new instances of the plugin.. +juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() +{ + return new StoneyDSP::Biquads::AudioPluginAudioProcessor(); +} diff --git a/src/StoneyDSP/Biquads/Editor.cpp b/src/StoneyDSP/Biquads/Editor.cpp index db41645..cf87f08 100644 --- a/src/StoneyDSP/Biquads/Editor.cpp +++ b/src/StoneyDSP/Biquads/Editor.cpp @@ -2,8 +2,8 @@ * @file Editor.cpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood diff --git a/src/StoneyDSP/Biquads/Parameters.cpp b/src/StoneyDSP/Biquads/Parameters.cpp index 40f029c..d3748f9 100644 --- a/src/StoneyDSP/Biquads/Parameters.cpp +++ b/src/StoneyDSP/Biquads/Parameters.cpp @@ -2,8 +2,8 @@ * @file Parameters.cpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood diff --git a/src/StoneyDSP/Biquads/Processor.cpp b/src/StoneyDSP/Biquads/Processor.cpp index abe36ea..9eba3c9 100644 --- a/src/StoneyDSP/Biquads/Processor.cpp +++ b/src/StoneyDSP/Biquads/Processor.cpp @@ -2,8 +2,8 @@ * @file Processor.cpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -51,7 +51,7 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() , gainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) , typePtr(dynamic_cast (apvts.getParameter("Band_A_typeID"))) , transformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) -// , osPtr (dynamic_cast (apvts.getParameter("Master_osID"))) +, osPtr (dynamic_cast (apvts.getParameter("Master_osID"))) , outputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) , mixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) , bypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) @@ -62,7 +62,7 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() resonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); gainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); typePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); - // osPtr = dynamic_cast (apvts.getParameter("Master_osID")); + osPtr = dynamic_cast (apvts.getParameter("Master_osID")); outputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); mixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); bypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); @@ -72,7 +72,7 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() jassert(gainPtr != nullptr); jassert(typePtr != nullptr); jassert(transformPtr != nullptr); - // jassert(osPtr != nullptr); + jassert(osPtr != nullptr); jassert(outputPtr != nullptr); jassert(mixPtr != nullptr); jassert(bypassPtr != nullptr); @@ -209,8 +209,8 @@ void AudioPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPer processingPrecision = getProcessingPrecision(); spec.sampleRate = sampleRate; - spec.maximumBlockSize = samplesPerBlock; - spec.numChannels = getTotalNumOutputChannels(); + spec.maximumBlockSize = static_cast(samplesPerBlock); + spec.numChannels = static_cast(getTotalNumOutputChannels()); processorFlt.prepare(getSpec()); processorDbl.prepare(getSpec()); @@ -363,10 +363,3 @@ void AudioPluginAudioProcessor::setCurrentProgramStateInformation(const void* da /// @} group StoneyDSP } // namespace StoneyDSP - -//============================================================================== -// This creates new instances of the plugin.. -juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() -{ - return new StoneyDSP::Biquads::AudioPluginAudioProcessor(); -} diff --git a/src/StoneyDSP/Biquads/Wrapper.cpp b/src/StoneyDSP/Biquads/Wrapper.cpp index 186d0f5..da74fcc 100644 --- a/src/StoneyDSP/Biquads/Wrapper.cpp +++ b/src/StoneyDSP/Biquads/Wrapper.cpp @@ -2,8 +2,8 @@ * @file Wrapper.cpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.1.148 - * @date 2024-03-13 + * @version 1.2.2.151 + * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -35,47 +35,26 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A : audioProcessor (p) , state(apvts) , setup(spec) -// , parameters(p) -// , parameters(audioProcessor, state) , mixer() -// , biquad() -, b0 (one) -, b1 (zero) -, b2 (zero) -, a0 (one) -, a1 (zero) -, a2 (zero) -, b_0 (one) -, b_1 (zero) -, b_2 (zero) -, a_0 (one) -, a_1 (zero) -, a_2 (zero) -, loop (zero) -, outputSample (zero) -, minFreq (static_cast (20.0)) -, maxFreq (static_cast (20000.0)) -, hz (static_cast (1000.0)) -, q (static_cast (0.5)) -, g (zero) -, frequencyPtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_frequencyID"))) -, resonancePtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_resonanceID"))) -, gainPtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_gainID"))) +, biquads() +, frequencyPtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_frequencyID"))) +, resonancePtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_resonanceID"))) +, gainPtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_gainID"))) , typePtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_typeID"))) , transformPtr (dynamic_cast (p.getAPVTS().getParameter("Master_transformID"))) -// , osPtr (dynamic_cast (p.getAPVTS().getParameter("Master_osID"))) -, outputPtr (dynamic_cast (p.getAPVTS().getParameter("Master_outputID"))) -, mixPtr (dynamic_cast (p.getAPVTS().getParameter("Master_mixID"))) +, osPtr (dynamic_cast (p.getAPVTS().getParameter("Master_osID"))) +, outputPtr (dynamic_cast (p.getAPVTS().getParameter("Master_outputID"))) +, mixPtr (dynamic_cast (p.getAPVTS().getParameter("Master_mixID"))) { - jassert(frequencyPtr != nullptr); - jassert(resonancePtr != nullptr); - jassert(gainPtr != nullptr); - jassert(typePtr != nullptr); - jassert(transformPtr != nullptr); - // jassert(osPtr != nullptr); - jassert(outputPtr != nullptr); - jassert(mixPtr != nullptr); + jassert(frequencyPtr != nullptr); + jassert(resonancePtr != nullptr); + jassert(gainPtr != nullptr); + jassert(typePtr != nullptr); + jassert(transformPtr != nullptr); + jassert(osPtr != nullptr); + jassert(outputPtr != nullptr); + jassert(mixPtr != nullptr); // auto osFilter = juce::dsp::Oversampling::filterHalfBandFIREquiripple; @@ -83,68 +62,7 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A // oversampler[i] = std::make_unique> // (audioProcessor.getTotalNumInputChannels(), i, osFilter, true, false); - reset(zero); -} - -template -void AudioPluginAudioProcessorWrapper::setFrequency (SampleType newFreq) -{ - jassert(minFreq <= newFreq && newFreq <= maxFreq); - - // if (hz != newFreq) - // { - hz = juce::jlimit(minFreq, maxFreq, newFreq); - - omega = (hz * ((pi * two) / static_cast (sampleRate))); - cos = (std::cos(omega)); - sin = (std::sin(omega)); - - calculateCoefficients(); - // } -} - -template -void AudioPluginAudioProcessorWrapper::setResonance(SampleType newRes) -{ - jassert(zero <= newRes && newRes <= one); - - // if (q != newRes) - // { - q = juce::jlimit(zero, one, newRes); - calculateCoefficients(); - // } -} - -template -void AudioPluginAudioProcessorWrapper::setGain(SampleType newGain) -{ - // if (g != newGain) - // { - g = newGain; - calculateCoefficients(); - // } -} - -template -void AudioPluginAudioProcessorWrapper::setFilterType(filterType newFiltType) -{ - if (filterTypeParamValue != newFiltType) - { - filterTypeParamValue = newFiltType; - - reset(zero); - calculateCoefficients(); - } -} - -template -void AudioPluginAudioProcessorWrapper::setTransformType(transformationType newTransformType) -{ - if (transformationParamValue != newTransformType) - { - transformationParamValue = newTransformType; - reset(zero); - } + reset(static_cast(0.0)); } template @@ -164,29 +82,10 @@ void AudioPluginAudioProcessorWrapper::prepare(juce::dsp::ProcessSpe // for (int i = 0; i < 5; ++i) // oversampler[i]->numChannels = (size_t)spec.numChannels; - Wn_1.resize(spec.numChannels); - Wn_2.resize(spec.numChannels); - Xn_1.resize(spec.numChannels); - Xn_2.resize(spec.numChannels); - Yn_1.resize(spec.numChannels); - Yn_2.resize(spec.numChannels); - - minFreq = static_cast (sampleRate / 24576.0); - maxFreq = static_cast (sampleRate / 2.125); - - jassert(static_cast (20.0) >= minFreq && minFreq <= static_cast (20000.0)); - jassert(static_cast (20.0) <= maxFreq && maxFreq >= static_cast (20000.0)); - - - reset(zero); + reset(static_cast(0.0)); mixer.prepare(spec); - // biquad.prepare(spec); - setFrequency(hz); - setResonance(q); - setGain(g); - setFilterType(filterTypeParamValue); - setTransformType(transformationParamValue); + biquads.prepare(spec); update(); } @@ -195,12 +94,7 @@ template void AudioPluginAudioProcessorWrapper::reset() { mixer.reset(); - // biquad.reset(); - - SampleType initialValue = zero; - - for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) - std::fill(v->begin(), v->end(), initialValue); + biquads.reset(static_cast(0.0)); // for (int i = 0; i < 5; ++i) // oversampler[i]->reset(); @@ -210,9 +104,7 @@ template void AudioPluginAudioProcessorWrapper::reset(SampleType initialValue) { mixer.reset(); - - for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) - std::fill(v->begin(), v->end(), initialValue); + biquads.reset(initialValue); // for (int i = 0; i < 5; ++i) // oversampler[i]->reset(); @@ -302,11 +194,13 @@ void AudioPluginAudioProcessorWrapper::processBypass(juce::AudioBuff auto& outputBlock = context.getOutputBlock(); const auto numChannels = outputBlock.getNumChannels(); const auto numSamples = outputBlock.getNumSamples(); - //const auto len = inputBlock.getNumSamples(); jassert(inputBlock.getNumChannels() == numChannels); jassert(inputBlock.getNumSamples() == numSamples); + juce::ignoreUnused(numChannels); + juce::ignoreUnused(numSamples); + outputBlock.copyFrom(inputBlock); return; } @@ -314,338 +208,24 @@ void AudioPluginAudioProcessorWrapper::processBypass(juce::AudioBuff template SampleType AudioPluginAudioProcessorWrapper::processSample(int channel, SampleType inputValue) { - // return biquad.processSample(channel, inputValue); - - jassert(juce::isPositiveAndBelow(channel, Wn_1.size())); - jassert(juce::isPositiveAndBelow(channel, Wn_2.size())); - jassert(juce::isPositiveAndBelow(channel, Xn_1.size())); - jassert(juce::isPositiveAndBelow(channel, Xn_2.size())); - jassert(juce::isPositiveAndBelow(channel, Yn_1.size())); - jassert(juce::isPositiveAndBelow(channel, Yn_1.size())); - - switch (transformationParamValue) - { - case StoneyDSP::Audio::TransformationType::directFormI: - inputValue = directFormI(channel, inputValue); - break; - case StoneyDSP::Audio::TransformationType::directFormII: - inputValue = directFormII(channel, inputValue); - break; - case StoneyDSP::Audio::TransformationType::directFormItransposed: - inputValue = directFormITransposed(channel, inputValue); - break; - case StoneyDSP::Audio::TransformationType::directFormIItransposed: - inputValue = directFormIITransposed(channel, inputValue); - break; - default: - inputValue = directFormIITransposed(channel, inputValue); - } - - return inputValue; -} - -template -SampleType AudioPluginAudioProcessorWrapper::directFormI(int channel, SampleType inputSample) -{ - auto& Xn1 = Xn_1[(size_t)channel]; - auto& Xn2 = Xn_2[(size_t)channel]; - auto& Yn1 = Yn_1[(size_t)channel]; - auto& Yn2 = Yn_2[(size_t)channel]; - - auto& Xn = inputSample; - auto& Yn = outputSample; - - Yn = ((Xn * b0) + (Xn1 * b1) + (Xn2 * b2) + (Yn1 * a1) + (Yn2 * a2)); - - Xn2 = Xn1, Yn2 = Yn1; - Xn1 = Xn, Yn1 = Yn; - - return Yn; -} - -template -SampleType AudioPluginAudioProcessorWrapper::directFormII(int channel, SampleType inputSample) -{ - auto& Wn1 = Wn_1[(size_t)channel]; - auto& Wn2 = Wn_2[(size_t)channel]; - - auto& Wn = loop; - auto& Xn = inputSample; - auto& Yn = outputSample; - - Wn = ( Xn + ((Wn1 * a1) + (Wn2 * a2))); - Yn = ((Wn * b0) + (Wn1 * b1) + (Wn2 * b2)); - - Wn2 = Wn1; - Wn1 = Wn; - - return Yn; -} - -template -SampleType AudioPluginAudioProcessorWrapper::directFormITransposed(int channel, SampleType inputSample) -{ - auto& Wn1 = Wn_1[(size_t)channel]; - auto& Wn2 = Wn_2[(size_t)channel]; - auto& Xn1 = Xn_1[(size_t)channel]; - auto& Xn2 = Xn_2[(size_t)channel]; - - auto& Wn = loop; - auto& Xn = inputSample; - auto& Yn = outputSample; - - Wn = ( Xn + Wn2); - Yn = ((Wn * b0) + Xn2); - - Xn2 = ((Wn * b1) + Xn1), Wn2 = ((Wn * a1) + Wn1); - Xn1 = ( Wn * b2), Wn1 = ( Wn * a2); - - return Yn; -} - -template -SampleType AudioPluginAudioProcessorWrapper::directFormIITransposed(int channel, SampleType inputSample) -{ - auto& Xn1 = Xn_1[(size_t)channel]; - auto& Xn2 = Xn_2[(size_t)channel]; - - auto& Xn = inputSample; - auto& Yn = outputSample; - - Yn = ((Xn * b0) + (Xn2)); - - Xn2 = ((Xn * b1) + (Xn1) + (Yn * a1)); - Xn1 = ((Xn * b2) + (Yn * a2)); - - return Yn; -} - -template -void AudioPluginAudioProcessorWrapper::calculateCoefficients() -{ - alpha = (sin * (one - q)); - a = (std::pow(SampleType(10), (g * SampleType(0.05)))); - sqrtA = ((std::sqrt(a) * two) * alpha); - - switch (filterTypeParamValue) - { - case filterType::lowPass2: - - b_0 = ((one - cos) / two); - b_1 = (one - cos); - b_2 = ((one - cos) / two); - a_0 = (one + alpha); - a_1 = (minusTwo * cos); - a_2 = (one - alpha); - - break; - - - case filterType::lowPass1: - - b_0 = (omega / (one + omega)); - b_1 = (omega / (one + omega)); - b_2 = (zero); - a_0 = (one); - a_1 = (minusOne * ((one - omega) / (one + omega))); - a_2 = (zero); - - break; - - - case filterType::highPass2: - - b_0 = (one + cos) / two; - b_1 = (minusOne * (one + cos)); - b_2 = ((one + cos) / two); - a_0 = (one + alpha); - a_1 = (minusTwo * cos); - a_2 = (one - alpha); - - break; - - - case filterType::highPass1: - - b_0 = (one / (one + omega)); - b_1 = ((one / (one + omega)) * minusOne); - b_2 = (zero); - a_0 = (one); - a_1 = (((one - omega) / (one + omega)) * minusOne); - a_2 = (zero); - - break; - - - case filterType::bandPass: - - b_0 = (sin / two); - b_1 = (zero); - b_2 = (minusOne * (sin / two)); - a_0 = (one + alpha); - a_1 = (minusTwo * cos); - a_2 = (one - alpha); - - break; - - - case filterType::bandPassQ: - - b_0 = (alpha); - b_1 = (zero); - b_2 = (minusOne * alpha); - a_0 = (one + alpha); - a_1 = (minusTwo * cos); - a_2 = (one - alpha); - - break; - - - case filterType::lowShelf2: - - b_0 = ((((a + one) - ((a - one) * cos)) + sqrtA) * a); - b_1 = ((((a - one) - ((a + one) * cos)) * two) * a); - b_2 = ((((a + one) - ((a - one) * cos)) - sqrtA) * a); - a_0 = (((a + one) + ((a - one) * cos)) + sqrtA); - a_1 = (((a - one) + ((a + one) * cos)) * minusTwo); - a_2 = (((a + one) + ((a - one) * cos)) - sqrtA); - - break; - - - case filterType::lowShelf1: - - b_0 = (one + ((omega / (one + omega)) * (minusOne + (a * a)))); - b_1 = ((((omega / (one + omega)) * (minusOne + (a * a))) - ((one - omega) / (one + omega)))); - b_2 = (zero); - a_0 = (one); - a_1 = (minusOne * ((one - omega) / (one + omega))); - a_2 = (zero); - - break; - - - case filterType::lowShelf1C: - - b_0 = (one + ((omega / a) / (one + (omega / a)) * (minusOne + (a * a)))); - b_1 = (((((omega / a) / (one + (omega / a))) * (minusOne + (a * a))) - ((one - (omega / a)) / (one + (omega / a))))); - b_2 = (zero); - a_0 = (one); - a_1 = (minusOne * ((one - (omega / a)) / (one + (omega / a)))); - a_2 = (zero); - - break; - - - case filterType::highShelf2: - - b_0 = ((((a + one) + ((a - one) * cos)) + sqrtA) * a); - b_1 = ((((a - one) + ((a + one) * cos)) * minusTwo) * a); - b_2 = ((((a + one) + ((a - one) * cos)) - sqrtA) * a); - a_0 = (((a + one) - ((a - one) * cos)) + sqrtA); - a_1 = (((a - one) - ((a + one) * cos)) * two); - a_2 = (((a + one) - ((a - one) * cos)) - sqrtA); - - break; - - - case filterType::highShelf1: - - b_0 = (one + ((minusOne + (a * a)) / (one + omega))); - b_1 = (minusOne * (((one - omega) / (one + omega)) + ((minusOne + (a * a)) / (one + omega)))); - b_2 = (zero); - a_0 = (one); - a_1 = (minusOne * ((one - omega) / (one + omega))); - a_2 = (zero); - - break; - - - case filterType::highShelf1C: - - b_0 = (one + ((minusOne + (a * a)) / (one + (omega * a)))); - b_1 = (minusOne * (((one - (omega * a)) / (one + (omega * a))) + ((minusOne + (a * a)) / (one + (omega * a))))); - b_2 = (zero); - a_0 = (one); - a_1 = (minusOne * ((one - (omega * a)) / (one + (omega * a)))); - a_2 = (zero); - - break; - - - case filterType::peak: - - b_0 = (one + (alpha * a)); - b_1 = (minusTwo * cos); - b_2 = (one - (alpha * a)); - a_0 = (one + (alpha / a)); - a_1 = (minusTwo * cos); - a_2 = (one - (alpha / a)); - - break; - - - case filterType::notch: - - b_0 = (one); - b_1 = (minusTwo * cos); - b_2 = (one); - a_0 = (one + alpha); - a_1 = (minusTwo * cos); - a_2 = (one - alpha); - - break; - - - case filterType::allPass: - - b_0 = (one - alpha); - b_1 = (minusTwo * cos); - b_2 = (one + alpha); - a_0 = (one + alpha); - a_1 = (minusTwo * cos); - a_2 = (one - alpha); - - break; - - - default: - - b_0 = one; - b_1 = zero; - b_2 = zero; - a_0 = one; - a_1 = zero; - a_2 = zero; - - break; - } - - a0 = ( one / a_0); - a1 = ((-a_1) * a0); - a2 = ((-a_2) * a0); - b0 = ( b_0 * a0); - b1 = ( b_1 * a0); - b2 = ( b_2 * a0); + return biquads.processSample(channel, inputValue); } template void AudioPluginAudioProcessorWrapper::snapToZero() noexcept { - for (auto v : { &Wn_1, &Wn_2, &Xn_1, &Xn_2, &Yn_1, &Yn_2 }) - for (auto& element : *v) - juce::dsp::util::snapToZero(element); + biquads.snapToZero(); } template void AudioPluginAudioProcessorWrapper::update() { - mixer.setWetMixProportion(static_cast (mixPtr->get() * 0.01)); - setFrequency (static_cast (frequencyPtr->get())); - setResonance (static_cast (resonancePtr->get())); - setGain (static_cast (gainPtr->get())); - setFilterType (static_cast (typePtr->getIndex())); - setTransformType (static_cast (transformPtr->getIndex())); + mixer.setWetMixProportion(static_cast (mixPtr->get() * 0.01)); + biquads.setFrequency (static_cast (frequencyPtr->get())); + biquads.setResonance (static_cast (resonancePtr->get())); + biquads.setGain (static_cast (gainPtr->get())); + biquads.setFilterType (static_cast (typePtr->getIndex())); + biquads.setTransformType (static_cast (transformPtr->getIndex())); } // template @@ -658,7 +238,6 @@ void AudioPluginAudioProcessorWrapper::update() // prevOS = curOS; // mixer.reset(); // // biquad.reset(); -// // output.reset(); // } // } diff --git a/vcpkg.json b/vcpkg.json index 5655a71..25731e1 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "stoneydsp-biquads", - "version": "1.2.1.148", + "version": "1.2.2.151", "homepage": "https://github.com/Stoneydsp/Biquads", "maintainers": [ "Nathan J. Hood " From 6128d92e74f8dea300838fae5d9a8c73160ebd7f Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sat, 16 Mar 2024 06:53:17 +0100 Subject: [PATCH 03/21] Added additional bands - now a 4-band EQ which highlights more optimization requirements --- .gitignore | 1 + VERSION | 2 +- include/StoneyDSP/Biquads.hpp | 3 +- include/StoneyDSP/Biquads/Parameters.hpp | 2 - include/StoneyDSP/Biquads/Processor.hpp | 42 +++-- include/StoneyDSP/Biquads/Wrapper.hpp | 47 ++++-- src/StoneyDSP/Biquads/Parameters.cpp | 72 +++++---- src/StoneyDSP/Biquads/Processor.cpp | 125 +++++++++++---- src/StoneyDSP/Biquads/Wrapper.cpp | 186 +++++++++++++++++++---- 9 files changed, 362 insertions(+), 118 deletions(-) diff --git a/.gitignore b/.gitignore index f02bd94..d96d5c3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ node_modules !/.vscode/c_cpp_properties.json !**/develop-logo-pluginval.png install +Biquads-v1.2.1 # Windows Temp Cache Files [Tt]humbs.db diff --git a/VERSION b/VERSION index 41e46dd..e6210fb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2.151 +1.2.2.152 diff --git a/include/StoneyDSP/Biquads.hpp b/include/StoneyDSP/Biquads.hpp index 3d03ea6..cab8678 100644 --- a/include/StoneyDSP/Biquads.hpp +++ b/include/StoneyDSP/Biquads.hpp @@ -62,7 +62,6 @@ namespace Biquads * @{ */ - namespace ProjectInfo { extern const char* const projectName; @@ -71,6 +70,8 @@ namespace ProjectInfo extern const int versionNumber; } +class AudioPluginAudioProcessor; + /// @} group Biquads } // namespace Biquads diff --git a/include/StoneyDSP/Biquads/Parameters.hpp b/include/StoneyDSP/Biquads/Parameters.hpp index 6b6c5c4..1233a10 100644 --- a/include/StoneyDSP/Biquads/Parameters.hpp +++ b/include/StoneyDSP/Biquads/Parameters.hpp @@ -33,8 +33,6 @@ namespace StoneyDSP { namespace Biquads { /** @addtogroup Biquads @{ */ -class AudioPluginAudioProcessor; - class AudioPluginAudioProcessorParameters { public: diff --git a/include/StoneyDSP/Biquads/Processor.hpp b/include/StoneyDSP/Biquads/Processor.hpp index 0f3e595..59db399 100644 --- a/include/StoneyDSP/Biquads/Processor.hpp +++ b/include/StoneyDSP/Biquads/Processor.hpp @@ -100,17 +100,37 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor //========================================================================== /** Parameter pointers. */ - juce::AudioParameterFloat* frequencyPtr { nullptr }; - juce::AudioParameterFloat* resonancePtr { nullptr }; - juce::AudioParameterFloat* gainPtr { nullptr }; - juce::AudioParameterChoice* typePtr { nullptr }; - juce::AudioParameterChoice* transformPtr { nullptr }; - juce::AudioParameterChoice* osPtr { nullptr }; - juce::AudioParameterFloat* outputPtr { nullptr }; - juce::AudioParameterFloat* mixPtr { nullptr }; - juce::AudioParameterBool* bypassPtr { nullptr }; - - juce::AudioParameterBool* bypassState { nullptr }; + juce::AudioParameterBool* masterBypassPtr { nullptr }; + juce::AudioParameterFloat* masterOutputPtr { nullptr }; + juce::AudioParameterFloat* masterMixPtr { nullptr }; + juce::AudioParameterChoice* masterOsPtr { nullptr }; + juce::AudioParameterChoice* masterTransformPtr { nullptr }; + + juce::AudioParameterBool* biquadsABypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsAFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsAResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsAGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsATypePtr { nullptr }; + + juce::AudioParameterBool* biquadsBBypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsBFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsBResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsBGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsBTypePtr { nullptr }; + + juce::AudioParameterBool* biquadsCBypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsCFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsCResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsCGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsCTypePtr { nullptr }; + + juce::AudioParameterBool* biquadsDBypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsDFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsDResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsDGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsDTypePtr { nullptr }; + + juce::AudioParameterBool* bypassState { nullptr }; //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (AudioPluginAudioProcessor) diff --git a/include/StoneyDSP/Biquads/Wrapper.hpp b/include/StoneyDSP/Biquads/Wrapper.hpp index 061c595..e323d3c 100644 --- a/include/StoneyDSP/Biquads/Wrapper.hpp +++ b/include/StoneyDSP/Biquads/Wrapper.hpp @@ -31,8 +31,6 @@ namespace StoneyDSP { namespace Biquads { /** @addtogroup Biquads @{ */ -class AudioPluginAudioProcessor; - template class AudioPluginAudioProcessorWrapper { @@ -127,20 +125,41 @@ class AudioPluginAudioProcessorWrapper //============================================================================== // std::unique_ptr> oversampler[5]; juce::dsp::DryWetMixer mixer; - StoneyDSP::Audio::Biquads biquads; + StoneyDSP::Audio::Biquads biquadsA, biquadsB, biquadsC, biquadsD; - //============================================================================== + //========================================================================== /** Parameter pointers. */ - juce::AudioParameterFloat* frequencyPtr; - juce::AudioParameterFloat* resonancePtr; - juce::AudioParameterFloat* gainPtr; - juce::AudioParameterChoice* typePtr; - juce::AudioParameterChoice* transformPtr; - juce::AudioParameterChoice* osPtr; - juce::AudioParameterFloat* outputPtr; - juce::AudioParameterFloat* mixPtr; - - bool bypassParamValue { false }; + juce::AudioParameterBool* masterBypassPtr { nullptr }; + juce::AudioParameterFloat* masterOutputPtr { nullptr }; + juce::AudioParameterFloat* masterMixPtr { nullptr }; + juce::AudioParameterChoice* masterOsPtr { nullptr }; + juce::AudioParameterChoice* masterTransformPtr { nullptr }; + + juce::AudioParameterBool* biquadsABypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsAFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsAResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsAGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsATypePtr { nullptr }; + + juce::AudioParameterBool* biquadsBBypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsBFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsBResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsBGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsBTypePtr { nullptr }; + + juce::AudioParameterBool* biquadsCBypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsCFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsCResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsCGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsCTypePtr { nullptr }; + + juce::AudioParameterBool* biquadsDBypassPtr { nullptr }; + juce::AudioParameterFloat* biquadsDFrequencyPtr { nullptr }; + juce::AudioParameterFloat* biquadsDResonancePtr { nullptr }; + juce::AudioParameterFloat* biquadsDGainPtr { nullptr }; + juce::AudioParameterChoice* biquadsDTypePtr { nullptr }; + + juce::AudioParameterBool* bypassState { nullptr }; //============================================================================== /** Initialised constant */ diff --git a/src/StoneyDSP/Biquads/Parameters.cpp b/src/StoneyDSP/Biquads/Parameters.cpp index d3748f9..35d55cf 100644 --- a/src/StoneyDSP/Biquads/Parameters.cpp +++ b/src/StoneyDSP/Biquads/Parameters.cpp @@ -50,7 +50,7 @@ void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcesso const auto fString = juce::StringArray({ "LP2", "LP1", "HP2", "HP1" , "BP2", "BP2c", "LS2", "LS1c", "LS1", "HS2", "HS1c", "HS1", "PK2", "NX2", "AP2" }); const auto tString = juce::StringArray({ "DFI", "DFII", "DFI t", "DFII t" }); - // const auto osString = juce::StringArray({ "--", "2x", "4x", "8x", "16x" }); + const auto osString = juce::StringArray({ "--", "2x", "4x", "8x", "16x" }); const auto decibels = juce::String{ ("dB") }; const auto frequency = juce::String{ ("Hz") }; @@ -87,21 +87,22 @@ void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcesso params.add( //====================================================================== - std::make_unique("Master_ID", "0", "seperatorA", + std::make_unique("Master_ID", "0", "seperatorMaster", //================================================================== std::make_unique (juce::ParameterID{ "Master_bypassID", ProjectInfo::versionNumber}, "Bypass", false) , std::make_unique (juce::ParameterID{ "Master_outputID", ProjectInfo::versionNumber}, "Output", outputRange, 00.00f, outputAttributes) , std::make_unique (juce::ParameterID{ "Master_mixID", ProjectInfo::versionNumber}, "Mix", mixRange, 100.00f, mixAttributes) - // , std::make_unique(juce::ParameterID{ "Master_osID", ProjectInfo::versionNumber}, "Oversampling", osString, 0) + , std::make_unique(juce::ParameterID{ "Master_osID", ProjectInfo::versionNumber}, "Oversampling", osString, 0) , std::make_unique(juce::ParameterID{ "Master_transformID", ProjectInfo::versionNumber}, "Transform", tString, 3) ) ); params.add( //====================================================================== - std::make_unique("Band_A_ID", "1", "seperatorB", + std::make_unique("Band_A_ID", "1", "seperatorA", //================================================================== - std::make_unique (juce::ParameterID{ "Band_A_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + std::make_unique (juce::ParameterID{ "Band_A_bypassID", ProjectInfo::versionNumber}, "Bypass", false) + , std::make_unique (juce::ParameterID{ "Band_A_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) , std::make_unique (juce::ParameterID{ "Band_A_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) , std::make_unique (juce::ParameterID{ "Band_A_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) , std::make_unique(juce::ParameterID{ "Band_A_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) @@ -109,29 +110,44 @@ void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcesso ) ); - // params.add( - // //====================================================================== - // std::make_unique("Band_B_ID", "2", "seperatorC", - // //================================================================== - // std::make_unique (juce::ParameterID{ "Band_B_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) - // , std::make_unique (juce::ParameterID{ "Band_B_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) - // , std::make_unique (juce::ParameterID{ "Band_B_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) - // , std::make_unique(juce::ParameterID{ "Band_B_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) - // //================================================================== - // ) - // ); - - // params.add( - // //====================================================================== - // std::make_unique("Band_C_ID", "3", "seperatorD", - // //================================================================== - // std::make_unique (juce::ParameterID{ "Band_C_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) - // , std::make_unique (juce::ParameterID{ "Band_C_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) - // , std::make_unique (juce::ParameterID{ "Band_C_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) - // , std::make_unique(juce::ParameterID{ "Band_C_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) - // //================================================================== - // ) - // ); + params.add( + //====================================================================== + std::make_unique("Band_B_ID", "2", "seperatorB", + //================================================================== + std::make_unique (juce::ParameterID{ "Band_B_bypassID", ProjectInfo::versionNumber}, "Bypass", true) + , std::make_unique (juce::ParameterID{ "Band_B_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_B_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_B_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_B_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) + //================================================================== + ) + ); + + params.add( + //====================================================================== + std::make_unique("Band_C_ID", "3", "seperatorC", + //================================================================== + std::make_unique (juce::ParameterID{ "Band_C_bypassID", ProjectInfo::versionNumber}, "Bypass", true) + , std::make_unique (juce::ParameterID{ "Band_C_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_C_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_C_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_C_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) + //================================================================== + ) + ); + + params.add( + //====================================================================== + std::make_unique("Band_D_ID", "4", "seperatorD", + //================================================================== + std::make_unique (juce::ParameterID{ "Band_D_bypassID", ProjectInfo::versionNumber}, "Bypass", true) + , std::make_unique (juce::ParameterID{ "Band_D_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_D_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_D_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_D_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) + //================================================================== + ) + ); } /// @} group Biquads diff --git a/src/StoneyDSP/Biquads/Processor.cpp b/src/StoneyDSP/Biquads/Processor.cpp index 9eba3c9..c9f9dc4 100644 --- a/src/StoneyDSP/Biquads/Processor.cpp +++ b/src/StoneyDSP/Biquads/Processor.cpp @@ -46,38 +46,103 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() , parameters(*this, getAPVTS()) , processorFlt(*this, getAPVTS(), getSpec()) , processorDbl(*this, getAPVTS(), getSpec()) -, frequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) -, resonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) -, gainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) -, typePtr(dynamic_cast (apvts.getParameter("Band_A_typeID"))) -, transformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) -, osPtr (dynamic_cast (apvts.getParameter("Master_osID"))) -, outputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) -, mixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) -, bypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) -, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) + +, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) +, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) +, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) +, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) +, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) + +, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) +, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) +, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) +, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) +, biquadsATypePtr(dynamic_cast (apvts.getParameter("Band_A_typeID"))) + +, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) +, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) +, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) +, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) +, biquadsBTypePtr(dynamic_cast (apvts.getParameter("Band_B_typeID"))) + +, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) +, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) +, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) +, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) +, biquadsCTypePtr(dynamic_cast (apvts.getParameter("Band_C_typeID"))) + +, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) +, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) +, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) +, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) +, biquadsDTypePtr(dynamic_cast (apvts.getParameter("Band_D_typeID"))) + +, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) // , processingPrecision(singlePrecision) { - frequencyPtr = dynamic_cast (apvts.getParameter("Band_A_frequencyID")); - resonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); - gainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); - typePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); - osPtr = dynamic_cast (apvts.getParameter("Master_osID")); - outputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); - mixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); - bypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); - - jassert(frequencyPtr != nullptr); - jassert(resonancePtr != nullptr); - jassert(gainPtr != nullptr); - jassert(typePtr != nullptr); - jassert(transformPtr != nullptr); - jassert(osPtr != nullptr); - jassert(outputPtr != nullptr); - jassert(mixPtr != nullptr); - jassert(bypassPtr != nullptr); - - jassert(bypassState != nullptr); + masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); + masterOutputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); + masterMixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); + masterOsPtr = dynamic_cast (apvts.getParameter("Master_osID")); + masterTransformPtr = dynamic_cast (apvts.getParameter("Master_transformID")); + + biquadsABypassPtr = dynamic_cast (apvts.getParameter("Band_A_bypassID")); + biquadsAFrequencyPtr = dynamic_cast (apvts.getParameter("Band_A_frequencyID")); + biquadsAResonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); + biquadsAGainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); + biquadsATypePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); + + biquadsBBypassPtr = dynamic_cast (apvts.getParameter("Band_B_bypassID")); + biquadsBFrequencyPtr = dynamic_cast (apvts.getParameter("Band_B_frequencyID")); + biquadsBResonancePtr = dynamic_cast (apvts.getParameter("Band_B_resonanceID")); + biquadsBGainPtr = dynamic_cast (apvts.getParameter("Band_B_gainID")); + biquadsBTypePtr = dynamic_cast (apvts.getParameter("Band_B_typeID")); + + biquadsCBypassPtr = dynamic_cast (apvts.getParameter("Band_C_bypassID")); + biquadsCFrequencyPtr = dynamic_cast (apvts.getParameter("Band_C_frequencyID")); + biquadsCResonancePtr = dynamic_cast (apvts.getParameter("Band_C_resonanceID")); + biquadsCGainPtr = dynamic_cast (apvts.getParameter("Band_C_gainID")); + biquadsCTypePtr = dynamic_cast (apvts.getParameter("Band_C_typeID")); + + biquadsDBypassPtr = dynamic_cast (apvts.getParameter("Band_D_bypassID")); + biquadsDFrequencyPtr = dynamic_cast (apvts.getParameter("Band_D_frequencyID")); + biquadsDResonancePtr = dynamic_cast (apvts.getParameter("Band_D_resonanceID")); + biquadsDGainPtr = dynamic_cast (apvts.getParameter("Band_D_gainID")); + biquadsDTypePtr = dynamic_cast (apvts.getParameter("Band_D_typeID")); + + bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); + + jassert(masterBypassPtr != nullptr); + jassert(masterOutputPtr != nullptr); + jassert(masterMixPtr != nullptr); + jassert(masterOsPtr != nullptr); + jassert(masterTransformPtr != nullptr); + + jassert(biquadsABypassPtr != nullptr); + jassert(biquadsAFrequencyPtr != nullptr); + jassert(biquadsAResonancePtr != nullptr); + jassert(biquadsAGainPtr != nullptr); + jassert(biquadsATypePtr != nullptr); + + jassert(biquadsBBypassPtr != nullptr); + jassert(biquadsBFrequencyPtr != nullptr); + jassert(biquadsBResonancePtr != nullptr); + jassert(biquadsBGainPtr != nullptr); + jassert(biquadsBTypePtr != nullptr); + + jassert(biquadsCBypassPtr != nullptr); + jassert(biquadsCFrequencyPtr != nullptr); + jassert(biquadsCResonancePtr != nullptr); + jassert(biquadsCGainPtr != nullptr); + jassert(biquadsCTypePtr != nullptr); + + jassert(biquadsDBypassPtr != nullptr); + jassert(biquadsDFrequencyPtr != nullptr); + jassert(biquadsDResonancePtr != nullptr); + jassert(biquadsDGainPtr != nullptr); + jassert(biquadsDTypePtr != nullptr); + + jassert(bypassState != nullptr); } AudioPluginAudioProcessor::~AudioPluginAudioProcessor() diff --git a/src/StoneyDSP/Biquads/Wrapper.cpp b/src/StoneyDSP/Biquads/Wrapper.cpp index da74fcc..852c2f8 100644 --- a/src/StoneyDSP/Biquads/Wrapper.cpp +++ b/src/StoneyDSP/Biquads/Wrapper.cpp @@ -35,26 +35,109 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A : audioProcessor (p) , state(apvts) , setup(spec) + +, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) +, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) +, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) +, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) +, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) + +, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) +, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) +, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) +, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) +, biquadsATypePtr(dynamic_cast (apvts.getParameter("Band_A_typeID"))) + +, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) +, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) +, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) +, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) +, biquadsBTypePtr(dynamic_cast (apvts.getParameter("Band_B_typeID"))) + +, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) +, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) +, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) +, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) +, biquadsCTypePtr(dynamic_cast (apvts.getParameter("Band_C_typeID"))) + +, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) +, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) +, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) +, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) +, biquadsDTypePtr(dynamic_cast (apvts.getParameter("Band_D_typeID"))) + +, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) + , mixer() -, biquads() -, frequencyPtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_frequencyID"))) -, resonancePtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_resonanceID"))) -, gainPtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_gainID"))) -, typePtr (dynamic_cast (p.getAPVTS().getParameter("Band_A_typeID"))) -, transformPtr (dynamic_cast (p.getAPVTS().getParameter("Master_transformID"))) -, osPtr (dynamic_cast (p.getAPVTS().getParameter("Master_osID"))) -, outputPtr (dynamic_cast (p.getAPVTS().getParameter("Master_outputID"))) -, mixPtr (dynamic_cast (p.getAPVTS().getParameter("Master_mixID"))) +, biquadsA() +, biquadsB() +, biquadsC() +, biquadsD() { - jassert(frequencyPtr != nullptr); - jassert(resonancePtr != nullptr); - jassert(gainPtr != nullptr); - jassert(typePtr != nullptr); - jassert(transformPtr != nullptr); - jassert(osPtr != nullptr); - jassert(outputPtr != nullptr); - jassert(mixPtr != nullptr); + masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); + masterOutputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); + masterMixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); + masterOsPtr = dynamic_cast (apvts.getParameter("Master_osID")); + masterTransformPtr = dynamic_cast (apvts.getParameter("Master_transformID")); + + biquadsABypassPtr = dynamic_cast (apvts.getParameter("Band_A_bypassID")); + biquadsAFrequencyPtr = dynamic_cast (apvts.getParameter("Band_A_frequencyID")); + biquadsAResonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); + biquadsAGainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); + biquadsATypePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); + + biquadsBBypassPtr = dynamic_cast (apvts.getParameter("Band_B_bypassID")); + biquadsBFrequencyPtr = dynamic_cast (apvts.getParameter("Band_B_frequencyID")); + biquadsBResonancePtr = dynamic_cast (apvts.getParameter("Band_B_resonanceID")); + biquadsBGainPtr = dynamic_cast (apvts.getParameter("Band_B_gainID")); + biquadsBTypePtr = dynamic_cast (apvts.getParameter("Band_B_typeID")); + + biquadsCBypassPtr = dynamic_cast (apvts.getParameter("Band_C_bypassID")); + biquadsCFrequencyPtr = dynamic_cast (apvts.getParameter("Band_C_frequencyID")); + biquadsCResonancePtr = dynamic_cast (apvts.getParameter("Band_C_resonanceID")); + biquadsCGainPtr = dynamic_cast (apvts.getParameter("Band_C_gainID")); + biquadsCTypePtr = dynamic_cast (apvts.getParameter("Band_C_typeID")); + + biquadsDBypassPtr = dynamic_cast (apvts.getParameter("Band_D_bypassID")); + biquadsDFrequencyPtr = dynamic_cast (apvts.getParameter("Band_D_frequencyID")); + biquadsDResonancePtr = dynamic_cast (apvts.getParameter("Band_D_resonanceID")); + biquadsDGainPtr = dynamic_cast (apvts.getParameter("Band_D_gainID")); + biquadsDTypePtr = dynamic_cast (apvts.getParameter("Band_D_typeID")); + + bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); + + jassert(masterBypassPtr != nullptr); + jassert(masterOutputPtr != nullptr); + jassert(masterMixPtr != nullptr); + jassert(masterOsPtr != nullptr); + jassert(masterTransformPtr != nullptr); + + jassert(biquadsABypassPtr != nullptr); + jassert(biquadsAFrequencyPtr != nullptr); + jassert(biquadsAResonancePtr != nullptr); + jassert(biquadsAGainPtr != nullptr); + jassert(biquadsATypePtr != nullptr); + + jassert(biquadsBBypassPtr != nullptr); + jassert(biquadsBFrequencyPtr != nullptr); + jassert(biquadsBResonancePtr != nullptr); + jassert(biquadsBGainPtr != nullptr); + jassert(biquadsBTypePtr != nullptr); + + jassert(biquadsCBypassPtr != nullptr); + jassert(biquadsCFrequencyPtr != nullptr); + jassert(biquadsCResonancePtr != nullptr); + jassert(biquadsCGainPtr != nullptr); + jassert(biquadsCTypePtr != nullptr); + + jassert(biquadsDBypassPtr != nullptr); + jassert(biquadsDFrequencyPtr != nullptr); + jassert(biquadsDResonancePtr != nullptr); + jassert(biquadsDGainPtr != nullptr); + jassert(biquadsDTypePtr != nullptr); + + jassert(bypassState != nullptr); // auto osFilter = juce::dsp::Oversampling::filterHalfBandFIREquiripple; @@ -85,7 +168,10 @@ void AudioPluginAudioProcessorWrapper::prepare(juce::dsp::ProcessSpe reset(static_cast(0.0)); mixer.prepare(spec); - biquads.prepare(spec); + biquadsA.prepare(spec); + biquadsB.prepare(spec); + biquadsC.prepare(spec); + biquadsD.prepare(spec); update(); } @@ -93,8 +179,13 @@ void AudioPluginAudioProcessorWrapper::prepare(juce::dsp::ProcessSpe template void AudioPluginAudioProcessorWrapper::reset() { + SampleType initialValue = static_cast(0.0); + mixer.reset(); - biquads.reset(static_cast(0.0)); + biquadsA.reset(initialValue); + biquadsB.reset(initialValue); + biquadsC.reset(initialValue); + biquadsD.reset(initialValue); // for (int i = 0; i < 5; ++i) // oversampler[i]->reset(); @@ -104,7 +195,10 @@ template void AudioPluginAudioProcessorWrapper::reset(SampleType initialValue) { mixer.reset(); - biquads.reset(initialValue); + biquadsA.reset(initialValue); + biquadsB.reset(initialValue); + biquadsC.reset(initialValue); + biquadsD.reset(initialValue); // for (int i = 0; i < 5; ++i) // oversampler[i]->reset(); @@ -165,13 +259,17 @@ void AudioPluginAudioProcessorWrapper::processBlock(juce::AudioBuffe // its results to the block returned by getOutputBlock(). auto context = juce::dsp::ProcessContextReplacing (wetBlock); - // biquad.process(context); - processContext(context); + biquadsA.process(context); + biquadsB.process(context); + biquadsC.process(context); + biquadsD.process(context); + + // processContext(context); // oversampler[curOS]->processSamplesDown(wetBlock); for (auto channel = 0; channel < audioProcessor.getTotalNumOutputChannels(); ++channel) - buffer.applyGain (channel, 0, buffer.getNumSamples(), static_cast(juce::Decibels::decibelsToGain(static_cast(outputPtr->get()), static_cast(-120.00)))); + buffer.applyGain (channel, 0, buffer.getNumSamples(), static_cast(juce::Decibels::decibelsToGain(static_cast(masterOutputPtr->get()), static_cast(-120.00)))); mixer.mixWetSamples(wetBlock); return; @@ -208,24 +306,50 @@ void AudioPluginAudioProcessorWrapper::processBypass(juce::AudioBuff template SampleType AudioPluginAudioProcessorWrapper::processSample(int channel, SampleType inputValue) { - return biquads.processSample(channel, inputValue); + // return biquads.processSample(channel, inputValue); + juce::ignoreUnused(channel); + auto sample = inputValue; + return sample; } template void AudioPluginAudioProcessorWrapper::snapToZero() noexcept { - biquads.snapToZero(); + biquadsA.snapToZero(); + biquadsB.snapToZero(); + biquadsC.snapToZero(); + biquadsD.snapToZero(); } template void AudioPluginAudioProcessorWrapper::update() { - mixer.setWetMixProportion(static_cast (mixPtr->get() * 0.01)); - biquads.setFrequency (static_cast (frequencyPtr->get())); - biquads.setResonance (static_cast (resonancePtr->get())); - biquads.setGain (static_cast (gainPtr->get())); - biquads.setFilterType (static_cast (typePtr->getIndex())); - biquads.setTransformType (static_cast (transformPtr->getIndex())); + mixer.setWetMixProportion(static_cast (masterMixPtr->get() * 0.01)); + + biquadsA.setTransformType (static_cast (masterTransformPtr->getIndex())); + biquadsB.setTransformType (static_cast (masterTransformPtr->getIndex())); + biquadsC.setTransformType (static_cast (masterTransformPtr->getIndex())); + biquadsD.setTransformType (static_cast (masterTransformPtr->getIndex())); + + biquadsA.setFrequency (static_cast (biquadsAFrequencyPtr->get())); + biquadsA.setResonance (static_cast (biquadsAResonancePtr->get())); + biquadsA.setGain (static_cast (biquadsAGainPtr->get())); + biquadsA.setFilterType (static_cast (biquadsATypePtr->getIndex())); + + biquadsB.setFrequency (static_cast (biquadsBFrequencyPtr->get())); + biquadsB.setResonance (static_cast (biquadsBResonancePtr->get())); + biquadsB.setGain (static_cast (biquadsBGainPtr->get())); + biquadsB.setFilterType (static_cast (biquadsBTypePtr->getIndex())); + + biquadsC.setFrequency (static_cast (biquadsCFrequencyPtr->get())); + biquadsC.setResonance (static_cast (biquadsCResonancePtr->get())); + biquadsC.setGain (static_cast (biquadsCGainPtr->get())); + biquadsC.setFilterType (static_cast (biquadsCTypePtr->getIndex())); + + biquadsD.setFrequency (static_cast (biquadsDFrequencyPtr->get())); + biquadsD.setResonance (static_cast (biquadsDResonancePtr->get())); + biquadsD.setGain (static_cast (biquadsDGainPtr->get())); + biquadsD.setFilterType (static_cast (biquadsDTypePtr->getIndex())); } // template From 047a37d13dc04ec2da38e031b7df6789a0328e25 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sat, 16 Mar 2024 14:29:52 +0100 Subject: [PATCH 04/21] Made CMake project more backwards-compatible --- CMakeLists.txt | 55 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eea61e3..a28ddd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,29 +113,52 @@ list (APPEND STONEYDSP_BIQUADS_UNIT_FILES "${STONEYDSP_BIQUADS_UNIT_PROCESSOR}" "${STONEYDSP_BIQUADS_UNIT_WRAPPER}" ) - foreach (STONEYDSP_BIQUADS_UNIT_FILE IN LISTS STONEYDSP_BIQUADS_UNIT_FILES) - - string (REGEX REPLACE "[/]" "_" _stoneydsp_biquads_unit_transformed "${STONEYDSP_BIQUADS_UNIT_FILE}") - string (TOUPPER "${_stoneydsp_biquads_unit_transformed}" _stoneydsp_biquads_unit_transformed_upper) - - message (DEBUG "Biquads: ${_stoneydsp_biquads_unit_transformed_upper} found at ${_stoneydsp_biquads_unit_transformed}") - configure_file ( "include/${STONEYDSP_BIQUADS_UNIT_FILE}.hpp" # SRC_DIR "include/${STONEYDSP_BIQUADS_UNIT_FILE}.hpp" # BIN_DIR ) +endforeach() + +unset (STONEYDSP_BIQUADS_INCLUDEDIR) +set (STONEYDSP_BIQUADS_INCLUDEDIR + $ + $ +) + +if (CMAKE_MAJOR_VERSION GREATER_EQUAL 3 AND (CMAKE_MINOR_VERSION LESS 23)) + target_include_directories (Biquads PUBLIC ${STONEYDSP_BIQUADS_INCLUDEDIR}) +else () target_sources (Biquads PUBLIC FILE_SET biquads_HEADERS TYPE HEADERS - BASE_DIRS - $ - $ + BASE_DIRS ${STONEYDSP_BIQUADS_INCLUDEDIR} FILES - $ - $ + $ + $ + + $ + $ + + $ + $ + + $ + $ + + $ + $ ) +endif() + +foreach (STONEYDSP_BIQUADS_UNIT_FILE IN LISTS STONEYDSP_BIQUADS_UNIT_FILES) + + string (REGEX REPLACE "[/]" "_" _stoneydsp_biquads_unit_transformed "${STONEYDSP_BIQUADS_UNIT_FILE}") + string (TOUPPER "${_stoneydsp_biquads_unit_transformed}" _stoneydsp_biquads_unit_transformed_upper) + + message (DEBUG "Biquads: ${_stoneydsp_biquads_unit_transformed_upper} found at ${_stoneydsp_biquads_unit_transformed}") + if (NOT DEFINED STONEYDSP_BIQUADS_MODULE OR (NOT STONEYDSP_BIQUADS_MODULE)) target_sources (Biquads PRIVATE @@ -146,6 +169,8 @@ foreach (STONEYDSP_BIQUADS_UNIT_FILE IN LISTS STONEYDSP_BIQUADS_UNIT_FILES) # PRIVATE # "${_stoneydsp_biquads_unit_transformed_upper}_HPP_INCLUDED" # ) + unset (_stoneydsp_biquads_unit_transformed) + unset (_stoneydsp_biquads_unit_transformed_upper) endforeach () if (DEFINED STONEYDSP_BIQUADS_MODULE AND (STONEYDSP_BIQUADS_MODULE)) @@ -212,12 +237,6 @@ juce_generate_juce_header (Biquads) juce_enable_vst3_manifest_step (Biquads) -unset (STONEYDSP_BIQUADS_INCLUDEDIR) -set (STONEYDSP_BIQUADS_INCLUDEDIR - $ - $ -) - #[=============================================================================[ CTest configuration ]=============================================================================]# From 38044b63c9123feb1b86af2da873f2f2e09a5f96 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sat, 16 Mar 2024 18:47:43 +0100 Subject: [PATCH 05/21] Seperated CMake project into smaller targets with linkage requirements --- Biquads.jucer | 14 +- CMakeLists.txt | 372 +++++++++++++++--------- VERSION | 2 +- include/StoneyDSP/Biquads/Wrapper.hpp | 6 + src/StoneyDSP/Biquads/Processor.cpp | 66 ++--- src/StoneyDSP/Biquads/Wrapper.cpp | 3 +- tests/StoneyDSPBiquadsCTestConfig.cmake | 4 +- 7 files changed, 275 insertions(+), 192 deletions(-) diff --git a/Biquads.jucer b/Biquads.jucer index 549cdd7..e28cdc4 100644 --- a/Biquads.jucer +++ b/Biquads.jucer @@ -7,24 +7,14 @@ companyEmail="nathanjhood@googlemail.com"> - - - + + diff --git a/CMakeLists.txt b/CMakeLists.txt index a28ddd2..fecbf0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,21 +1,21 @@ #[=============================================================================[ - Simple two-pole equalizer with variable oversampling. - Copyright (c) 2024 - Nathan J. Hood - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -]=============================================================================]# +# Simple two-pole equalizer with variable oversampling. +# Copyright (c) 2024 - Nathan J. Hood +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +#]=============================================================================] cmake_minimum_required (VERSION 3.22...3.29 FATAL_ERROR) @@ -47,13 +47,6 @@ if (NOT DEFINED JUCE_VERSION) message (STATUS " Found JUCE v${JUCE_VERSION}...") endif () -set_directory_properties(PROPERTIES - JUCE_COMPANY_NAME "StoneyDSP" - JUCE_COMPANY_WEBSITE "https://stoneydsp.com" - JUCE_COMPANY_EMAIL "nathanjhood@googlemail.com" - JUCE_COMPANY_COPYRIGHT "Copyright (c) 2024 - StoneyDSP " -) - option (STONEYDSP_BIQUADS_TARGET_IS_INSTALLABLE "" OFF) option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_CONFIG_FLAGS "" ON) option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_LTO_FLAGS "" ON) @@ -64,38 +57,97 @@ set (STONEYDSP_BIQUADS_TARGETS "") #find_package (StoneyDSP CONFIG REQUIRED) #[=============================================================================[ - target: StoneyDSP::stoneydsp_core - target: StoneyDSP::stoneydsp_audio -]=============================================================================]# +# target: StoneyDSP::stoneydsp_core +# target: StoneyDSP::stoneydsp_audio +#]=============================================================================] add_subdirectory(modules) +set_directory_properties(PROPERTIES + JUCE_COMPANY_NAME "StoneyDSP" + JUCE_COMPANY_WEBSITE "https://stoneydsp.com" + JUCE_COMPANY_EMAIL "nathanjhood@googlemail.com" + JUCE_COMPANY_COPYRIGHT "Copyright (c) 2024 - StoneyDSP " +) + #[=============================================================================[ - target: StoneyDSP::Biquads -]=============================================================================]# +# target: StoneyDSP::Biquads_Audio_Plugin_Dependencies +#]=============================================================================] -juce_add_plugin (Biquads - # VERSION ... # Set this if the plugin version is different to the project version - # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone - # ICON_SMALL ... +add_library (Biquads_Audio_Plugin_Dependencies STATIC) +add_library (StoneyDSP::Biquads_Audio_Plugin_Dependencies ALIAS Biquads_Audio_Plugin_Dependencies) - VST3_AUTO_MANIFEST FALSE +target_link_libraries (Biquads_Audio_Plugin_Dependencies + PRIVATE + StoneyDSP::stoneydsp_core + StoneyDSP::stoneydsp_audio + # StoneyDSP::stoneydsp_graphics - IS_SYNTH FALSE # Is this a synth or an effect? - NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input? - NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output? - IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect? - EDITOR_WANTS_KEYBOARD_FOCUS TRUE # Does the editor need keyboard focus? - COPY_PLUGIN_AFTER_BUILD FALSE # Should the plugin be installed to a default location after building? - PLUGIN_MANUFACTURER_CODE Sdsp # A four-character manufacturer id with at least one upper-case character - PLUGIN_CODE Biq0 # A unique four-character plugin id with exactly one upper-case character - # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case - FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 + juce::juce_audio_basics + juce::juce_audio_devices + juce::juce_audio_formats + juce::juce_audio_plugin_client + juce::juce_audio_processors + juce::juce_audio_utils + juce::juce_core + juce::juce_data_structures + juce::juce_dsp + juce::juce_events + juce::juce_graphics + juce::juce_gui_basics + juce::juce_gui_extra +) +if (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_CONFIG_FLAGS) + target_link_libraries (Biquads_Audio_Plugin_Dependencies + PUBLIC + juce::juce_recommended_config_flags + ) +endif () +if (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_LTO_FLAGS) + target_link_libraries (Biquads_Audio_Plugin_Dependencies + PUBLIC + juce::juce_recommended_lto_flags + ) +endif () +if (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_WARNING_FLAGS) + target_link_libraries (Biquads_Audio_Plugin_Dependencies + PUBLIC + juce::juce_recommended_warning_flags + ) +endif () +target_compile_definitions (Biquads_Audio_Plugin_Dependencies + PUBLIC + JUCE_WEB_BROWSER=0 + JUCE_USE_CURL=0 + JUCE_VST3_CAN_REPLACE_VST2=0 + DONT_SET_USING_JUCE_NAMESPACE=1 +) +target_compile_definitions (Biquads_Audio_Plugin_Dependencies + INTERFACE + $ +) +target_include_directories(Biquads_Audio_Plugin_Dependencies + INTERFACE + $ +) - PRODUCT_NAME "Biquads" # The name of the final executable, which can differ from the target name - COMPANY_NAME "StoneyDSP" # Specify the name of the plugin's author +set_target_properties(Biquads_Audio_Plugin_Dependencies PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + VISIBILITY_INLINES_HIDDEN TRUE + C_VISBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VERSION ${STONEYDSP_BIQUADS_VERSION_MAJOR}.${STONEYDSP_BIQUADS_VERSION_MINOR}.${STONEYDSP_BIQUADS_VERSION_PATCH} + SOVERSION ${STONEYDSP_BIQUADS_VERSION_MAJOR} + EXCLUDE_FROM_ALL FALSE ) +#[=============================================================================[ +# target: StoneyDSP::Biquads_Audio_Plugin_Interface +#]=============================================================================] + +add_library (Biquads_Audio_Plugin_Interface INTERFACE) +add_library (StoneyDSP::Biquads_Audio_Plugin_Interface ALIAS Biquads_Audio_Plugin_Interface) + set (STONEYDSP_BIQUADS_INCLUDEDIR "") set (STONEYDSP_BIQUADS_INCLUDEDIR "${STONEYDSP_BIQUADS_BINARY_DIR}/include") # dont CACHE FORCE this yet, it will change again soon... @@ -127,17 +179,14 @@ set (STONEYDSP_BIQUADS_INCLUDEDIR ) if (CMAKE_MAJOR_VERSION GREATER_EQUAL 3 AND (CMAKE_MINOR_VERSION LESS 23)) - target_include_directories (Biquads PUBLIC ${STONEYDSP_BIQUADS_INCLUDEDIR}) + target_include_directories (Biquads_Audio_Plugin_Interface INTERFACE ${STONEYDSP_BIQUADS_INCLUDEDIR}) else () - target_sources (Biquads - PUBLIC - FILE_SET biquads_HEADERS + target_sources (Biquads_Audio_Plugin_Interface + INTERFACE + FILE_SET biquads_AUDIO_PLUGIN_INTERFACE_HEADERS TYPE HEADERS BASE_DIRS ${STONEYDSP_BIQUADS_INCLUDEDIR} FILES - $ - $ - $ $ @@ -152,94 +201,120 @@ else () ) endif() -foreach (STONEYDSP_BIQUADS_UNIT_FILE IN LISTS STONEYDSP_BIQUADS_UNIT_FILES) - - string (REGEX REPLACE "[/]" "_" _stoneydsp_biquads_unit_transformed "${STONEYDSP_BIQUADS_UNIT_FILE}") - string (TOUPPER "${_stoneydsp_biquads_unit_transformed}" _stoneydsp_biquads_unit_transformed_upper) - - message (DEBUG "Biquads: ${_stoneydsp_biquads_unit_transformed_upper} found at ${_stoneydsp_biquads_unit_transformed}") +set_target_properties(Biquads_Audio_Plugin_Interface PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + VISIBILITY_INLINES_HIDDEN TRUE + C_VISBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VERSION ${STONEYDSP_BIQUADS_VERSION_MAJOR}.${STONEYDSP_BIQUADS_VERSION_MINOR}.${STONEYDSP_BIQUADS_VERSION_PATCH} + SOVERSION ${STONEYDSP_BIQUADS_VERSION_MAJOR} + EXCLUDE_FROM_ALL TRUE +) - if (NOT DEFINED STONEYDSP_BIQUADS_MODULE OR (NOT STONEYDSP_BIQUADS_MODULE)) - target_sources (Biquads - PRIVATE - "src/${STONEYDSP_BIQUADS_UNIT_FILE}.cpp" - ) - endif () - # target_compile_definitions (Biquads - # PRIVATE - # "${_stoneydsp_biquads_unit_transformed_upper}_HPP_INCLUDED" - # ) - unset (_stoneydsp_biquads_unit_transformed) - unset (_stoneydsp_biquads_unit_transformed_upper) -endforeach () +#[=============================================================================[ +# target: StoneyDSP::Biquads_Audio_Plugin_Library +#]=============================================================================] -if (DEFINED STONEYDSP_BIQUADS_MODULE AND (STONEYDSP_BIQUADS_MODULE)) - target_sources (Biquads - PRIVATE - "src/${STONEYDSP_BIQUADS_UNIT}.cpp" - ) -endif () +add_library (Biquads_Audio_Plugin_Library STATIC) +add_library (StoneyDSP::Biquads_Audio_Plugin_Library ALIAS Biquads_Audio_Plugin_Library) -target_compile_definitions (Biquads +target_include_directories (Biquads_Audio_Plugin_Library PUBLIC - JUCE_WEB_BROWSER=0 - JUCE_USE_CURL=0 - JUCE_VST3_CAN_REPLACE_VST2=0 - DONT_SET_USING_JUCE_NAMESPACE=1 + ${STONEYDSP_BIQUADS_INCLUDEDIR} ) - -target_link_libraries (Biquads +target_sources (Biquads_Audio_Plugin_Library PRIVATE - StoneyDSP::stoneydsp_core - StoneyDSP::stoneydsp_audio - # StoneyDSP::stoneydsp_graphics + "src/${STONEYDSP_BIQUADS_UNIT_PARAMETERS}.cpp" + "src/${STONEYDSP_BIQUADS_UNIT_WRAPPER}.cpp" + "src/${STONEYDSP_BIQUADS_UNIT_PROCESSOR}.cpp" + "src/${STONEYDSP_BIQUADS_UNIT_EDITOR}.cpp" +) +target_link_libraries (Biquads_Audio_Plugin_Library + PUBLIC + StoneyDSP::Biquads_Audio_Plugin_Dependencies +) +target_link_libraries (Biquads_Audio_Plugin_Library + INTERFACE + StoneyDSP::Biquads_Audio_Plugin_Interface +) - juce::juce_audio_basics - juce::juce_audio_devices - juce::juce_audio_formats - juce::juce_audio_plugin_client - juce::juce_audio_processors - juce::juce_audio_utils - juce::juce_core - juce::juce_data_structures - juce::juce_dsp - juce::juce_events - juce::juce_graphics - juce::juce_gui_basics - juce::juce_gui_extra +set_target_properties(Biquads_Audio_Plugin_Library PROPERTIES + POSITION_INDEPENDENT_CODE TRUE + VISIBILITY_INLINES_HIDDEN TRUE + C_VISBILITY_PRESET hidden + CXX_VISIBILITY_PRESET hidden + VERSION ${STONEYDSP_BIQUADS_VERSION_MAJOR}.${STONEYDSP_BIQUADS_VERSION_MINOR}.${STONEYDSP_BIQUADS_VERSION_PATCH} + SOVERSION ${STONEYDSP_BIQUADS_VERSION_MAJOR} + EXCLUDE_FROM_ALL TRUE ) -if (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_CONFIG_FLAGS) - target_link_libraries (Biquads - PUBLIC - juce::juce_recommended_config_flags - ) -endif () -if (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_LTO_FLAGS) - target_link_libraries (Biquads - PUBLIC - juce::juce_recommended_lto_flags - ) -endif () -if (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_WARNING_FLAGS) - target_link_libraries (Biquads + +#[=============================================================================[ +# target: StoneyDSP::Biquads +#]=============================================================================] + +juce_add_plugin (Biquads_Audio_Plugin + # VERSION ... # Set this if the plugin version is different to the project version + # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone + # ICON_SMALL ... + + VST3_AUTO_MANIFEST FALSE + + IS_SYNTH FALSE # Is this a synth or an effect? + NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input? + NEEDS_MIDI_OUTPUT FALSE # Does the plugin need midi output? + IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect? + EDITOR_WANTS_KEYBOARD_FOCUS FALSE # Does the editor need keyboard focus? + COPY_PLUGIN_AFTER_BUILD FALSE # Should the plugin be installed to a default location after building? + PLUGIN_MANUFACTURER_CODE Sdsp # A four-character manufacturer id with at least one upper-case character + PLUGIN_CODE Biq0 # A unique four-character plugin id with exactly one upper-case character + # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case + FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 + + PRODUCT_NAME "Biquads" # The name of the final executable, which can differ from the target name + COMPANY_NAME "StoneyDSP" # Specify the name of the plugin's author +) + +if (CMAKE_MAJOR_VERSION GREATER_EQUAL 3 AND (CMAKE_MINOR_VERSION LESS 23)) + target_include_directories (Biquads_Audio_Plugin PUBLIC ${STONEYDSP_BIQUADS_INCLUDEDIR}) +else () + target_sources (Biquads_Audio_Plugin PUBLIC - juce::juce_recommended_warning_flags + FILE_SET biquads_AUDIO_PLUGIN_HEADERS + TYPE HEADERS + BASE_DIRS ${STONEYDSP_BIQUADS_INCLUDEDIR} + FILES + $ + $ ) -endif () +endif() +target_sources (Biquads_Audio_Plugin + PRIVATE + "src/${STONEYDSP_BIQUADS_UNIT}.cpp" +) +target_link_libraries (Biquads_Audio_Plugin + PRIVATE + StoneyDSP::Biquads_Audio_Plugin_Dependencies + StoneyDSP::Biquads_Audio_Plugin_Library +) +target_link_libraries (Biquads_Audio_Plugin + INTERFACE + StoneyDSP::Biquads_Audio_Plugin_Interface +) -list (APPEND STONEYDSP_BIQUADS_TARGETS Biquads) +list (APPEND STONEYDSP_BIQUADS_TARGETS Biquads_Audio_Plugin_Dependencies) #[=============================================================================[ - Helpers -]=============================================================================]# +# Helpers +#]=============================================================================] -juce_generate_juce_header (Biquads) +juce_generate_juce_header (Biquads_Audio_Plugin) -juce_enable_vst3_manifest_step (Biquads) +juce_enable_vst3_manifest_step (Biquads_Audio_Plugin) #[=============================================================================[ - CTest configuration -]=============================================================================]# +# CTest configuration +#]=============================================================================] + option (STONEYDSP_BIQUADS_BUILD_TESTS "Build tests" ON) if (STONEYDSP_BIQUADS_BUILD_TESTS AND (STONEYDSP_BIQUADS_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)) @@ -248,8 +323,8 @@ if (STONEYDSP_BIQUADS_BUILD_TESTS AND (STONEYDSP_BIQUADS_SOURCE_DIR STREQUAL CMA endif () #[=============================================================================[ - Export targets configuration -]=============================================================================]# +# Export targets configuration +#]=============================================================================] include(CMakePackageConfigHelpers) @@ -261,8 +336,8 @@ if (STONEYDSP_BIQUADS_TARGET_IS_INSTALLABLE) ) endif () #[=============================================================================[ - Install & CPack configuration -]=============================================================================]# +# Install & CPack configuration +#]=============================================================================] include(GNUInstallDirs) @@ -275,8 +350,8 @@ write_basic_package_version_file( set(STONEYDSP_BIQUADS_INSTALL_DESTINATION "lib/cmake/StoneyDSP-Biquads-v${STONEYDSP_BIQUADS_VERSION}" CACHE STRING "The location, relative to the install prefix, where the StoneyDSP Biquads config file will be installed") -unset(STONEYDSP_BIQUADS_INCLUDEDIR) -set(STONEYDSP_BIQUADS_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "Installation directory for include files, a relative path that will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute path." FORCE) +# unset(STONEYDSP_BIQUADS_INCLUDEDIR) +# set(STONEYDSP_BIQUADS_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE PATH "Installation directory for include files, a relative path that will be joined with ${CMAKE_INSTALL_PREFIX} or an absolute path." FORCE) foreach (STONEYDSP_BIQUADS_UNIT_FILE IN LISTS STONEYDSP_BIQUADS_UNIT_FILES) if (STONEYDSP_BIQUADS_UNIT_FILE STREQUAL "StoneyDSP/Biquads") @@ -299,16 +374,29 @@ configure_package_config_file( ) if (STONEYDSP_BIQUADS_TARGET_IS_INSTALLABLE) - install( - TARGETS ${STONEYDSP_BIQUADS_TARGETS} - EXPORT StoneyDSPBiquadsTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" - FILE_SET biquads_HEADERS - ) + if (CMAKE_MAJOR_VERSION GREATER_EQUAL 3 AND (CMAKE_MINOR_VERSION LESS 23)) + install( + TARGETS ${STONEYDSP_BIQUADS_TARGETS} + EXPORT StoneyDSPBiquadsTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" + # FILE_SET biquads_HEADERS "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" + ) + else () + install( + TARGETS ${STONEYDSP_BIQUADS_TARGETS} + EXPORT StoneyDSPBiquadsTargets + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" + #PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" + FILE_SET biquads_HEADERS "${CMAKE_INSTALL_INCLUDEDIR}/StoneyDSP" + ) + endif () install( EXPORT StoneyDSPBiquadsTargets FILE StoneyDSPBiquadsTargets.cmake @@ -366,7 +454,7 @@ set(CPACK_SOURCE_IGNORE_FILES ${STONEYDSP_BIQUADS_CPACK_IGNORE_LIST}) include(CPack) #[=============================================================================[ - -]=============================================================================]# +# +#]=============================================================================] message (STATUS "Configuring StoneyDSP Biquads v${STONEYDSP_BIQUADS_VERSION} - done.") diff --git a/VERSION b/VERSION index e6210fb..2920957 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2.152 +1.2.2.154 diff --git a/include/StoneyDSP/Biquads/Wrapper.hpp b/include/StoneyDSP/Biquads/Wrapper.hpp index e323d3c..f032090 100644 --- a/include/StoneyDSP/Biquads/Wrapper.hpp +++ b/include/StoneyDSP/Biquads/Wrapper.hpp @@ -100,6 +100,12 @@ class AudioPluginAudioProcessorWrapper SampleType processSample(int channel, SampleType inputValue); + // void applyGain(juce::AudioBuffer& buffer, SampleType gainLevel = static_cast(1.0)) + // { + // for (auto channel = 0; channel < audioProcessor.getTotalNumOutputChannels(); ++channel) + // buffer.applyGain (channel, 0, buffer.getNumSamples(), gainLevel); + // } + //============================================================================== /** Updates the internal state variables of the processor. */ void update(); diff --git a/src/StoneyDSP/Biquads/Processor.cpp b/src/StoneyDSP/Biquads/Processor.cpp index c9f9dc4..5e65d62 100644 --- a/src/StoneyDSP/Biquads/Processor.cpp +++ b/src/StoneyDSP/Biquads/Processor.cpp @@ -43,41 +43,41 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() , undoManager() , apvts(*this, &undoManager, "Parameters", createParameterLayout()) , spec() -, parameters(*this, getAPVTS()) +, parameters (*this, getAPVTS()) , processorFlt(*this, getAPVTS(), getSpec()) , processorDbl(*this, getAPVTS(), getSpec()) -, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) -, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) -, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) -, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) -, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) - -, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) -, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) -, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) -, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) -, biquadsATypePtr(dynamic_cast (apvts.getParameter("Band_A_typeID"))) - -, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) -, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) -, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) -, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) -, biquadsBTypePtr(dynamic_cast (apvts.getParameter("Band_B_typeID"))) - -, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) -, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) -, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) -, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) -, biquadsCTypePtr(dynamic_cast (apvts.getParameter("Band_C_typeID"))) - -, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) -, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) -, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) -, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) -, biquadsDTypePtr(dynamic_cast (apvts.getParameter("Band_D_typeID"))) - -, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) +, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) +, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) +, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) +, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) +, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) + +, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) +, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) +, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) +, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) +, biquadsATypePtr (dynamic_cast (apvts.getParameter("Band_A_typeID"))) + +, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) +, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) +, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) +, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) +, biquadsBTypePtr (dynamic_cast (apvts.getParameter("Band_B_typeID"))) + +, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) +, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) +, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) +, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) +, biquadsCTypePtr (dynamic_cast (apvts.getParameter("Band_C_typeID"))) + +, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) +, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) +, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) +, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) +, biquadsDTypePtr (dynamic_cast (apvts.getParameter("Band_D_typeID"))) + +, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) // , processingPrecision(singlePrecision) { masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); @@ -204,7 +204,7 @@ void AudioPluginAudioProcessor::setProcessingPrecision(juce::AudioProcessor::Pro //============================================================================== const juce::String AudioPluginAudioProcessor::getName() const { - return JucePlugin_Name; + return ProjectInfo::projectName; } bool AudioPluginAudioProcessor::acceptsMidi() const diff --git a/src/StoneyDSP/Biquads/Wrapper.cpp b/src/StoneyDSP/Biquads/Wrapper.cpp index 852c2f8..2dab11a 100644 --- a/src/StoneyDSP/Biquads/Wrapper.cpp +++ b/src/StoneyDSP/Biquads/Wrapper.cpp @@ -268,8 +268,7 @@ void AudioPluginAudioProcessorWrapper::processBlock(juce::AudioBuffe // oversampler[curOS]->processSamplesDown(wetBlock); - for (auto channel = 0; channel < audioProcessor.getTotalNumOutputChannels(); ++channel) - buffer.applyGain (channel, 0, buffer.getNumSamples(), static_cast(juce::Decibels::decibelsToGain(static_cast(masterOutputPtr->get()), static_cast(-120.00)))); + // applyGain(buffer, static_cast(juce::Decibels::decibelsToGain(static_cast(masterOutputPtr->get()), static_cast(-120.00)))) mixer.mixWetSamples(wetBlock); return; diff --git a/tests/StoneyDSPBiquadsCTestConfig.cmake b/tests/StoneyDSPBiquadsCTestConfig.cmake index f61f1e4..8d8b05b 100644 --- a/tests/StoneyDSPBiquadsCTestConfig.cmake +++ b/tests/StoneyDSPBiquadsCTestConfig.cmake @@ -70,7 +70,7 @@ if(STONEYDSP_BIQUADS_BUILD_TESTS) macro(_stoneydsp_biquads_test_audiopluginexample_pluginval_vst3_validation) add_test( NAME test_pluginval_vst3_validation - COMMAND "${STONEYDSP_BIQUADS_BINARY_DIR}/${_pluginval_binary}" "--output-dir ${STONEYDSP_BIQUADS_BINARY_DIR}" "--strictness-level 10" "--verbose" "--validate" "${STONEYDSP_BIQUADS_BINARY_DIR}/Biquads_artefacts/${CMAKE_BUILD_TYPE}/VST3/Biquads.vst3/" "${_pluginval_fail}" + COMMAND "${STONEYDSP_BIQUADS_BINARY_DIR}/${_pluginval_binary}" "--output-dir ${STONEYDSP_BIQUADS_BINARY_DIR}" "--strictness-level 10" "--verbose" "--validate" "${STONEYDSP_BIQUADS_BINARY_DIR}/Biquads_Audio_Plugin_artefacts/${CMAKE_BUILD_TYPE}/VST3/Biquads.vst3/" "${_pluginval_fail}" WORKING_DIRECTORY "${STONEYDSP_BIQUADS_BINARY_DIR}" ) endmacro() @@ -78,7 +78,7 @@ if(STONEYDSP_BIQUADS_BUILD_TESTS) macro(_stoneydsp_biquads_test_audiopluginexample_pluginval_vst3_unit_tests) add_test( NAME test_pluginval_vst3_unit_tests - COMMAND "${STONEYDSP_BIQUADS_BINARY_DIR}/${_pluginval_binary}" "--output-dir ${STONEYDSP_BIQUADS_BINARY_DIR}" "--strictness-level 10" "--verbose" "--run-tests" "${StoneyDSP_BINARY_DIR}/Biquads_artefacts/${CMAKE_BUILD_TYPE}/VST3/Biquads.vst3/" "${_pluginval_fail}" + COMMAND "${STONEYDSP_BIQUADS_BINARY_DIR}/${_pluginval_binary}" "--output-dir ${STONEYDSP_BIQUADS_BINARY_DIR}" "--strictness-level 10" "--verbose" "--run-tests" "${StoneyDSP_BINARY_DIR}/Biquads_Audio_Plugin_artefacts/${CMAKE_BUILD_TYPE}/VST3/Biquads.vst3/" "${_pluginval_fail}" WORKING_DIRECTORY "${STONEYDSP_BIQUADS_BINARY_DIR}" ) endmacro() From 8270eb141a5470986a3106f1ef67d75e66c2c343 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sat, 16 Mar 2024 18:57:56 +0100 Subject: [PATCH 06/21] Added C++17 linkage requirement to targets --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fecbf0a..6c91e17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,7 +130,7 @@ target_include_directories(Biquads_Audio_Plugin_Dependencies INTERFACE $ ) - +target_compile_features(Biquads_Audio_Plugin_Dependencies PRIVATE cxx_std_17) set_target_properties(Biquads_Audio_Plugin_Dependencies PROPERTIES POSITION_INDEPENDENT_CODE TRUE VISIBILITY_INLINES_HIDDEN TRUE @@ -200,7 +200,7 @@ else () $ ) endif() - +target_compile_features(Biquads_Audio_Plugin_Interface INTERFACE cxx_std_17) set_target_properties(Biquads_Audio_Plugin_Interface PROPERTIES POSITION_INDEPENDENT_CODE TRUE VISIBILITY_INLINES_HIDDEN TRUE @@ -237,7 +237,7 @@ target_link_libraries (Biquads_Audio_Plugin_Library INTERFACE StoneyDSP::Biquads_Audio_Plugin_Interface ) - +target_compile_features(Biquads_Audio_Plugin_Library PRIVATE cxx_std_17) set_target_properties(Biquads_Audio_Plugin_Library PROPERTIES POSITION_INDEPENDENT_CODE TRUE VISIBILITY_INLINES_HIDDEN TRUE From e9c4d16986536b8d7a07cdad70d9934428c32c71 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 02:27:02 +0100 Subject: [PATCH 07/21] Removed lots of unecessary pointers --- .vscode/launch.json | 21 ++- .vscode/settings.json | 2 + include/StoneyDSP/Biquads/Processor.hpp | 40 +----- include/StoneyDSP/Biquads/Wrapper.hpp | 8 +- src/StoneyDSP/Biquads/Parameters.cpp | 165 ++++++++++++------------ src/StoneyDSP/Biquads/Processor.cpp | 133 ++++--------------- src/StoneyDSP/Biquads/Wrapper.cpp | 122 +++++++++--------- 7 files changed, 197 insertions(+), 294 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 881a7dd..3abea5e 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,6 +7,25 @@ "cmakeDebugType": "external", "pipeName": "/tmp/vcpkg_ext_portfile_dbg", "preLaunchTask": "Debug vcpkg commands" - } + }, + { + "name": "Reaper", + "request": "launch", + "type": "cppdbg", + "program": "/usr/local/bin/reaper", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index 1acb1f5..e18f551 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,6 +17,8 @@ "VCPKG_PREFER_SYSTEM_INSTALLED_BINARIES": true, // "CMAKE_TOOLCHAIN_FILE": "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "CMAKE_MAKE_PROGRAM": "make", + "CMAKE_CONFIGURATION_TYPES": "Debug;Release", + "CMAKE_BUILD_TYPE": "Debug", "CMAKE_C_COMPILER_LAUNCHER": "ccache", "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", "STONEYDSP_BIQUADS_BUILD_TESTS": true diff --git a/include/StoneyDSP/Biquads/Processor.hpp b/include/StoneyDSP/Biquads/Processor.hpp index 59db399..43b0575 100644 --- a/include/StoneyDSP/Biquads/Processor.hpp +++ b/include/StoneyDSP/Biquads/Processor.hpp @@ -80,56 +80,24 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor juce::UndoManager undoManager; juce::UndoManager& getUndoManager() { return undoManager; } //============================================================================== - juce::AudioProcessorValueTreeState apvts; juce::AudioProcessorValueTreeState& getAPVTS() { return apvts; } static juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout(); //============================================================================== - juce::dsp::ProcessSpec spec; juce::dsp::ProcessSpec& getSpec() { return spec; } - private: //============================================================================== /** Audio processor members. */ + juce::AudioProcessorValueTreeState apvts; + juce::dsp::ProcessSpec spec; juce::AudioProcessor::ProcessingPrecision processingPrecision; - + //============================================================================== AudioPluginAudioProcessorParameters parameters; - AudioPluginAudioProcessorWrapper processorFlt; AudioPluginAudioProcessorWrapper processorDbl; - //========================================================================== + //============================================================================== /** Parameter pointers. */ - juce::AudioParameterBool* masterBypassPtr { nullptr }; - juce::AudioParameterFloat* masterOutputPtr { nullptr }; - juce::AudioParameterFloat* masterMixPtr { nullptr }; - juce::AudioParameterChoice* masterOsPtr { nullptr }; - juce::AudioParameterChoice* masterTransformPtr { nullptr }; - - juce::AudioParameterBool* biquadsABypassPtr { nullptr }; - juce::AudioParameterFloat* biquadsAFrequencyPtr { nullptr }; - juce::AudioParameterFloat* biquadsAResonancePtr { nullptr }; - juce::AudioParameterFloat* biquadsAGainPtr { nullptr }; - juce::AudioParameterChoice* biquadsATypePtr { nullptr }; - - juce::AudioParameterBool* biquadsBBypassPtr { nullptr }; - juce::AudioParameterFloat* biquadsBFrequencyPtr { nullptr }; - juce::AudioParameterFloat* biquadsBResonancePtr { nullptr }; - juce::AudioParameterFloat* biquadsBGainPtr { nullptr }; - juce::AudioParameterChoice* biquadsBTypePtr { nullptr }; - - juce::AudioParameterBool* biquadsCBypassPtr { nullptr }; - juce::AudioParameterFloat* biquadsCFrequencyPtr { nullptr }; - juce::AudioParameterFloat* biquadsCResonancePtr { nullptr }; - juce::AudioParameterFloat* biquadsCGainPtr { nullptr }; - juce::AudioParameterChoice* biquadsCTypePtr { nullptr }; - - juce::AudioParameterBool* biquadsDBypassPtr { nullptr }; - juce::AudioParameterFloat* biquadsDFrequencyPtr { nullptr }; - juce::AudioParameterFloat* biquadsDResonancePtr { nullptr }; - juce::AudioParameterFloat* biquadsDGainPtr { nullptr }; - juce::AudioParameterChoice* biquadsDTypePtr { nullptr }; - juce::AudioParameterBool* bypassState { nullptr }; //============================================================================== diff --git a/include/StoneyDSP/Biquads/Wrapper.hpp b/include/StoneyDSP/Biquads/Wrapper.hpp index f032090..1570071 100644 --- a/include/StoneyDSP/Biquads/Wrapper.hpp +++ b/include/StoneyDSP/Biquads/Wrapper.hpp @@ -110,11 +110,11 @@ class AudioPluginAudioProcessorWrapper /** Updates the internal state variables of the processor. */ void update(); - // //========================================================================== - // /** Sets the oversampling factor. */ - // void setOversampling(); + //============================================================================== + /** Sets the oversampling factor. */ + void setOversampling(); - // SampleType getLatencySamples() const noexcept; + SampleType getLatencySamples() const noexcept; private: //============================================================================== diff --git a/src/StoneyDSP/Biquads/Parameters.cpp b/src/StoneyDSP/Biquads/Parameters.cpp index 35d55cf..27dcbe7 100644 --- a/src/StoneyDSP/Biquads/Parameters.cpp +++ b/src/StoneyDSP/Biquads/Parameters.cpp @@ -38,29 +38,29 @@ AudioPluginAudioProcessorParameters::AudioPluginAudioProcessorParameters(AudioPl void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcessorValueTreeState::ParameterLayout& params) { - const auto dBMax = juce::Decibels::gainToDecibels(16.0f); - const auto dBMin = juce::Decibels::gainToDecibels(0.0625f); - const auto dBOut = juce::Decibels::gainToDecibels(0.5f, -120.0f) * 20.0f; - - const auto freqRange = juce::NormalisableRange(20.00f, 20000.00f, 0.001f, 00.198894f); - const auto resRange = juce::NormalisableRange(00.00f, 1.00f, 0.01f, 1.00f); - const auto gainRange = juce::NormalisableRange(dBMin, dBMax, 0.01f, 1.00f); - const auto mixRange = juce::NormalisableRange(00.00f, 100.00f, 0.01f, 1.00f); - const auto outputRange = juce::NormalisableRange(dBOut, dBMax, 0.01f, 1.00f); - - const auto fString = juce::StringArray({ "LP2", "LP1", "HP2", "HP1" , "BP2", "BP2c", "LS2", "LS1c", "LS1", "HS2", "HS1c", "HS1", "PK2", "NX2", "AP2" }); - const auto tString = juce::StringArray({ "DFI", "DFII", "DFI t", "DFII t" }); - const auto osString = juce::StringArray({ "--", "2x", "4x", "8x", "16x" }); - - const auto decibels = juce::String{ ("dB") }; - const auto frequency = juce::String{ ("Hz") }; - const auto reso = juce::String{ ("q") }; - const auto percentage = juce::String{ ("%") }; - - auto genParam = juce::AudioProcessorParameter::genericParameter; - auto inMeter = juce::AudioProcessorParameter::inputMeter; - auto outParam = juce::AudioProcessorParameter::outputGain; - auto outMeter = juce::AudioProcessorParameter::outputMeter; + const auto dBMax = juce::Decibels::gainToDecibels(16.0f); + const auto dBMin = juce::Decibels::gainToDecibels(0.0625f); + const auto dBOut = juce::Decibels::gainToDecibels(0.5f, -120.0f) * 20.0f; + + const auto freqRange = juce::NormalisableRange(20.00f, 20000.00f, 0.001f, 00.198894f); + const auto resRange = juce::NormalisableRange(00.00f, 1.00f, 0.01f, 1.00f); + const auto gainRange = juce::NormalisableRange(dBMin, dBMax, 0.01f, 1.00f); + const auto mixRange = juce::NormalisableRange(00.00f, 100.00f, 0.01f, 1.00f); + const auto outputRange = juce::NormalisableRange(dBOut, dBMax, 0.01f, 1.00f); + + const auto fString = juce::StringArray({ "LP2", "LP1", "HP2", "HP1" , "BP2", "BP2c", "LS2", "LS1c", "LS1", "HS2", "HS1c", "HS1", "PK2", "NX2", "AP2" }); + const auto tString = juce::StringArray({ "DFI", "DFII", "DFI t", "DFII t" }); + const auto osString = juce::StringArray({ "--", "2x", "4x", "8x", "16x" }); + + const auto decibels = juce::String{ ("dB") }; + const auto frequency = juce::String{ ("Hz") }; + const auto reso = juce::String{ ("q") }; + const auto percentage = juce::String{ ("%") }; + + const auto genParam = juce::AudioProcessorParameter::genericParameter; + const auto inMeter = juce::AudioProcessorParameter::inputMeter; + const auto outParam = juce::AudioProcessorParameter::outputGain; + const auto outMeter = juce::AudioProcessorParameter::outputMeter; juce::ignoreUnused(inMeter); juce::ignoreUnused(outMeter); @@ -86,70 +86,67 @@ void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcesso .withCategory(outParam); params.add( - //====================================================================== - std::make_unique("Master_ID", "0", "seperatorMaster", - //================================================================== - std::make_unique (juce::ParameterID{ "Master_bypassID", ProjectInfo::versionNumber}, "Bypass", false) - , std::make_unique (juce::ParameterID{ "Master_outputID", ProjectInfo::versionNumber}, "Output", outputRange, 00.00f, outputAttributes) - , std::make_unique (juce::ParameterID{ "Master_mixID", ProjectInfo::versionNumber}, "Mix", mixRange, 100.00f, mixAttributes) - , std::make_unique(juce::ParameterID{ "Master_osID", ProjectInfo::versionNumber}, "Oversampling", osString, 0) - , std::make_unique(juce::ParameterID{ "Master_transformID", ProjectInfo::versionNumber}, "Transform", tString, 3) - ) - ); - - params.add( - //====================================================================== - std::make_unique("Band_A_ID", "1", "seperatorA", - //================================================================== - std::make_unique (juce::ParameterID{ "Band_A_bypassID", ProjectInfo::versionNumber}, "Bypass", false) - , std::make_unique (juce::ParameterID{ "Band_A_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) - , std::make_unique (juce::ParameterID{ "Band_A_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) - , std::make_unique (juce::ParameterID{ "Band_A_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) - , std::make_unique(juce::ParameterID{ "Band_A_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) - //================================================================== - ) - ); - - params.add( - //====================================================================== - std::make_unique("Band_B_ID", "2", "seperatorB", - //================================================================== - std::make_unique (juce::ParameterID{ "Band_B_bypassID", ProjectInfo::versionNumber}, "Bypass", true) - , std::make_unique (juce::ParameterID{ "Band_B_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) - , std::make_unique (juce::ParameterID{ "Band_B_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) - , std::make_unique (juce::ParameterID{ "Band_B_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) - , std::make_unique(juce::ParameterID{ "Band_B_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) - //================================================================== - ) - ); - - params.add( - //====================================================================== - std::make_unique("Band_C_ID", "3", "seperatorC", - //================================================================== - std::make_unique (juce::ParameterID{ "Band_C_bypassID", ProjectInfo::versionNumber}, "Bypass", true) - , std::make_unique (juce::ParameterID{ "Band_C_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) - , std::make_unique (juce::ParameterID{ "Band_C_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) - , std::make_unique (juce::ParameterID{ "Band_C_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) - , std::make_unique(juce::ParameterID{ "Band_C_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) - //================================================================== - ) - ); - - params.add( - //====================================================================== - std::make_unique("Band_D_ID", "4", "seperatorD", - //================================================================== - std::make_unique (juce::ParameterID{ "Band_D_bypassID", ProjectInfo::versionNumber}, "Bypass", true) - , std::make_unique (juce::ParameterID{ "Band_D_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) - , std::make_unique (juce::ParameterID{ "Band_D_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) - , std::make_unique (juce::ParameterID{ "Band_D_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) - , std::make_unique(juce::ParameterID{ "Band_D_typeID", ProjectInfo::versionNumber}, "Type", fString, 0) - //================================================================== + //============================================================================== + std::make_unique("Biquads_ID", ProjectInfo::projectName, "seperatorBiquads", + //============================================================================== + std::make_unique("Master_ID", "Master", "seperatorMaster" + //============================================================================== + , std::make_unique (juce::ParameterID{ "Master_bypassID", ProjectInfo::versionNumber}, "Bypass", false) + , std::make_unique (juce::ParameterID{ "Master_outputID", ProjectInfo::versionNumber}, "Output", outputRange, 00.00f, outputAttributes) + , std::make_unique (juce::ParameterID{ "Master_mixID", ProjectInfo::versionNumber}, "Mix", mixRange, 100.00f, mixAttributes) + , std::make_unique(juce::ParameterID{ "Master_osID", ProjectInfo::versionNumber}, "Oversampling", osString, 0) + , std::make_unique(juce::ParameterID{ "Master_transformID", ProjectInfo::versionNumber}, "Transform", tString, 3) + ), + //============================================================================== + std::make_unique("Processor_ID", ProjectInfo::versionString, "seperatorProcessor", + //============================================================================== + std::make_unique("Band_A_ID", "Band A", "seperatorA" + //============================================================================== + , std::make_unique (juce::ParameterID{ "Band_A_bypassID", ProjectInfo::versionNumber}, "Bypass", false) + , std::make_unique (juce::ParameterID{ "Band_A_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_A_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_A_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_A_typeID", ProjectInfo::versionNumber}, "Type", fString, 12) + //============================================================================== + ), + //============================================================================== + std::make_unique("Band_B_ID", "Band B", "seperatorB" + //============================================================================== + , std::make_unique (juce::ParameterID{ "Band_B_bypassID", ProjectInfo::versionNumber}, "Bypass", true) + , std::make_unique (juce::ParameterID{ "Band_B_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_B_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_B_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_B_typeID", ProjectInfo::versionNumber}, "Type", fString, 12) + //============================================================================== + ), + //============================================================================== + std::make_unique("Band_C_ID", "Band C", "seperatorC" + //============================================================================== + , std::make_unique (juce::ParameterID{ "Band_C_bypassID", ProjectInfo::versionNumber}, "Bypass", true) + , std::make_unique (juce::ParameterID{ "Band_C_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_C_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_C_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_C_typeID", ProjectInfo::versionNumber}, "Type", fString, 12) + //============================================================================== + ), + //============================================================================== + std::make_unique("Band_D_ID", "Band D", "seperatorD" + //============================================================================== + , std::make_unique (juce::ParameterID{ "Band_D_bypassID", ProjectInfo::versionNumber}, "Bypass", true) + , std::make_unique (juce::ParameterID{ "Band_D_frequencyID", ProjectInfo::versionNumber}, "Frequency", freqRange, 632.455f, freqAttributes) + , std::make_unique (juce::ParameterID{ "Band_D_resonanceID", ProjectInfo::versionNumber}, "Resonance", resRange, 00.10f, resoAttributes) + , std::make_unique (juce::ParameterID{ "Band_D_gainID", ProjectInfo::versionNumber}, "Gain", gainRange, 00.00f, gainAttributes) + , std::make_unique(juce::ParameterID{ "Band_D_typeID", ProjectInfo::versionNumber}, "Type", fString, 12) + //============================================================================== + ) + //============================================================================== + ) + //============================================================================== ) + //============================================================================== ); } - +//============================================================================== /// @} group Biquads } // namespace Biquads diff --git a/src/StoneyDSP/Biquads/Processor.cpp b/src/StoneyDSP/Biquads/Processor.cpp index 5e65d62..e3901f7 100644 --- a/src/StoneyDSP/Biquads/Processor.cpp +++ b/src/StoneyDSP/Biquads/Processor.cpp @@ -40,109 +40,18 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() .withOutput ("Output", juce::AudioChannelSet::stereo(), true) #endif ) -, undoManager() -, apvts(*this, &undoManager, "Parameters", createParameterLayout()) -, spec() -, parameters (*this, getAPVTS()) -, processorFlt(*this, getAPVTS(), getSpec()) -, processorDbl(*this, getAPVTS(), getSpec()) - -, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) -, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) -, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) -, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) -, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) - -, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) -, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) -, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) -, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) -, biquadsATypePtr (dynamic_cast (apvts.getParameter("Band_A_typeID"))) - -, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) -, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) -, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) -, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) -, biquadsBTypePtr (dynamic_cast (apvts.getParameter("Band_B_typeID"))) - -, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) -, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) -, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) -, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) -, biquadsCTypePtr (dynamic_cast (apvts.getParameter("Band_C_typeID"))) - -, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) -, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) -, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) -, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) -, biquadsDTypePtr (dynamic_cast (apvts.getParameter("Band_D_typeID"))) - -, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) + , undoManager() + , apvts(*this, &undoManager, juce::Identifier { "Parameters" }, createParameterLayout()) + , spec() + , parameters (*this, getAPVTS()) + , processorFlt(*this, getAPVTS(), getSpec()) + , processorDbl(*this, getAPVTS(), getSpec()) // , processingPrecision(singlePrecision) + , bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) { - masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); - masterOutputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); - masterMixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); - masterOsPtr = dynamic_cast (apvts.getParameter("Master_osID")); - masterTransformPtr = dynamic_cast (apvts.getParameter("Master_transformID")); - - biquadsABypassPtr = dynamic_cast (apvts.getParameter("Band_A_bypassID")); - biquadsAFrequencyPtr = dynamic_cast (apvts.getParameter("Band_A_frequencyID")); - biquadsAResonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); - biquadsAGainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); - biquadsATypePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); - - biquadsBBypassPtr = dynamic_cast (apvts.getParameter("Band_B_bypassID")); - biquadsBFrequencyPtr = dynamic_cast (apvts.getParameter("Band_B_frequencyID")); - biquadsBResonancePtr = dynamic_cast (apvts.getParameter("Band_B_resonanceID")); - biquadsBGainPtr = dynamic_cast (apvts.getParameter("Band_B_gainID")); - biquadsBTypePtr = dynamic_cast (apvts.getParameter("Band_B_typeID")); - - biquadsCBypassPtr = dynamic_cast (apvts.getParameter("Band_C_bypassID")); - biquadsCFrequencyPtr = dynamic_cast (apvts.getParameter("Band_C_frequencyID")); - biquadsCResonancePtr = dynamic_cast (apvts.getParameter("Band_C_resonanceID")); - biquadsCGainPtr = dynamic_cast (apvts.getParameter("Band_C_gainID")); - biquadsCTypePtr = dynamic_cast (apvts.getParameter("Band_C_typeID")); - - biquadsDBypassPtr = dynamic_cast (apvts.getParameter("Band_D_bypassID")); - biquadsDFrequencyPtr = dynamic_cast (apvts.getParameter("Band_D_frequencyID")); - biquadsDResonancePtr = dynamic_cast (apvts.getParameter("Band_D_resonanceID")); - biquadsDGainPtr = dynamic_cast (apvts.getParameter("Band_D_gainID")); - biquadsDTypePtr = dynamic_cast (apvts.getParameter("Band_D_typeID")); - - bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); - - jassert(masterBypassPtr != nullptr); - jassert(masterOutputPtr != nullptr); - jassert(masterMixPtr != nullptr); - jassert(masterOsPtr != nullptr); - jassert(masterTransformPtr != nullptr); - - jassert(biquadsABypassPtr != nullptr); - jassert(biquadsAFrequencyPtr != nullptr); - jassert(biquadsAResonancePtr != nullptr); - jassert(biquadsAGainPtr != nullptr); - jassert(biquadsATypePtr != nullptr); - - jassert(biquadsBBypassPtr != nullptr); - jassert(biquadsBFrequencyPtr != nullptr); - jassert(biquadsBResonancePtr != nullptr); - jassert(biquadsBGainPtr != nullptr); - jassert(biquadsBTypePtr != nullptr); - - jassert(biquadsCBypassPtr != nullptr); - jassert(biquadsCFrequencyPtr != nullptr); - jassert(biquadsCResonancePtr != nullptr); - jassert(biquadsCGainPtr != nullptr); - jassert(biquadsCTypePtr != nullptr); - - jassert(biquadsDBypassPtr != nullptr); - jassert(biquadsDFrequencyPtr != nullptr); - jassert(biquadsDResonancePtr != nullptr); - jassert(biquadsDGainPtr != nullptr); - jassert(biquadsDTypePtr != nullptr); - - jassert(bypassState != nullptr); + bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); + + jassert(bypassState != nullptr); } AudioPluginAudioProcessor::~AudioPluginAudioProcessor() @@ -277,16 +186,28 @@ void AudioPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPer spec.maximumBlockSize = static_cast(samplesPerBlock); spec.numChannels = static_cast(getTotalNumOutputChannels()); - processorFlt.prepare(getSpec()); - processorDbl.prepare(getSpec()); + if(!isUsingDoublePrecision()) + { + processorFlt.prepare(getSpec()); + } + else + { + processorDbl.prepare(getSpec()); + } } void AudioPluginAudioProcessor::releaseResources() { // When playback stops, you can use this as an opportunity to free up any // spare memory, etc. - processorFlt.reset(0.0f); - processorDbl.reset(0.0); + if(!isUsingDoublePrecision()) + { + processorFlt.reset(0.0f); + } + else + { + processorDbl.reset(0.0); + } } bool AudioPluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const @@ -372,8 +293,6 @@ juce::AudioProcessorValueTreeState::ParameterLayout AudioPluginAudioProcessor::c //============================================================================== void AudioPluginAudioProcessor::getStateInformation (juce::MemoryBlock& destData) { - // auto apvts = parameters.getAPVTS(); - // You should use this method to store your parameters in the memory block. // You could do that either as raw data, or use the XML or ValueTree classes // as intermediaries to make it easy to save and load complex data. diff --git a/src/StoneyDSP/Biquads/Wrapper.cpp b/src/StoneyDSP/Biquads/Wrapper.cpp index 2dab11a..614ed2e 100644 --- a/src/StoneyDSP/Biquads/Wrapper.cpp +++ b/src/StoneyDSP/Biquads/Wrapper.cpp @@ -36,36 +36,35 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A , state(apvts) , setup(spec) -, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) -, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) -, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) -, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) -, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) - -, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) -, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) -, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) -, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) -, biquadsATypePtr(dynamic_cast (apvts.getParameter("Band_A_typeID"))) - -, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) -, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) -, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) -, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) -, biquadsBTypePtr(dynamic_cast (apvts.getParameter("Band_B_typeID"))) - -, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) -, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) -, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) -, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) -, biquadsCTypePtr(dynamic_cast (apvts.getParameter("Band_C_typeID"))) - -, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) -, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) -, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) -, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) -, biquadsDTypePtr(dynamic_cast (apvts.getParameter("Band_D_typeID"))) - +, masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) +, masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) +, masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) +, masterOsPtr (dynamic_cast (apvts.getParameter("Master_osID"))) +, masterTransformPtr (dynamic_cast (apvts.getParameter("Master_transformID"))) + +, biquadsABypassPtr (dynamic_cast (apvts.getParameter("Band_A_bypassID"))) +, biquadsAFrequencyPtr (dynamic_cast (apvts.getParameter("Band_A_frequencyID"))) +, biquadsAResonancePtr (dynamic_cast (apvts.getParameter("Band_A_resonanceID"))) +, biquadsAGainPtr (dynamic_cast (apvts.getParameter("Band_A_gainID"))) +, biquadsATypePtr (dynamic_cast (apvts.getParameter("Band_A_typeID"))) + +, biquadsBBypassPtr (dynamic_cast (apvts.getParameter("Band_B_bypassID"))) +, biquadsBFrequencyPtr (dynamic_cast (apvts.getParameter("Band_B_frequencyID"))) +, biquadsBResonancePtr (dynamic_cast (apvts.getParameter("Band_B_resonanceID"))) +, biquadsBGainPtr (dynamic_cast (apvts.getParameter("Band_B_gainID"))) +, biquadsBTypePtr (dynamic_cast (apvts.getParameter("Band_B_typeID"))) + +, biquadsCBypassPtr (dynamic_cast (apvts.getParameter("Band_C_bypassID"))) +, biquadsCFrequencyPtr (dynamic_cast (apvts.getParameter("Band_C_frequencyID"))) +, biquadsCResonancePtr (dynamic_cast (apvts.getParameter("Band_C_resonanceID"))) +, biquadsCGainPtr (dynamic_cast (apvts.getParameter("Band_C_gainID"))) +, biquadsCTypePtr (dynamic_cast (apvts.getParameter("Band_C_typeID"))) + +, biquadsDBypassPtr (dynamic_cast (apvts.getParameter("Band_D_bypassID"))) +, biquadsDFrequencyPtr (dynamic_cast (apvts.getParameter("Band_D_frequencyID"))) +, biquadsDResonancePtr (dynamic_cast (apvts.getParameter("Band_D_resonanceID"))) +, biquadsDGainPtr (dynamic_cast (apvts.getParameter("Band_D_gainID"))) +, biquadsDTypePtr (dynamic_cast (apvts.getParameter("Band_D_typeID"))) , bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) , mixer() @@ -74,38 +73,37 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A , biquadsC() , biquadsD() { - - masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); - masterOutputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); - masterMixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); - masterOsPtr = dynamic_cast (apvts.getParameter("Master_osID")); - masterTransformPtr = dynamic_cast (apvts.getParameter("Master_transformID")); - - biquadsABypassPtr = dynamic_cast (apvts.getParameter("Band_A_bypassID")); - biquadsAFrequencyPtr = dynamic_cast (apvts.getParameter("Band_A_frequencyID")); - biquadsAResonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); - biquadsAGainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); - biquadsATypePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); - - biquadsBBypassPtr = dynamic_cast (apvts.getParameter("Band_B_bypassID")); - biquadsBFrequencyPtr = dynamic_cast (apvts.getParameter("Band_B_frequencyID")); - biquadsBResonancePtr = dynamic_cast (apvts.getParameter("Band_B_resonanceID")); - biquadsBGainPtr = dynamic_cast (apvts.getParameter("Band_B_gainID")); - biquadsBTypePtr = dynamic_cast (apvts.getParameter("Band_B_typeID")); - - biquadsCBypassPtr = dynamic_cast (apvts.getParameter("Band_C_bypassID")); - biquadsCFrequencyPtr = dynamic_cast (apvts.getParameter("Band_C_frequencyID")); - biquadsCResonancePtr = dynamic_cast (apvts.getParameter("Band_C_resonanceID")); - biquadsCGainPtr = dynamic_cast (apvts.getParameter("Band_C_gainID")); - biquadsCTypePtr = dynamic_cast (apvts.getParameter("Band_C_typeID")); - - biquadsDBypassPtr = dynamic_cast (apvts.getParameter("Band_D_bypassID")); - biquadsDFrequencyPtr = dynamic_cast (apvts.getParameter("Band_D_frequencyID")); - biquadsDResonancePtr = dynamic_cast (apvts.getParameter("Band_D_resonanceID")); - biquadsDGainPtr = dynamic_cast (apvts.getParameter("Band_D_gainID")); - biquadsDTypePtr = dynamic_cast (apvts.getParameter("Band_D_typeID")); - - bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); + masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); + masterOutputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); + masterMixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); + masterOsPtr = dynamic_cast (apvts.getParameter("Master_osID")); + masterTransformPtr = dynamic_cast (apvts.getParameter("Master_transformID")); + + biquadsABypassPtr = dynamic_cast (apvts.getParameter("Band_A_bypassID")); + biquadsAFrequencyPtr = dynamic_cast (apvts.getParameter("Band_A_frequencyID")); + biquadsAResonancePtr = dynamic_cast (apvts.getParameter("Band_A_resonanceID")); + biquadsAGainPtr = dynamic_cast (apvts.getParameter("Band_A_gainID")); + biquadsATypePtr = dynamic_cast (apvts.getParameter("Band_A_typeID")); + + biquadsBBypassPtr = dynamic_cast (apvts.getParameter("Band_B_bypassID")); + biquadsBFrequencyPtr = dynamic_cast (apvts.getParameter("Band_B_frequencyID")); + biquadsBResonancePtr = dynamic_cast (apvts.getParameter("Band_B_resonanceID")); + biquadsBGainPtr = dynamic_cast (apvts.getParameter("Band_B_gainID")); + biquadsBTypePtr = dynamic_cast (apvts.getParameter("Band_B_typeID")); + + biquadsCBypassPtr = dynamic_cast (apvts.getParameter("Band_C_bypassID")); + biquadsCFrequencyPtr = dynamic_cast (apvts.getParameter("Band_C_frequencyID")); + biquadsCResonancePtr = dynamic_cast (apvts.getParameter("Band_C_resonanceID")); + biquadsCGainPtr = dynamic_cast (apvts.getParameter("Band_C_gainID")); + biquadsCTypePtr = dynamic_cast (apvts.getParameter("Band_C_typeID")); + + biquadsDBypassPtr = dynamic_cast (apvts.getParameter("Band_D_bypassID")); + biquadsDFrequencyPtr = dynamic_cast (apvts.getParameter("Band_D_frequencyID")); + biquadsDResonancePtr = dynamic_cast (apvts.getParameter("Band_D_resonanceID")); + biquadsDGainPtr = dynamic_cast (apvts.getParameter("Band_D_gainID")); + biquadsDTypePtr = dynamic_cast (apvts.getParameter("Band_D_typeID")); + + bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); jassert(masterBypassPtr != nullptr); jassert(masterOutputPtr != nullptr); From 53bf47daa5f3fb88ec4464b9189ea8592c2d6d53 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 02:27:40 +0100 Subject: [PATCH 08/21] Improved Projucer file --- Biquads.jucer | 138 +++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 130 insertions(+), 8 deletions(-) diff --git a/Biquads.jucer b/Biquads.jucer index e28cdc4..06a5432 100644 --- a/Biquads.jucer +++ b/Biquads.jucer @@ -2,23 +2,145 @@ + companyName="StoneyDSP" cppLanguageStandard="latest" version="1.2.2.156" + pluginAUMainType="'aufx'" pluginVST3Category="EQ,Fx" pluginFormats="buildAU,buildStandalone,buildVST3" + companyEmail="nathanjhood@googlemail.com" companyWebsite="https://stoneydsp.com" + pluginName="Biquads" pluginManufacturer="StoneyDSP" pluginManufacturerCode="Manu" + pluginCode="Jer3" bundleIdentifier="com.StoneyDSP.Biquads" pluginDesc="Simple two-pole equalizer with variable oversampling." + aaxIdentifier="com.StoneyDSP.Biquads" companyCopyright="Copyright (c) 2024 - Nathan J. Hood" + pluginAUExportPrefix="BiquadsAU" pluginAAXCategory="1" pluginVSTCategory="kPlugCategEffect"> + + + - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -35,7 +157,7 @@ + - From 0d0715349a22719f138c005d00570442b7d83123 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 02:30:16 +0100 Subject: [PATCH 09/21] Set default Biquads filer type to Peak mode --- modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp b/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp index 34bb13d..5e47982 100644 --- a/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp +++ b/modules/stoneydsp_audio/widgets/stoneydsp_Biquads.hpp @@ -180,7 +180,7 @@ class Biquads /** Coefficient calculation(s). */ StoneyDSP::Maths::Coefficient b_0, b_1, b_2, a_0, a_1, a_2; - filterType filterTypeParamValue = { filterType::lowPass2 }; + filterType filterTypeParamValue = { filterType::peak }; transformationType transformationParamValue = { transformationType::directFormIItransposed }; //============================================================================== From baa1dedba7d5b20c9a8415039080c036574d1bde Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 02:32:01 +0100 Subject: [PATCH 10/21] Ensured all linkage to JUCE is private to avoid copying during build --- CMakeLists.txt | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c91e17..efd6a13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,10 +47,11 @@ if (NOT DEFINED JUCE_VERSION) message (STATUS " Found JUCE v${JUCE_VERSION}...") endif () +option (STONEYDSP_BIQUADS_BUILD_TESTS "Collect Tracktion Pluginval and configure with CTest (requires and <7ZIP>)." ON) option (STONEYDSP_BIQUADS_TARGET_IS_INSTALLABLE "" OFF) -option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_CONFIG_FLAGS "" ON) -option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_LTO_FLAGS "" ON) -option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_WARNING_FLAGS "" ON) +option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_CONFIG_FLAGS "Link with juce::juce_recommended_config_flags." ON) +option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_LTO_FLAGS "Link with juce::juce_recommended_lto_flags." ON) +option (STONEYDSP_BIQUADS_USING_JUCE_RECOMMENDED_WARNING_FLAGS "Link with juce::juce_recommended_warning_flags." ON) set (STONEYDSP_BIQUADS_TARGETS "") @@ -67,13 +68,14 @@ set_directory_properties(PROPERTIES JUCE_COMPANY_NAME "StoneyDSP" JUCE_COMPANY_WEBSITE "https://stoneydsp.com" JUCE_COMPANY_EMAIL "nathanjhood@googlemail.com" - JUCE_COMPANY_COPYRIGHT "Copyright (c) 2024 - StoneyDSP " + JUCE_COMPANY_COPYRIGHT "Copyright (c) 2024 - Nathan J. Hood " ) #[=============================================================================[ # target: StoneyDSP::Biquads_Audio_Plugin_Dependencies #]=============================================================================] +# Note: all linkage MUST be marked PRIVATE add_library (Biquads_Audio_Plugin_Dependencies STATIC) add_library (StoneyDSP::Biquads_Audio_Plugin_Dependencies ALIAS Biquads_Audio_Plugin_Dependencies) @@ -145,6 +147,7 @@ set_target_properties(Biquads_Audio_Plugin_Dependencies PROPERTIES # target: StoneyDSP::Biquads_Audio_Plugin_Interface #]=============================================================================] +# Note: all linkage MUST be marked INTERFACE add_library (Biquads_Audio_Plugin_Interface INTERFACE) add_library (StoneyDSP::Biquads_Audio_Plugin_Interface ALIAS Biquads_Audio_Plugin_Interface) @@ -230,12 +233,10 @@ target_sources (Biquads_Audio_Plugin_Library "src/${STONEYDSP_BIQUADS_UNIT_EDITOR}.cpp" ) target_link_libraries (Biquads_Audio_Plugin_Library - PUBLIC - StoneyDSP::Biquads_Audio_Plugin_Dependencies -) -target_link_libraries (Biquads_Audio_Plugin_Library + PRIVATE + StoneyDSP::Biquads_Audio_Plugin_Dependencies # MUST be PRIVATE! INTERFACE - StoneyDSP::Biquads_Audio_Plugin_Interface + StoneyDSP::Biquads_Audio_Plugin_Interface # MUST be INTERFACE! ) target_compile_features(Biquads_Audio_Plugin_Library PRIVATE cxx_std_17) set_target_properties(Biquads_Audio_Plugin_Library PROPERTIES @@ -258,6 +259,14 @@ juce_add_plugin (Biquads_Audio_Plugin # ICON_SMALL ... VST3_AUTO_MANIFEST FALSE + BUNDLE_ID "com.StoneyDSP.Biquads" + + MICROPHONE_PERMISSION_ENABLED FALSE + CAMERA_PERMISSION_ENABLED FALSE + BLUETOOTH_PERMISSION_ENABLED FALSE + + VST2_CATEGORY "kPlugCategEffect" + VST3_CATEGORIES "Fx" "EQ" IS_SYNTH FALSE # Is this a synth or an effect? NEEDS_MIDI_INPUT FALSE # Does the plugin need midi input? @@ -265,13 +274,16 @@ juce_add_plugin (Biquads_Audio_Plugin IS_MIDI_EFFECT FALSE # Is this plugin a MIDI effect? EDITOR_WANTS_KEYBOARD_FOCUS FALSE # Does the editor need keyboard focus? COPY_PLUGIN_AFTER_BUILD FALSE # Should the plugin be installed to a default location after building? - PLUGIN_MANUFACTURER_CODE Sdsp # A four-character manufacturer id with at least one upper-case character - PLUGIN_CODE Biq0 # A unique four-character plugin id with exactly one upper-case character + PLUGIN_MANUFACTURER_CODE Manu # A four-character manufacturer id with at least one upper-case character + PLUGIN_CODE Jer3 # A unique four-character plugin id with exactly one upper-case character # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case FORMATS AU VST3 Standalone # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 PRODUCT_NAME "Biquads" # The name of the final executable, which can differ from the target name COMPANY_NAME "StoneyDSP" # Specify the name of the plugin's author + COMPANY_WEBSITE "https://stoneydsp.com" + COMPANY_EMAIL "nathanjhood@googlemail.com" + COMPANY_COPYRIGHT "Copyright (c) 2024 - Nathan J. Hood " ) if (CMAKE_MAJOR_VERSION GREATER_EQUAL 3 AND (CMAKE_MINOR_VERSION LESS 23)) @@ -293,12 +305,10 @@ target_sources (Biquads_Audio_Plugin ) target_link_libraries (Biquads_Audio_Plugin PRIVATE - StoneyDSP::Biquads_Audio_Plugin_Dependencies + StoneyDSP::Biquads_Audio_Plugin_Dependencies # MUST be PRIVATE! StoneyDSP::Biquads_Audio_Plugin_Library -) -target_link_libraries (Biquads_Audio_Plugin INTERFACE - StoneyDSP::Biquads_Audio_Plugin_Interface + StoneyDSP::Biquads_Audio_Plugin_Interface # MUST be INTERFACE! ) list (APPEND STONEYDSP_BIQUADS_TARGETS Biquads_Audio_Plugin_Dependencies) @@ -307,16 +317,14 @@ list (APPEND STONEYDSP_BIQUADS_TARGETS Biquads_Audio_Plugin_Dependencies) # Helpers #]=============================================================================] -juce_generate_juce_header (Biquads_Audio_Plugin) +juce_generate_juce_header (Biquads_Audio_Plugin) -juce_enable_vst3_manifest_step (Biquads_Audio_Plugin) +juce_enable_vst3_manifest_step (Biquads_Audio_Plugin) #[=============================================================================[ # CTest configuration #]=============================================================================] -option (STONEYDSP_BIQUADS_BUILD_TESTS "Build tests" ON) - if (STONEYDSP_BIQUADS_BUILD_TESTS AND (STONEYDSP_BIQUADS_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)) enable_testing () add_subdirectory (tests) From 0aa4e01b0036deb8cf155dde9863cbcb0e63b534 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 03:50:17 +0100 Subject: [PATCH 11/21] Removed submodules - sticking to vcpkg for now --- .gitmodules | 6 ------ .vscode/settings.json | 2 +- VERSION | 2 +- modules/JUCE | 1 - modules/StoneyDSP | 1 - package.json | 6 +++--- vcpkg.json | 2 +- 7 files changed, 6 insertions(+), 14 deletions(-) delete mode 160000 modules/JUCE delete mode 160000 modules/StoneyDSP diff --git a/.gitmodules b/.gitmodules index ec15c49..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +0,0 @@ -[submodule "modules/StoneyDSP"] - path = modules/StoneyDSP - url = https://github.com/StoneyDSP/StoneyDSP -[submodule "modules/JUCE"] - path = modules/JUCE - url = https://github.com/juce-framework/JUCE.git diff --git a/.vscode/settings.json b/.vscode/settings.json index e18f551..986ebad 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -136,7 +136,7 @@ }, "C_Cpp.files.exclude": { - // "**/.bak": true, + "**/.bak": true, "**/.bash_history": true, "**/.bash_logout": true, "**/.bash_profile": true, diff --git a/VERSION b/VERSION index 2920957..6ffc7f7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2.154 +1.2.2.160 diff --git a/modules/JUCE b/modules/JUCE deleted file mode 160000 index a8ae6ed..0000000 --- a/modules/JUCE +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a8ae6edda6d3be78a139ec5e429dc57ef047e82a diff --git a/modules/StoneyDSP b/modules/StoneyDSP deleted file mode 160000 index 9548e94..0000000 --- a/modules/StoneyDSP +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9548e94f7e8ed375c6936e70ee9280fd812d95ec diff --git a/package.json b/package.json index 67888e3..2ea289a 100644 --- a/package.json +++ b/package.json @@ -14,15 +14,15 @@ "readme": "https://github.com/nathanjhood/Biquads/README.md", "license": "GPL-3.0", "scripts": { - "configure": "cmake -S . -B ./build -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE -DSTONEYDSP_BIQUADS_BUILD_EXTRAS:BOOL=TRUE -DSTONEYDSP_BIQUADS_BUILD_EXAMPLES:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=./install -GNinja", - "reconfigure": "cmake --fresh -S . -B ./build -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE -DSTONEYDSP_BIQUADS_BUILD_EXTRAS:BOOL=TRUE -DSTONEYDSP_BIQUADS_BUILD_EXAMPLES:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=./install -GNinja", + "configure": "cmake -S . -B ./build -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=./install -G Ninja", + "reconfigure": "cmake --fresh -S . -B ./build -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:PATH=./install -G Ninja", "build": "cmake --build ./build", "postbuild": "cmake --install ./build", "ctest": "ctest --test-dir ./build --rerun-failed --output-on-failure --verbose", "cpack": "cpack --config ./build/CPackSourceConfig.cmake -B ./install", "cdist": "cpack --config ./build/CPackConfig.cmake -B ./install", - "sys:config": "cmake --fresh -S . -B ./build -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE -DSTONEYDSP_BIQUADS_BUILD_EXTRAS:BOOL=TRUE -DSTONEYDSP_BIQUADS_BUILD_EXAMPLES:BOOL=TRUE -GNinja", + "sys:config": "cmake --fresh -S . -B ./build -DSTONEYDSP_BIQUADS_BUILD_TESTS:BOOL=TRUE -GNinja", "sys:install": "cmake --build ./build && cmake --build ./build --target install" }, "engines": { diff --git a/vcpkg.json b/vcpkg.json index 25731e1..53eb312 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "stoneydsp-biquads", - "version": "1.2.2.151", + "version": "1.2.2.156", "homepage": "https://github.com/Stoneydsp/Biquads", "maintainers": [ "Nathan J. Hood " From 6a860770f33beb3edb2e71205cf58969bf0a61f1 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 04:27:13 +0100 Subject: [PATCH 12/21] Update ubuntu-latest.yaml - use repository env var for version number control Signed-off-by: Nathan --- .github/workflows/ubuntu-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-latest.yaml b/.github/workflows/ubuntu-latest.yaml index 72dee75..deafa52 100644 --- a/.github/workflows/ubuntu-latest.yaml +++ b/.github/workflows/ubuntu-latest.yaml @@ -19,7 +19,7 @@ env: CMAKE_BUILD_PARALLEL_LEVEL: 3 # Use up to 3 cpus to build juceaide, etc VCPKG_MAX_CONCURRENCY: 3 SCCACHE_GHA_ENABLED: "true" - STONEYDSP_BIQUADS_CURRENT_VERSION: 1.2.1 + STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 jobs: From 8137cd455982aef78083414f2d7870ea8ab2409d Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 04:34:11 +0100 Subject: [PATCH 13/21] Update windows-latest.yaml Signed-off-by: Nathan --- .github/workflows/windows-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-latest.yaml b/.github/workflows/windows-latest.yaml index c340cd9..bff3501 100644 --- a/.github/workflows/windows-latest.yaml +++ b/.github/workflows/windows-latest.yaml @@ -20,7 +20,7 @@ env: VCPKG_MAX_CONCURRENCY: 3 SCCACHE_GHA_ENABLED: "true" IPP_DIR: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\lib\cmake\ipp - STONEYDSP_BIQUADS_CURRENT_VERSION: 1.2.1 + STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 jobs: From 7bf8f0282748439058b40287a8bbd0e1c32e2176 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 04:34:28 +0100 Subject: [PATCH 14/21] Update windows-latest.yaml Signed-off-by: Nathan --- .github/workflows/windows-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-latest.yaml b/.github/workflows/windows-latest.yaml index bff3501..e75c858 100644 --- a/.github/workflows/windows-latest.yaml +++ b/.github/workflows/windows-latest.yaml @@ -20,7 +20,7 @@ env: VCPKG_MAX_CONCURRENCY: 3 SCCACHE_GHA_ENABLED: "true" IPP_DIR: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\lib\cmake\ipp - STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} + STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 jobs: From 607b3631c63f3c3d5b04836b3cb3d9ce6105bdd1 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 04:35:30 +0100 Subject: [PATCH 15/21] Update macos-latest.yaml Signed-off-by: Nathan --- .github/workflows/macos-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos-latest.yaml b/.github/workflows/macos-latest.yaml index b5ebc4e..973c34d 100644 --- a/.github/workflows/macos-latest.yaml +++ b/.github/workflows/macos-latest.yaml @@ -22,7 +22,7 @@ env: SCCACHE_GHA_ENABLED: "true" SCCACHE_CACHE_MULTIARCH: 1 # for macos actions only! HOMEBREW_NO_INSTALL_CLEANUP: 1 - STONEYDSP_BIQUADS_CURRENT_VERSION: 1.2.1 + STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 jobs: From e31f5010cb2dce79b2277cf96a98819a4546113f Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 04:36:50 +0100 Subject: [PATCH 16/21] Update macos-arm-latest.yaml Signed-off-by: Nathan --- .github/workflows/macos-arm-latest.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/macos-arm-latest.yaml b/.github/workflows/macos-arm-latest.yaml index c1c74f7..9361805 100644 --- a/.github/workflows/macos-arm-latest.yaml +++ b/.github/workflows/macos-arm-latest.yaml @@ -22,8 +22,8 @@ env: SCCACHE_GHA_ENABLED: "true" SCCACHE_CACHE_MULTIARCH: 1 # for macos actions only! HOMEBREW_NO_INSTALL_CLEANUP: 1 - STONEYDSP_BIQUADS_CURRENT_VERSION: 1.2.1 - STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 + STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} + STONEYDSP_CURRENT_JUCE_VERSION: ${{ vars.STONEYDSP_BIQUADS_JUCE_VERSION_CURRENT_MAJOR_MINOR_PATCH }} jobs: macos-arm: From 4f887b55cf944ecbaa3bfbe25cf6c6cc5ad44e5c Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 05:45:00 +0100 Subject: [PATCH 17/21] Added 'JuceLibraryCode' --- .gitignore | 4 +- .vscode/c_cpp_properties.json | 6 +- JuceLibraryCode/AppConfig.h | 353 ++++++++++++++++++ JuceLibraryCode/JuceHeader.h | 52 +++ JuceLibraryCode/JucePluginDefines.h | 162 ++++++++ JuceLibraryCode/ReadMe.txt | 12 + JuceLibraryCode/include_juce_audio_basics.cpp | 9 + JuceLibraryCode/include_juce_audio_basics.mm | 9 + .../include_juce_audio_devices.cpp | 9 + JuceLibraryCode/include_juce_audio_devices.mm | 9 + .../include_juce_audio_formats.cpp | 9 + JuceLibraryCode/include_juce_audio_formats.mm | 9 + .../include_juce_audio_plugin_client_AAX.cpp | 9 + .../include_juce_audio_plugin_client_AAX.mm | 9 + ...ude_juce_audio_plugin_client_AAX_utils.cpp | 9 + .../include_juce_audio_plugin_client_ARA.cpp | 9 + .../include_juce_audio_plugin_client_AU_1.mm | 9 + .../include_juce_audio_plugin_client_AU_2.mm | 9 + .../include_juce_audio_plugin_client_AUv3.mm | 9 + .../include_juce_audio_plugin_client_LV2.cpp | 9 + .../include_juce_audio_plugin_client_LV2.mm | 9 + ...de_juce_audio_plugin_client_Standalone.cpp | 9 + ...include_juce_audio_plugin_client_Unity.cpp | 9 + .../include_juce_audio_plugin_client_VST2.cpp | 9 + .../include_juce_audio_plugin_client_VST2.mm | 9 + .../include_juce_audio_plugin_client_VST3.cpp | 9 + .../include_juce_audio_plugin_client_VST3.mm | 9 + .../include_juce_audio_processors.cpp | 9 + .../include_juce_audio_processors.mm | 9 + .../include_juce_audio_processors_ara.cpp | 9 + ...include_juce_audio_processors_lv2_libs.cpp | 9 + JuceLibraryCode/include_juce_audio_utils.cpp | 9 + JuceLibraryCode/include_juce_audio_utils.mm | 9 + JuceLibraryCode/include_juce_core.cpp | 9 + JuceLibraryCode/include_juce_core.mm | 9 + .../include_juce_data_structures.cpp | 9 + .../include_juce_data_structures.mm | 9 + JuceLibraryCode/include_juce_dsp.cpp | 9 + JuceLibraryCode/include_juce_dsp.mm | 9 + JuceLibraryCode/include_juce_events.cpp | 9 + JuceLibraryCode/include_juce_events.mm | 9 + JuceLibraryCode/include_juce_graphics.cpp | 9 + JuceLibraryCode/include_juce_graphics.mm | 9 + JuceLibraryCode/include_juce_gui_basics.cpp | 9 + JuceLibraryCode/include_juce_gui_basics.mm | 9 + JuceLibraryCode/include_juce_gui_extra.cpp | 9 + JuceLibraryCode/include_juce_gui_extra.mm | 9 + JuceLibraryCode/include_stoneydsp_audio.cpp | 9 + JuceLibraryCode/include_stoneydsp_audio.mm | 9 + JuceLibraryCode/include_stoneydsp_core.cpp | 9 + JuceLibraryCode/include_stoneydsp_core.mm | 9 + VERSION | 2 +- 52 files changed, 991 insertions(+), 5 deletions(-) create mode 100644 JuceLibraryCode/AppConfig.h create mode 100644 JuceLibraryCode/JuceHeader.h create mode 100644 JuceLibraryCode/JucePluginDefines.h create mode 100644 JuceLibraryCode/ReadMe.txt create mode 100644 JuceLibraryCode/include_juce_audio_basics.cpp create mode 100644 JuceLibraryCode/include_juce_audio_basics.mm create mode 100644 JuceLibraryCode/include_juce_audio_devices.cpp create mode 100644 JuceLibraryCode/include_juce_audio_devices.mm create mode 100644 JuceLibraryCode/include_juce_audio_formats.cpp create mode 100644 JuceLibraryCode/include_juce_audio_formats.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_AAX.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_AAX.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_AAX_utils.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_ARA.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_AU_1.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_AU_2.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_LV2.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_LV2.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_Standalone.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_Unity.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_VST2.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_VST2.mm create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_VST3.cpp create mode 100644 JuceLibraryCode/include_juce_audio_plugin_client_VST3.mm create mode 100644 JuceLibraryCode/include_juce_audio_processors.cpp create mode 100644 JuceLibraryCode/include_juce_audio_processors.mm create mode 100644 JuceLibraryCode/include_juce_audio_processors_ara.cpp create mode 100644 JuceLibraryCode/include_juce_audio_processors_lv2_libs.cpp create mode 100644 JuceLibraryCode/include_juce_audio_utils.cpp create mode 100644 JuceLibraryCode/include_juce_audio_utils.mm create mode 100644 JuceLibraryCode/include_juce_core.cpp create mode 100644 JuceLibraryCode/include_juce_core.mm create mode 100644 JuceLibraryCode/include_juce_data_structures.cpp create mode 100644 JuceLibraryCode/include_juce_data_structures.mm create mode 100644 JuceLibraryCode/include_juce_dsp.cpp create mode 100644 JuceLibraryCode/include_juce_dsp.mm create mode 100644 JuceLibraryCode/include_juce_events.cpp create mode 100644 JuceLibraryCode/include_juce_events.mm create mode 100644 JuceLibraryCode/include_juce_graphics.cpp create mode 100644 JuceLibraryCode/include_juce_graphics.mm create mode 100644 JuceLibraryCode/include_juce_gui_basics.cpp create mode 100644 JuceLibraryCode/include_juce_gui_basics.mm create mode 100644 JuceLibraryCode/include_juce_gui_extra.cpp create mode 100644 JuceLibraryCode/include_juce_gui_extra.mm create mode 100644 JuceLibraryCode/include_stoneydsp_audio.cpp create mode 100644 JuceLibraryCode/include_stoneydsp_audio.mm create mode 100644 JuceLibraryCode/include_stoneydsp_core.cpp create mode 100644 JuceLibraryCode/include_stoneydsp_core.mm diff --git a/.gitignore b/.gitignore index d96d5c3..3771be5 100644 --- a/.gitignore +++ b/.gitignore @@ -66,8 +66,8 @@ contents.xcworkspacedata .svn enc_temp_folder/ **/Builds/ -**/JuceLibraryCode/ -!**/JuceLibraryCode/AppConfig.h +# **/JuceLibraryCode/ +# !**/JuceLibraryCode/AppConfig.h install/testresults.txt **/bin **/tmp diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index d99d5c8..a62b393 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -3,8 +3,9 @@ { "name": "GCC 11.4.0 x86_64-linux-gnu", "includePath": [ - "${workspaceFolder}/include/**", "${workspaceFolder}/modules/**", + "${workspaceFolder}/JuceLibraryCode/**", + "${workspaceFolder}/include/**", ], "defines": [], "compilerPath": "/usr/bin/gcc", @@ -18,8 +19,9 @@ { "name": "Clang 14.0.0 x86_64-pc-linux-gnu", "includePath": [ - "${workspaceFolder}/include/**", "${workspaceFolder}/modules/**", + "${workspaceFolder}/JuceLibraryCode/**", + "${workspaceFolder}/include/**", ], "defines": [], "compilerPath": "/usr/bin/clang", diff --git a/JuceLibraryCode/AppConfig.h b/JuceLibraryCode/AppConfig.h new file mode 100644 index 0000000..6016c2e --- /dev/null +++ b/JuceLibraryCode/AppConfig.h @@ -0,0 +1,353 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + + There's a section below where you can add your own custom code safely, and the + Projucer will preserve the contents of that block, but the best way to change + any of these definitions is by using the Projucer's project settings. + + Any commented-out settings will assume their default values. + +*/ + +#pragma once + +//============================================================================== +// [BEGIN_USER_CODE_SECTION] + +// (You can add your own code in this section, and the Projucer will not overwrite it) + +// [END_USER_CODE_SECTION] + +#include "JucePluginDefines.h" + +/* + ============================================================================== + + In accordance with the terms of the JUCE 7 End-Use License Agreement, the + JUCE Code in SECTION A cannot be removed, changed or otherwise rendered + ineffective unless you have a JUCE Indie or Pro license, or are using JUCE + under the GPL v3 license. + + End User License Agreement: www.juce.com/juce-7-licence + + ============================================================================== +*/ + +// BEGIN SECTION A + +#ifndef JUCE_DISPLAY_SPLASH_SCREEN + #define JUCE_DISPLAY_SPLASH_SCREEN 1 +#endif + +// END SECTION A + +#define JUCE_USE_DARK_SPLASH_SCREEN 1 + +#define JUCE_PROJUCER_VERSION 0x70007 + +//============================================================================== +#define JUCE_MODULE_AVAILABLE_juce_audio_basics 1 +#define JUCE_MODULE_AVAILABLE_juce_audio_devices 1 +#define JUCE_MODULE_AVAILABLE_juce_audio_formats 1 +#define JUCE_MODULE_AVAILABLE_juce_audio_plugin_client 1 +#define JUCE_MODULE_AVAILABLE_juce_audio_processors 1 +#define JUCE_MODULE_AVAILABLE_juce_audio_utils 1 +#define JUCE_MODULE_AVAILABLE_juce_core 1 +#define JUCE_MODULE_AVAILABLE_juce_data_structures 1 +#define JUCE_MODULE_AVAILABLE_juce_dsp 1 +#define JUCE_MODULE_AVAILABLE_juce_events 1 +#define JUCE_MODULE_AVAILABLE_juce_graphics 1 +#define JUCE_MODULE_AVAILABLE_juce_gui_basics 1 +#define JUCE_MODULE_AVAILABLE_juce_gui_extra 1 +#define JUCE_MODULE_AVAILABLE_stoneydsp_audio 1 +#define JUCE_MODULE_AVAILABLE_stoneydsp_core 1 + +#define JUCE_GLOBAL_MODULE_SETTINGS_INCLUDED 1 + +//============================================================================== +// juce_audio_devices flags: + +#ifndef JUCE_USE_WINRT_MIDI + //#define JUCE_USE_WINRT_MIDI 0 +#endif + +#ifndef JUCE_ASIO + //#define JUCE_ASIO 0 +#endif + +#ifndef JUCE_WASAPI + //#define JUCE_WASAPI 1 +#endif + +#ifndef JUCE_DIRECTSOUND + //#define JUCE_DIRECTSOUND 1 +#endif + +#ifndef JUCE_ALSA + //#define JUCE_ALSA 1 +#endif + +#ifndef JUCE_JACK + //#define JUCE_JACK 0 +#endif + +#ifndef JUCE_BELA + //#define JUCE_BELA 0 +#endif + +#ifndef JUCE_USE_ANDROID_OBOE + //#define JUCE_USE_ANDROID_OBOE 1 +#endif + +#ifndef JUCE_USE_OBOE_STABILIZED_CALLBACK + //#define JUCE_USE_OBOE_STABILIZED_CALLBACK 0 +#endif + +#ifndef JUCE_USE_ANDROID_OPENSLES + //#define JUCE_USE_ANDROID_OPENSLES 0 +#endif + +#ifndef JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS + //#define JUCE_DISABLE_AUDIO_MIXING_WITH_OTHER_APPS 0 +#endif + +//============================================================================== +// juce_audio_formats flags: + +#ifndef JUCE_USE_FLAC + //#define JUCE_USE_FLAC 1 +#endif + +#ifndef JUCE_USE_OGGVORBIS + //#define JUCE_USE_OGGVORBIS 1 +#endif + +#ifndef JUCE_USE_MP3AUDIOFORMAT + //#define JUCE_USE_MP3AUDIOFORMAT 0 +#endif + +#ifndef JUCE_USE_LAME_AUDIO_FORMAT + //#define JUCE_USE_LAME_AUDIO_FORMAT 0 +#endif + +#ifndef JUCE_USE_WINDOWS_MEDIA_FORMAT + //#define JUCE_USE_WINDOWS_MEDIA_FORMAT 1 +#endif + +//============================================================================== +// juce_audio_plugin_client flags: + +#ifndef JUCE_VST3_CAN_REPLACE_VST2 + #define JUCE_VST3_CAN_REPLACE_VST2 0 +#endif + +#ifndef JUCE_FORCE_USE_LEGACY_PARAM_IDS + //#define JUCE_FORCE_USE_LEGACY_PARAM_IDS 0 +#endif + +#ifndef JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE + //#define JUCE_FORCE_LEGACY_PARAMETER_AUTOMATION_TYPE 0 +#endif + +#ifndef JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS + //#define JUCE_USE_STUDIO_ONE_COMPATIBLE_PARAMETERS 1 +#endif + +#ifndef JUCE_AU_WRAPPERS_SAVE_PROGRAM_STATES + //#define JUCE_AU_WRAPPERS_SAVE_PROGRAM_STATES 0 +#endif + +#ifndef JUCE_STANDALONE_FILTER_WINDOW_USE_KIOSK_MODE + //#define JUCE_STANDALONE_FILTER_WINDOW_USE_KIOSK_MODE 0 +#endif + +//============================================================================== +// juce_audio_processors flags: + +#ifndef JUCE_PLUGINHOST_VST + //#define JUCE_PLUGINHOST_VST 0 +#endif + +#ifndef JUCE_PLUGINHOST_VST3 + //#define JUCE_PLUGINHOST_VST3 0 +#endif + +#ifndef JUCE_PLUGINHOST_AU + //#define JUCE_PLUGINHOST_AU 0 +#endif + +#ifndef JUCE_PLUGINHOST_LADSPA + //#define JUCE_PLUGINHOST_LADSPA 0 +#endif + +#ifndef JUCE_PLUGINHOST_LV2 + //#define JUCE_PLUGINHOST_LV2 0 +#endif + +#ifndef JUCE_PLUGINHOST_ARA + //#define JUCE_PLUGINHOST_ARA 0 +#endif + +#ifndef JUCE_CUSTOM_VST3_SDK + //#define JUCE_CUSTOM_VST3_SDK 0 +#endif + +//============================================================================== +// juce_audio_utils flags: + +#ifndef JUCE_USE_CDREADER + //#define JUCE_USE_CDREADER 0 +#endif + +#ifndef JUCE_USE_CDBURNER + //#define JUCE_USE_CDBURNER 0 +#endif + +//============================================================================== +// juce_core flags: + +#ifndef JUCE_FORCE_DEBUG + //#define JUCE_FORCE_DEBUG 0 +#endif + +#ifndef JUCE_LOG_ASSERTIONS + //#define JUCE_LOG_ASSERTIONS 0 +#endif + +#ifndef JUCE_CHECK_MEMORY_LEAKS + //#define JUCE_CHECK_MEMORY_LEAKS 1 +#endif + +#ifndef JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES + //#define JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES 0 +#endif + +#ifndef JUCE_INCLUDE_ZLIB_CODE + //#define JUCE_INCLUDE_ZLIB_CODE 1 +#endif + +#ifndef JUCE_USE_CURL + //#define JUCE_USE_CURL 1 +#endif + +#ifndef JUCE_LOAD_CURL_SYMBOLS_LAZILY + //#define JUCE_LOAD_CURL_SYMBOLS_LAZILY 0 +#endif + +#ifndef JUCE_CATCH_UNHANDLED_EXCEPTIONS + //#define JUCE_CATCH_UNHANDLED_EXCEPTIONS 0 +#endif + +#ifndef JUCE_ALLOW_STATIC_NULL_VARIABLES + //#define JUCE_ALLOW_STATIC_NULL_VARIABLES 0 +#endif + +#ifndef JUCE_STRICT_REFCOUNTEDPOINTER + #define JUCE_STRICT_REFCOUNTEDPOINTER 1 +#endif + +#ifndef JUCE_ENABLE_ALLOCATION_HOOKS + //#define JUCE_ENABLE_ALLOCATION_HOOKS 0 +#endif + +//============================================================================== +// juce_dsp flags: + +#ifndef JUCE_ASSERTION_FIRFILTER + //#define JUCE_ASSERTION_FIRFILTER 1 +#endif + +#ifndef JUCE_DSP_USE_INTEL_MKL + //#define JUCE_DSP_USE_INTEL_MKL 0 +#endif + +#ifndef JUCE_DSP_USE_SHARED_FFTW + //#define JUCE_DSP_USE_SHARED_FFTW 0 +#endif + +#ifndef JUCE_DSP_USE_STATIC_FFTW + //#define JUCE_DSP_USE_STATIC_FFTW 0 +#endif + +#ifndef JUCE_DSP_ENABLE_SNAP_TO_ZERO + //#define JUCE_DSP_ENABLE_SNAP_TO_ZERO 1 +#endif + +//============================================================================== +// juce_events flags: + +#ifndef JUCE_EXECUTE_APP_SUSPEND_ON_BACKGROUND_TASK + //#define JUCE_EXECUTE_APP_SUSPEND_ON_BACKGROUND_TASK 0 +#endif + +//============================================================================== +// juce_graphics flags: + +#ifndef JUCE_USE_COREIMAGE_LOADER + //#define JUCE_USE_COREIMAGE_LOADER 1 +#endif + +#ifndef JUCE_USE_DIRECTWRITE + //#define JUCE_USE_DIRECTWRITE 1 +#endif + +#ifndef JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING + //#define JUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING 0 +#endif + +//============================================================================== +// juce_gui_basics flags: + +#ifndef JUCE_ENABLE_REPAINT_DEBUGGING + //#define JUCE_ENABLE_REPAINT_DEBUGGING 0 +#endif + +#ifndef JUCE_USE_XRANDR + //#define JUCE_USE_XRANDR 1 +#endif + +#ifndef JUCE_USE_XINERAMA + //#define JUCE_USE_XINERAMA 1 +#endif + +#ifndef JUCE_USE_XSHM + //#define JUCE_USE_XSHM 1 +#endif + +#ifndef JUCE_USE_XRENDER + //#define JUCE_USE_XRENDER 0 +#endif + +#ifndef JUCE_USE_XCURSOR + //#define JUCE_USE_XCURSOR 1 +#endif + +#ifndef JUCE_WIN_PER_MONITOR_DPI_AWARE + //#define JUCE_WIN_PER_MONITOR_DPI_AWARE 1 +#endif + +//============================================================================== +// juce_gui_extra flags: + +#ifndef JUCE_WEB_BROWSER + //#define JUCE_WEB_BROWSER 1 +#endif + +#ifndef JUCE_USE_WIN_WEBVIEW2 + //#define JUCE_USE_WIN_WEBVIEW2 0 +#endif + +#ifndef JUCE_ENABLE_LIVE_CONSTANT_EDITOR + //#define JUCE_ENABLE_LIVE_CONSTANT_EDITOR 0 +#endif + +//============================================================================== +#ifndef JUCE_STANDALONE_APPLICATION + #if defined(JucePlugin_Name) && defined(JucePlugin_Build_Standalone) + #define JUCE_STANDALONE_APPLICATION JucePlugin_Build_Standalone + #else + #define JUCE_STANDALONE_APPLICATION 0 + #endif +#endif diff --git a/JuceLibraryCode/JuceHeader.h b/JuceLibraryCode/JuceHeader.h new file mode 100644 index 0000000..25692da --- /dev/null +++ b/JuceLibraryCode/JuceHeader.h @@ -0,0 +1,52 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + + This is the header file that your files should include in order to get all the + JUCE library headers. You should avoid including the JUCE headers directly in + your own source files, because that wouldn't pick up the correct configuration + options for your app. + +*/ + +#pragma once + +#include "AppConfig.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#if defined (JUCE_PROJUCER_VERSION) && JUCE_PROJUCER_VERSION < JUCE_VERSION + /** If you've hit this error then the version of the Projucer that was used to generate this project is + older than the version of the JUCE modules being included. To fix this error, re-save your project + using the latest version of the Projucer or, if you aren't using the Projucer to manage your project, + remove the JUCE_PROJUCER_VERSION define. + */ + #error "This project was last saved using an outdated version of the Projucer! Re-save this project with the latest version to fix this error." +#endif + + +#if ! JUCE_DONT_DECLARE_PROJECTINFO +namespace ProjectInfo +{ + const char* const projectName = "Biquads"; + const char* const companyName = "StoneyDSP"; + const char* const versionString = "1.2.2.156"; + const int versionNumber = 0x102029c; +} +#endif diff --git a/JuceLibraryCode/JucePluginDefines.h b/JuceLibraryCode/JucePluginDefines.h new file mode 100644 index 0000000..8155e3d --- /dev/null +++ b/JuceLibraryCode/JucePluginDefines.h @@ -0,0 +1,162 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#pragma once + +//============================================================================== +// Audio plugin settings.. + +#ifndef JucePlugin_Build_VST + #define JucePlugin_Build_VST 0 +#endif +#ifndef JucePlugin_Build_VST3 + #define JucePlugin_Build_VST3 1 +#endif +#ifndef JucePlugin_Build_AU + #define JucePlugin_Build_AU 1 +#endif +#ifndef JucePlugin_Build_AUv3 + #define JucePlugin_Build_AUv3 0 +#endif +#ifndef JucePlugin_Build_AAX + #define JucePlugin_Build_AAX 0 +#endif +#ifndef JucePlugin_Build_Standalone + #define JucePlugin_Build_Standalone 1 +#endif +#ifndef JucePlugin_Build_Unity + #define JucePlugin_Build_Unity 0 +#endif +#ifndef JucePlugin_Build_LV2 + #define JucePlugin_Build_LV2 0 +#endif +#ifndef JucePlugin_Enable_IAA + #define JucePlugin_Enable_IAA 0 +#endif +#ifndef JucePlugin_Enable_ARA + #define JucePlugin_Enable_ARA 0 +#endif +#ifndef JucePlugin_Name + #define JucePlugin_Name "Biquads" +#endif +#ifndef JucePlugin_Desc + #define JucePlugin_Desc "Simple two-pole equalizer with variable oversampling." +#endif +#ifndef JucePlugin_Manufacturer + #define JucePlugin_Manufacturer "StoneyDSP" +#endif +#ifndef JucePlugin_ManufacturerWebsite + #define JucePlugin_ManufacturerWebsite "https://stoneydsp.com" +#endif +#ifndef JucePlugin_ManufacturerEmail + #define JucePlugin_ManufacturerEmail "nathanjhood@googlemail.com" +#endif +#ifndef JucePlugin_ManufacturerCode + #define JucePlugin_ManufacturerCode 0x4d616e75 +#endif +#ifndef JucePlugin_PluginCode + #define JucePlugin_PluginCode 0x4a657233 +#endif +#ifndef JucePlugin_IsSynth + #define JucePlugin_IsSynth 0 +#endif +#ifndef JucePlugin_WantsMidiInput + #define JucePlugin_WantsMidiInput 0 +#endif +#ifndef JucePlugin_ProducesMidiOutput + #define JucePlugin_ProducesMidiOutput 0 +#endif +#ifndef JucePlugin_IsMidiEffect + #define JucePlugin_IsMidiEffect 0 +#endif +#ifndef JucePlugin_EditorRequiresKeyboardFocus + #define JucePlugin_EditorRequiresKeyboardFocus 0 +#endif +#ifndef JucePlugin_Version + #define JucePlugin_Version 1.2.2.156 +#endif +#ifndef JucePlugin_VersionCode + #define JucePlugin_VersionCode 0x102029c +#endif +#ifndef JucePlugin_VersionString + #define JucePlugin_VersionString "1.2.2.156" +#endif +#ifndef JucePlugin_VSTUniqueID + #define JucePlugin_VSTUniqueID JucePlugin_PluginCode +#endif +#ifndef JucePlugin_VSTCategory + #define JucePlugin_VSTCategory kPlugCategEffect +#endif +#ifndef JucePlugin_Vst3Category + #define JucePlugin_Vst3Category "Fx|EQ" +#endif +#ifndef JucePlugin_AUMainType + #define JucePlugin_AUMainType 'aufx' +#endif +#ifndef JucePlugin_AUSubType + #define JucePlugin_AUSubType JucePlugin_PluginCode +#endif +#ifndef JucePlugin_AUExportPrefix + #define JucePlugin_AUExportPrefix BiquadsAU +#endif +#ifndef JucePlugin_AUExportPrefixQuoted + #define JucePlugin_AUExportPrefixQuoted "BiquadsAU" +#endif +#ifndef JucePlugin_AUManufacturerCode + #define JucePlugin_AUManufacturerCode JucePlugin_ManufacturerCode +#endif +#ifndef JucePlugin_CFBundleIdentifier + #define JucePlugin_CFBundleIdentifier com.StoneyDSP.Biquads +#endif +#ifndef JucePlugin_AAXIdentifier + #define JucePlugin_AAXIdentifier com.StoneyDSP.Biquads +#endif +#ifndef JucePlugin_AAXManufacturerCode + #define JucePlugin_AAXManufacturerCode JucePlugin_ManufacturerCode +#endif +#ifndef JucePlugin_AAXProductId + #define JucePlugin_AAXProductId JucePlugin_PluginCode +#endif +#ifndef JucePlugin_AAXCategory + #define JucePlugin_AAXCategory 1 +#endif +#ifndef JucePlugin_AAXDisableBypass + #define JucePlugin_AAXDisableBypass 0 +#endif +#ifndef JucePlugin_AAXDisableMultiMono + #define JucePlugin_AAXDisableMultiMono 0 +#endif +#ifndef JucePlugin_IAAType + #define JucePlugin_IAAType 0x61757278 +#endif +#ifndef JucePlugin_IAASubType + #define JucePlugin_IAASubType JucePlugin_PluginCode +#endif +#ifndef JucePlugin_IAAName + #define JucePlugin_IAAName "StoneyDSP: Biquads" +#endif +#ifndef JucePlugin_VSTNumMidiInputs + #define JucePlugin_VSTNumMidiInputs 16 +#endif +#ifndef JucePlugin_VSTNumMidiOutputs + #define JucePlugin_VSTNumMidiOutputs 16 +#endif +#ifndef JucePlugin_ARAContentTypes + #define JucePlugin_ARAContentTypes 0 +#endif +#ifndef JucePlugin_ARATransformationFlags + #define JucePlugin_ARATransformationFlags 0 +#endif +#ifndef JucePlugin_ARAFactoryID + #define JucePlugin_ARAFactoryID "com.StoneyDSP.Biquads.factory" +#endif +#ifndef JucePlugin_ARADocumentArchiveID + #define JucePlugin_ARADocumentArchiveID "com.StoneyDSP.Biquads.aradocumentarchive.1.2.2.156" +#endif +#ifndef JucePlugin_ARACompatibleArchiveIDs + #define JucePlugin_ARACompatibleArchiveIDs "" +#endif diff --git a/JuceLibraryCode/ReadMe.txt b/JuceLibraryCode/ReadMe.txt new file mode 100644 index 0000000..091a5aa --- /dev/null +++ b/JuceLibraryCode/ReadMe.txt @@ -0,0 +1,12 @@ + + Important Note!! + ================ + +The purpose of this folder is to contain files that are auto-generated by the Projucer, +and ALL files in this folder will be mercilessly DELETED and completely re-written whenever +the Projucer saves your project. + +Therefore, it's a bad idea to make any manual changes to the files in here, or to +put any of your own files in here if you don't want to lose them. (Of course you may choose +to add the folder's contents to your version-control system so that you can re-merge your own +modifications after the Projucer has saved its changes). diff --git a/JuceLibraryCode/include_juce_audio_basics.cpp b/JuceLibraryCode/include_juce_audio_basics.cpp new file mode 100644 index 0000000..b949f56 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_basics.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_basics.mm b/JuceLibraryCode/include_juce_audio_basics.mm new file mode 100644 index 0000000..e0e6c57 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_basics.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_devices.cpp b/JuceLibraryCode/include_juce_audio_devices.cpp new file mode 100644 index 0000000..fb5c221 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_devices.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_devices.mm b/JuceLibraryCode/include_juce_audio_devices.mm new file mode 100644 index 0000000..e58b67e --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_devices.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_formats.cpp b/JuceLibraryCode/include_juce_audio_formats.cpp new file mode 100644 index 0000000..a3c6117 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_formats.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_formats.mm b/JuceLibraryCode/include_juce_audio_formats.mm new file mode 100644 index 0000000..f325b8f --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_formats.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_AAX.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_AAX.cpp new file mode 100644 index 0000000..c599b87 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_AAX.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_AAX.mm b/JuceLibraryCode/include_juce_audio_plugin_client_AAX.mm new file mode 100644 index 0000000..d4b8c31 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_AAX.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_AAX_utils.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_AAX_utils.cpp new file mode 100644 index 0000000..3f6dce3 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_AAX_utils.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_ARA.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_ARA.cpp new file mode 100644 index 0000000..8e7d3aa --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_ARA.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_AU_1.mm b/JuceLibraryCode/include_juce_audio_plugin_client_AU_1.mm new file mode 100644 index 0000000..a4fdf7f --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_AU_1.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_AU_2.mm b/JuceLibraryCode/include_juce_audio_plugin_client_AU_2.mm new file mode 100644 index 0000000..175b300 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_AU_2.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm b/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm new file mode 100644 index 0000000..0ac2b2f --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_LV2.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_LV2.cpp new file mode 100644 index 0000000..fa40c43 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_LV2.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_LV2.mm b/JuceLibraryCode/include_juce_audio_plugin_client_LV2.mm new file mode 100644 index 0000000..f1a5252 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_LV2.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_Standalone.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_Standalone.cpp new file mode 100644 index 0000000..d3b6529 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_Standalone.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_Unity.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_Unity.cpp new file mode 100644 index 0000000..6552559 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_Unity.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_VST2.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_VST2.cpp new file mode 100644 index 0000000..c35394b --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_VST2.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_VST2.mm b/JuceLibraryCode/include_juce_audio_plugin_client_VST2.mm new file mode 100644 index 0000000..6a889f6 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_VST2.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_VST3.cpp b/JuceLibraryCode/include_juce_audio_plugin_client_VST3.cpp new file mode 100644 index 0000000..8e2e5cd --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_VST3.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_plugin_client_VST3.mm b/JuceLibraryCode/include_juce_audio_plugin_client_VST3.mm new file mode 100644 index 0000000..f091a77 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_plugin_client_VST3.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_processors.cpp b/JuceLibraryCode/include_juce_audio_processors.cpp new file mode 100644 index 0000000..bfe172e --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_processors.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_processors.mm b/JuceLibraryCode/include_juce_audio_processors.mm new file mode 100644 index 0000000..b80ae90 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_processors.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_processors_ara.cpp b/JuceLibraryCode/include_juce_audio_processors_ara.cpp new file mode 100644 index 0000000..0568703 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_processors_ara.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_processors_lv2_libs.cpp b/JuceLibraryCode/include_juce_audio_processors_lv2_libs.cpp new file mode 100644 index 0000000..bb12ef5 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_processors_lv2_libs.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_utils.cpp b/JuceLibraryCode/include_juce_audio_utils.cpp new file mode 100644 index 0000000..97bd2c5 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_utils.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_audio_utils.mm b/JuceLibraryCode/include_juce_audio_utils.mm new file mode 100644 index 0000000..8eae7c6 --- /dev/null +++ b/JuceLibraryCode/include_juce_audio_utils.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_core.cpp b/JuceLibraryCode/include_juce_core.cpp new file mode 100644 index 0000000..d0ce163 --- /dev/null +++ b/JuceLibraryCode/include_juce_core.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_core.mm b/JuceLibraryCode/include_juce_core.mm new file mode 100644 index 0000000..72b10bf --- /dev/null +++ b/JuceLibraryCode/include_juce_core.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_data_structures.cpp b/JuceLibraryCode/include_juce_data_structures.cpp new file mode 100644 index 0000000..9315aa1 --- /dev/null +++ b/JuceLibraryCode/include_juce_data_structures.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_data_structures.mm b/JuceLibraryCode/include_juce_data_structures.mm new file mode 100644 index 0000000..695ec43 --- /dev/null +++ b/JuceLibraryCode/include_juce_data_structures.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_dsp.cpp b/JuceLibraryCode/include_juce_dsp.cpp new file mode 100644 index 0000000..430d943 --- /dev/null +++ b/JuceLibraryCode/include_juce_dsp.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_dsp.mm b/JuceLibraryCode/include_juce_dsp.mm new file mode 100644 index 0000000..1dea5d0 --- /dev/null +++ b/JuceLibraryCode/include_juce_dsp.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_events.cpp b/JuceLibraryCode/include_juce_events.cpp new file mode 100644 index 0000000..1bba110 --- /dev/null +++ b/JuceLibraryCode/include_juce_events.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_events.mm b/JuceLibraryCode/include_juce_events.mm new file mode 100644 index 0000000..4cc34fc --- /dev/null +++ b/JuceLibraryCode/include_juce_events.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_graphics.cpp b/JuceLibraryCode/include_juce_graphics.cpp new file mode 100644 index 0000000..319c76d --- /dev/null +++ b/JuceLibraryCode/include_juce_graphics.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_graphics.mm b/JuceLibraryCode/include_juce_graphics.mm new file mode 100644 index 0000000..b28e6dd --- /dev/null +++ b/JuceLibraryCode/include_juce_graphics.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_gui_basics.cpp b/JuceLibraryCode/include_juce_gui_basics.cpp new file mode 100644 index 0000000..216c76b --- /dev/null +++ b/JuceLibraryCode/include_juce_gui_basics.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_gui_basics.mm b/JuceLibraryCode/include_juce_gui_basics.mm new file mode 100644 index 0000000..6a9726f --- /dev/null +++ b/JuceLibraryCode/include_juce_gui_basics.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_gui_extra.cpp b/JuceLibraryCode/include_juce_gui_extra.cpp new file mode 100644 index 0000000..7226e19 --- /dev/null +++ b/JuceLibraryCode/include_juce_gui_extra.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_juce_gui_extra.mm b/JuceLibraryCode/include_juce_gui_extra.mm new file mode 100644 index 0000000..c9b6c3b --- /dev/null +++ b/JuceLibraryCode/include_juce_gui_extra.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_stoneydsp_audio.cpp b/JuceLibraryCode/include_stoneydsp_audio.cpp new file mode 100644 index 0000000..295c1ad --- /dev/null +++ b/JuceLibraryCode/include_stoneydsp_audio.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_stoneydsp_audio.mm b/JuceLibraryCode/include_stoneydsp_audio.mm new file mode 100644 index 0000000..4dff9b1 --- /dev/null +++ b/JuceLibraryCode/include_stoneydsp_audio.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_stoneydsp_core.cpp b/JuceLibraryCode/include_stoneydsp_core.cpp new file mode 100644 index 0000000..6f49c4d --- /dev/null +++ b/JuceLibraryCode/include_stoneydsp_core.cpp @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/JuceLibraryCode/include_stoneydsp_core.mm b/JuceLibraryCode/include_stoneydsp_core.mm new file mode 100644 index 0000000..d4e121d --- /dev/null +++ b/JuceLibraryCode/include_stoneydsp_core.mm @@ -0,0 +1,9 @@ +/* + + IMPORTANT! This file is auto-generated each time you save your + project - if you alter its contents, your changes may be overwritten! + +*/ + +#include "AppConfig.h" +#include diff --git a/VERSION b/VERSION index 6ffc7f7..4840c26 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2.160 +1.2.2.162 From 2f9061f1dbcc093d31775142cdc8ec1fbb1037f0 Mon Sep 17 00:00:00 2001 From: StoneyDSP Date: Sun, 17 Mar 2024 05:46:24 +0100 Subject: [PATCH 18/21] Prep to move APVTS over to Parameters target object --- include/StoneyDSP/Biquads/Wrapper.hpp | 11 ++++++++--- src/StoneyDSP/Biquads/Parameters.cpp | 4 ++-- src/StoneyDSP/Biquads/Wrapper.cpp | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/StoneyDSP/Biquads/Wrapper.hpp b/include/StoneyDSP/Biquads/Wrapper.hpp index 1570071..e137b62 100644 --- a/include/StoneyDSP/Biquads/Wrapper.hpp +++ b/include/StoneyDSP/Biquads/Wrapper.hpp @@ -22,9 +22,16 @@ ******************************************************************************/ -#ifndef STONEYDSP_BIQUADS_WRAPPER_HPP_INCLUDED +#pragma once #define STONEYDSP_BIQUADS_WRAPPER_HPP_INCLUDED +// #include +// #include +// #include +// #include +// #include +// #include + namespace StoneyDSP { /** @addtogroup StoneyDSP @{ */ @@ -181,5 +188,3 @@ class AudioPluginAudioProcessorWrapper /// @} group StoneyDSP } // namespace StoneyDSP - -#endif // STONEYDSP_BIQUADS_WRAPPER_HPP_INCLUDED diff --git a/src/StoneyDSP/Biquads/Parameters.cpp b/src/StoneyDSP/Biquads/Parameters.cpp index 27dcbe7..032f7c0 100644 --- a/src/StoneyDSP/Biquads/Parameters.cpp +++ b/src/StoneyDSP/Biquads/Parameters.cpp @@ -36,7 +36,7 @@ AudioPluginAudioProcessorParameters::AudioPluginAudioProcessorParameters(AudioPl { } -void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcessorValueTreeState::ParameterLayout& params) +void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcessorValueTreeState::ParameterLayout& newParameterLayout) { const auto dBMax = juce::Decibels::gainToDecibels(16.0f); const auto dBMin = juce::Decibels::gainToDecibels(0.0625f); @@ -85,7 +85,7 @@ void AudioPluginAudioProcessorParameters::setParameterLayout(juce::AudioProcesso .withLabel(decibels) .withCategory(outParam); - params.add( + newParameterLayout.add( //============================================================================== std::make_unique("Biquads_ID", ProjectInfo::projectName, "seperatorBiquads", //============================================================================== diff --git a/src/StoneyDSP/Biquads/Wrapper.cpp b/src/StoneyDSP/Biquads/Wrapper.cpp index 614ed2e..883e02c 100644 --- a/src/StoneyDSP/Biquads/Wrapper.cpp +++ b/src/StoneyDSP/Biquads/Wrapper.cpp @@ -24,6 +24,8 @@ #include "StoneyDSP/Biquads.hpp" +// #include "Wrapper.hpp" + namespace StoneyDSP { /** @addtogroup StoneyDSP @{ */ From d7515114e065690b086e1d7dd570e939d51c46b3 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 16:07:16 +0100 Subject: [PATCH 19/21] Update macos-latest.yaml Signed-off-by: Nathan --- .github/workflows/macos-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/macos-latest.yaml b/.github/workflows/macos-latest.yaml index 973c34d..a240466 100644 --- a/.github/workflows/macos-latest.yaml +++ b/.github/workflows/macos-latest.yaml @@ -23,7 +23,7 @@ env: SCCACHE_CACHE_MULTIARCH: 1 # for macos actions only! HOMEBREW_NO_INSTALL_CLEANUP: 1 STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} - STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 + STONEYDSP_CURRENT_JUCE_VERSION: ${{ vars.STONEYDSP_BIQUADS_JUCE_VERSION_CURRENT_MAJOR_MINOR_PATCH }} jobs: macos: From 33c762adace666aad107ac2e3f69444b441a5451 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 16:12:49 +0100 Subject: [PATCH 20/21] Update ubuntu-latest.yaml Signed-off-by: Nathan --- .github/workflows/ubuntu-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-latest.yaml b/.github/workflows/ubuntu-latest.yaml index deafa52..ab5056e 100644 --- a/.github/workflows/ubuntu-latest.yaml +++ b/.github/workflows/ubuntu-latest.yaml @@ -20,7 +20,7 @@ env: VCPKG_MAX_CONCURRENCY: 3 SCCACHE_GHA_ENABLED: "true" STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} - STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 + STONEYDSP_CURRENT_JUCE_VERSION: ${{ vars.STONEYDSP_BIQUADS_JUCE_VERSION_CURRENT_MAJOR_MINOR_PATCH }} jobs: ubuntu: From b1925d9db6dc81cf7f84dfd66abbc5342057ed72 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 17 Mar 2024 16:19:12 +0100 Subject: [PATCH 21/21] Update windows-latest.yaml Signed-off-by: Nathan --- .github/workflows/windows-latest.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-latest.yaml b/.github/workflows/windows-latest.yaml index e75c858..60ebcb3 100644 --- a/.github/workflows/windows-latest.yaml +++ b/.github/workflows/windows-latest.yaml @@ -21,7 +21,7 @@ env: SCCACHE_GHA_ENABLED: "true" IPP_DIR: C:\Program Files (x86)\Intel\oneAPI\ipp\latest\lib\cmake\ipp STONEYDSP_BIQUADS_CURRENT_VERSION: ${{ vars.STONEYDSP_BIQUADS_VERSION_CURRENT_MAJOR_MINOR_PATCH }} - STONEYDSP_CURRENT_JUCE_VERSION: 7.0.9 + STONEYDSP_CURRENT_JUCE_VERSION: ${{ vars.STONEYDSP_BIQUADS_JUCE_VERSION_CURRENT_MAJOR_MINOR_PATCH }} jobs: windows: