diff --git a/JuceLibraryCode/JuceHeader.h b/JuceLibraryCode/JuceHeader.h index 25692da..66b43a9 100644 --- a/JuceLibraryCode/JuceHeader.h +++ b/JuceLibraryCode/JuceHeader.h @@ -1,52 +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 +/* + + 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 index 8155e3d..7b67d00 100644 --- a/JuceLibraryCode/JucePluginDefines.h +++ b/JuceLibraryCode/JucePluginDefines.h @@ -1,162 +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 +/* + + 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/VERSION b/VERSION index 4840c26..0e9509e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.2.162 +1.2.2.171 diff --git a/include/StoneyDSP/Biquads.hpp b/include/StoneyDSP/Biquads.hpp index cab8678..cb3f1c7 100644 --- a/include/StoneyDSP/Biquads.hpp +++ b/include/StoneyDSP/Biquads.hpp @@ -2,7 +2,7 @@ * @file Biquads.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.2.151 + * @version 1.2.2.167 * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -22,7 +22,7 @@ ******************************************************************************/ -#ifndef STONEYDSP_BIQUADS_HPP_INCLUDED +#pragma once #define STONEYDSP_BIQUADS_HPP_INCLUDED #include @@ -82,5 +82,3 @@ class AudioPluginAudioProcessor; #include "Biquads/Wrapper.hpp" #include "Biquads/Processor.hpp" #include "Biquads/Editor.hpp" - -#endif // STONEYDSP_BIQUADS_HPP_INCLUDED diff --git a/include/StoneyDSP/Biquads/Editor.hpp b/include/StoneyDSP/Biquads/Editor.hpp index d3bdae7..d91047a 100644 --- a/include/StoneyDSP/Biquads/Editor.hpp +++ b/include/StoneyDSP/Biquads/Editor.hpp @@ -2,7 +2,7 @@ * @file Editor.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.2.151 + * @version 1.2.2.167 * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -22,7 +22,7 @@ ******************************************************************************/ -#ifndef STONEYDSP_BIQUADS_EDITOR_HPP_INCLUDED +#pragma once #define STONEYDSP_BIQUADS_EDITOR_HPP_INCLUDED // #include "Processor.hpp" @@ -50,7 +50,7 @@ class JUCE_API AudioPluginAudioProcessorEditor final : public juce::AudioProcess // access the processor object that created it. AudioPluginAudioProcessor& audioProcessor; - juce::AudioProcessorValueTreeState& state; + // juce::AudioProcessorValueTreeState& state; juce::UndoManager& undoManager; @@ -65,5 +65,3 @@ class JUCE_API AudioPluginAudioProcessorEditor final : public juce::AudioProcess /// @} group StoneyDSP } // namespace StoneyDSP - -#endif // STONEYDSP_BIQUADS_EDITOR_HPP_INCLUDED diff --git a/include/StoneyDSP/Biquads/Parameters.hpp b/include/StoneyDSP/Biquads/Parameters.hpp index 1233a10..98fe4fb 100644 --- a/include/StoneyDSP/Biquads/Parameters.hpp +++ b/include/StoneyDSP/Biquads/Parameters.hpp @@ -2,7 +2,7 @@ * @file Parameters.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.2.151 + * @version 1.2.2.167 * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -22,7 +22,7 @@ ******************************************************************************/ -#ifndef STONEYDSP_BIQUADS_PARAMETERS_HPP_INCLUDED +#pragma once #define STONEYDSP_BIQUADS_PARAMETERS_HPP_INCLUDED // #include "StoneyDSP/Biquads.hpp" @@ -60,5 +60,3 @@ class AudioPluginAudioProcessorParameters /// @} group StoneyDSP } // namespace StoneyDSP - -#endif // STONEYDSP_BIQUADS_PARAMETERS_HPP_INCLUDED diff --git a/include/StoneyDSP/Biquads/Processor.hpp b/include/StoneyDSP/Biquads/Processor.hpp index 43b0575..809354b 100644 --- a/include/StoneyDSP/Biquads/Processor.hpp +++ b/include/StoneyDSP/Biquads/Processor.hpp @@ -2,7 +2,7 @@ * @file Processor.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.2.151 + * @version 1.2.2.167 * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -22,7 +22,7 @@ ******************************************************************************/ -#ifndef STONEYDSP_BIQUADS_PROCESSOR_HPP_INCLUDED +#pragma once #define STONEYDSP_BIQUADS_PROCESSOR_HPP_INCLUDED namespace StoneyDSP { @@ -77,7 +77,6 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor void setStateInformation (const void* data, int sizeInBytes) override; void setCurrentProgramStateInformation(const void* data, int sizeInBytes) override; //============================================================================== - juce::UndoManager undoManager; juce::UndoManager& getUndoManager() { return undoManager; } //============================================================================== juce::AudioProcessorValueTreeState& getAPVTS() { return apvts; } @@ -88,13 +87,19 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor private: //============================================================================== /** Audio processor members. */ + juce::UndoManager undoManager; juce::AudioProcessorValueTreeState apvts; + juce::dsp::ProcessSpec spec; juce::AudioProcessor::ProcessingPrecision processingPrecision; //============================================================================== - AudioPluginAudioProcessorParameters parameters; - AudioPluginAudioProcessorWrapper processorFlt; - AudioPluginAudioProcessorWrapper processorDbl; + std::unique_ptr parametersPtr; + std::unique_ptr> processorFltPtr; + std::unique_ptr> processorDblPtr; + + // AudioPluginAudioProcessorParameters& parameters; + // AudioPluginAudioProcessorWrapper& processorFlt; + // AudioPluginAudioProcessorWrapper& processorDbl; //============================================================================== /** Parameter pointers. */ @@ -109,5 +114,3 @@ class AudioPluginAudioProcessor final : public juce::AudioProcessor /// @} group StoneyDSP } // namespace StoneyDSP - -#endif // STONEYDSP_BIQUADS_PROCESSOR_HPP_INCLUDED diff --git a/include/StoneyDSP/Biquads/Wrapper.hpp b/include/StoneyDSP/Biquads/Wrapper.hpp index e137b62..2c187e5 100644 --- a/include/StoneyDSP/Biquads/Wrapper.hpp +++ b/include/StoneyDSP/Biquads/Wrapper.hpp @@ -2,7 +2,7 @@ * @file Wrapper.hpp * @author Nathan J. Hood (nathanjhood@googlemail.com) * @brief Simple two-pole equalizer with variable oversampling. - * @version 1.2.2.151 + * @version 1.2.2.167 * @date 2024-03-16 * * @copyright Copyright (c) 2024 - Nathan J. Hood @@ -25,13 +25,6 @@ #pragma once #define STONEYDSP_BIQUADS_WRAPPER_HPP_INCLUDED -// #include -// #include -// #include -// #include -// #include -// #include - namespace StoneyDSP { /** @addtogroup StoneyDSP @{ */ @@ -51,7 +44,7 @@ class AudioPluginAudioProcessorWrapper * @param spec */ AudioPluginAudioProcessorWrapper(AudioPluginAudioProcessor& p, juce::AudioProcessorValueTreeState& apvts, juce::dsp::ProcessSpec& spec); - + ~AudioPluginAudioProcessorWrapper(); //============================================================================== /** Initialises the processor. */ void prepare(juce::dsp::ProcessSpec& spec); @@ -137,8 +130,12 @@ class AudioPluginAudioProcessorWrapper //============================================================================== // std::unique_ptr> oversampler[5]; - juce::dsp::DryWetMixer mixer; - StoneyDSP::Audio::Biquads biquadsA, biquadsB, biquadsC, biquadsD; + std::unique_ptr> mixer; + + const std::size_t biquadArraySize; + // std::vector> biquadArray; + // std::vector>> biquadArray; + std::unique_ptr> biquadArray[4]; //========================================================================== /** Parameter pointers. */ diff --git a/src/StoneyDSP/Biquads/Editor.cpp b/src/StoneyDSP/Biquads/Editor.cpp index cf87f08..f6c79ee 100644 --- a/src/StoneyDSP/Biquads/Editor.cpp +++ b/src/StoneyDSP/Biquads/Editor.cpp @@ -34,7 +34,7 @@ namespace Biquads { AudioPluginAudioProcessorEditor::AudioPluginAudioProcessorEditor (AudioPluginAudioProcessor& p) : juce::AudioProcessorEditor(&p) , audioProcessor(p) -, state(p.getAPVTS()) +// , state(p.getAPVTS()) , undoManager(p.getUndoManager()) { // juce::ignoreUnused (processorRef); diff --git a/src/StoneyDSP/Biquads/Processor.cpp b/src/StoneyDSP/Biquads/Processor.cpp index e3901f7..c25ce0b 100644 --- a/src/StoneyDSP/Biquads/Processor.cpp +++ b/src/StoneyDSP/Biquads/Processor.cpp @@ -43,19 +43,29 @@ AudioPluginAudioProcessor::AudioPluginAudioProcessor() , undoManager() , apvts(*this, &undoManager, juce::Identifier { "Parameters" }, createParameterLayout()) , spec() - , parameters (*this, getAPVTS()) - , processorFlt(*this, getAPVTS(), getSpec()) - , processorDbl(*this, getAPVTS(), getSpec()) + , parametersPtr(std::make_unique(*this, getAPVTS())) + , processorFltPtr(std::make_unique> (*this, getAPVTS(), getSpec())) + , processorDblPtr(std::make_unique>(*this, getAPVTS(), getSpec())) +// , parameters (*parametersPtr.get()) +// , processorFlt (*processorFltPtr.get()) +// , processorDbl (*processorDblPtr.get()) // , processingPrecision(singlePrecision) , bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) { bypassState = dynamic_cast (apvts.getParameter("Master_bypassID")); - jassert(bypassState != nullptr); + jassert(parametersPtr != nullptr); + jassert(processorFltPtr != nullptr); + jassert(processorFltPtr != nullptr); + + jassert(bypassState != nullptr); } AudioPluginAudioProcessor::~AudioPluginAudioProcessor() { + processorFltPtr.release(); + processorDblPtr.release(); + parametersPtr.release(); } //============================================================================== @@ -178,6 +188,9 @@ void AudioPluginAudioProcessor::changeProgramName (int index, const juce::String //============================================================================== void AudioPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) { + AudioPluginAudioProcessorWrapper& processorFlt = *processorFltPtr.get(); + AudioPluginAudioProcessorWrapper& processorDbl = *processorDblPtr.get(); + // Use this method as the place to do any pre-playback // initialisation that you need.. processingPrecision = getProcessingPrecision(); @@ -189,15 +202,20 @@ void AudioPluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPer if(!isUsingDoublePrecision()) { processorFlt.prepare(getSpec()); + processorDbl.reset(0.0); } else { + processorFlt.reset(0.0f); processorDbl.prepare(getSpec()); } } void AudioPluginAudioProcessor::releaseResources() { + AudioPluginAudioProcessorWrapper& processorFlt = *processorFltPtr.get(); + AudioPluginAudioProcessorWrapper& processorDbl = *processorDblPtr.get(); + // When playback stops, you can use this as an opportunity to free up any // spare memory, etc. if(!isUsingDoublePrecision()) @@ -236,27 +254,46 @@ bool AudioPluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layou void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages) { - jassert (! isUsingDoublePrecision()); + if(!isBypassed()) + { + jassert (! isUsingDoublePrecision()); - juce::ScopedNoDenormals noDenormals; + AudioPluginAudioProcessorWrapper& processorFlt = *processorFltPtr.get(); - processorFlt.process(buffer, midiMessages); + juce::ScopedNoDenormals noDenormals; + + processorFlt.process(buffer, midiMessages); + } + else + { + processBlockBypassed(buffer, midiMessages); + } } void AudioPluginAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages) { - jassert (isUsingDoublePrecision()); + if(!isBypassed()) + { + jassert (isUsingDoublePrecision()); - juce::ScopedNoDenormals noDenormals; + AudioPluginAudioProcessorWrapper& processorDbl = *processorDblPtr.get(); - processorDbl.process(buffer, midiMessages); + juce::ScopedNoDenormals noDenormals; + processorDbl.process(buffer, midiMessages); + } + else + { + processBlockBypassed(buffer, midiMessages); + } } void AudioPluginAudioProcessor::processBlockBypassed(juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages) { jassert (! isUsingDoublePrecision()); + AudioPluginAudioProcessorWrapper& processorFlt = *processorFltPtr.get(); + processorFlt.processBypass(buffer, midiMessages); } @@ -264,6 +301,8 @@ void AudioPluginAudioProcessor::processBlockBypassed(juce::AudioBuffer& { jassert (isUsingDoublePrecision()); + AudioPluginAudioProcessorWrapper& processorDbl = *processorDblPtr.get(); + processorDbl.processBypass(buffer, midiMessages); } @@ -299,24 +338,17 @@ void AudioPluginAudioProcessor::getStateInformation (juce::MemoryBlock& destData auto state = apvts.copyState(); std::unique_ptr xml(state.createXml()); copyXmlToBinary(*xml, destData); - - // // Store an xml representation of our state. - // if (auto xmlState = state.copyState().createXml()) - // copyXmlToBinary (*xmlState, destData); } void AudioPluginAudioProcessor::getCurrentProgramStateInformation(juce::MemoryBlock& destData) { - // using apvts = parameters.getAPVTS(); - auto state = apvts.copyState(); std::unique_ptr xml(state.createXml()); - copyXmlToBinary(*xml, destData); + copyXmlToBinary(*xml.get(), destData); } void AudioPluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes) { - // using apvts = parameters.getAPVTS(); // You should use this method to restore your parameters from this memory block, // whose contents will have been created by the getStateInformation() call. std::unique_ptr xmlState(getXmlFromBinary(data, sizeInBytes)); @@ -324,17 +356,10 @@ void AudioPluginAudioProcessor::setStateInformation (const void* data, int sizeI if (xmlState.get() != nullptr) if (xmlState->hasTagName(apvts.state.getType())) apvts.replaceState(juce::ValueTree::fromXml(*xmlState)); - - // // Restore our plug-in's state from the xml representation stored in the above - // // method. - // if (auto xmlState = getXmlFromBinary (data, sizeInBytes)) - // state.replaceState (ValueTree::fromXml (*xmlState)); } void AudioPluginAudioProcessor::setCurrentProgramStateInformation(const void* data, int sizeInBytes) { - // using apvts = parameters.getAPVTS(); - std::unique_ptr xmlState(getXmlFromBinary(data, sizeInBytes)); if (xmlState.get() != nullptr) diff --git a/src/StoneyDSP/Biquads/Wrapper.cpp b/src/StoneyDSP/Biquads/Wrapper.cpp index 883e02c..31e8a53 100644 --- a/src/StoneyDSP/Biquads/Wrapper.cpp +++ b/src/StoneyDSP/Biquads/Wrapper.cpp @@ -24,8 +24,6 @@ #include "StoneyDSP/Biquads.hpp" -// #include "Wrapper.hpp" - namespace StoneyDSP { /** @addtogroup StoneyDSP @{ */ @@ -38,6 +36,7 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A , state(apvts) , setup(spec) +, mixer(std::make_unique>()) , masterBypassPtr (dynamic_cast (apvts.getParameter("Master_bypassID"))) , masterOutputPtr (dynamic_cast (apvts.getParameter("Master_outputID"))) , masterMixPtr (dynamic_cast (apvts.getParameter("Master_mixID"))) @@ -67,14 +66,12 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A , 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() -, biquadsA() -, biquadsB() -, biquadsC() -, biquadsD() +, bypassState (dynamic_cast (apvts.getParameter("Master_bypassID"))) +, biquadArraySize (static_cast(4)) // cannot ‘dynamic_cast’ this - target typeis not pointer or reference... +// , biquadArray( biquadArraySize, {}) { + masterBypassPtr = dynamic_cast (apvts.getParameter("Master_bypassID")); masterOutputPtr = dynamic_cast (apvts.getParameter("Master_outputID")); masterMixPtr = dynamic_cast (apvts.getParameter("Master_mixID")); @@ -139,21 +136,43 @@ AudioPluginAudioProcessorWrapper::AudioPluginAudioProcessorWrapper(A jassert(bypassState != nullptr); + jassert(biquadArraySize != static_cast(0)); + // auto osFilter = juce::dsp::Oversampling::filterHalfBandFIREquiripple; // for (int i = 0; i < 5; ++i) // oversampler[i] = std::make_unique> // (audioProcessor.getTotalNumInputChannels(), i, osFilter, true, false); + // biquadArray.reserve(biquadArraySize); + // biquadArray.resize(biquadArraySize); + + // for(std::size_t i = 0; i < biquadArraySize; ++i) + // biquadArray.emplace_back(); + + for (std::size_t i = 0; i < biquadArraySize; ++i) + biquadArray[i] = std::make_unique>(); + reset(static_cast(0.0)); } +template StoneyDSP::Biquads::AudioPluginAudioProcessorWrapper::~AudioPluginAudioProcessorWrapper() +{ + // biquadArray.clear(); + mixer.release(); + + for (std::size_t i = 0; i < biquadArraySize; ++i) + biquadArray[i].release(); +} + template void AudioPluginAudioProcessorWrapper::prepare(juce::dsp::ProcessSpec& spec) { jassert(spec.sampleRate > 0); jassert(spec.numChannels > 0); + // jassert((biquadArray.size() == biquadArraySize) && (biquadArraySize != static_cast(0))); + sampleRate = spec.sampleRate; // oversamplingFactor = 1 << curOS; @@ -167,11 +186,10 @@ void AudioPluginAudioProcessorWrapper::prepare(juce::dsp::ProcessSpe reset(static_cast(0.0)); - mixer.prepare(spec); - biquadsA.prepare(spec); - biquadsB.prepare(spec); - biquadsC.prepare(spec); - biquadsD.prepare(spec); + mixer->prepare(spec); + + for(auto& biquad : biquadArray) + biquad->prepare(spec); update(); } @@ -181,11 +199,10 @@ void AudioPluginAudioProcessorWrapper::reset() { SampleType initialValue = static_cast(0.0); - mixer.reset(); - biquadsA.reset(initialValue); - biquadsB.reset(initialValue); - biquadsC.reset(initialValue); - biquadsD.reset(initialValue); + mixer->reset(); + + for(auto& biquad : biquadArray) + biquad->reset(initialValue); // for (int i = 0; i < 5; ++i) // oversampler[i]->reset(); @@ -194,11 +211,10 @@ void AudioPluginAudioProcessorWrapper::reset() template void AudioPluginAudioProcessorWrapper::reset(SampleType initialValue) { - mixer.reset(); - biquadsA.reset(initialValue); - biquadsB.reset(initialValue); - biquadsC.reset(initialValue); - biquadsD.reset(initialValue); + mixer->reset(); + + for(auto& biquad : biquadArray) + biquad->reset(initialValue); // for (int i = 0; i < 5; ++i) // oversampler[i]->reset(); @@ -249,7 +265,7 @@ void AudioPluginAudioProcessorWrapper::processBlock(juce::AudioBuffe juce::dsp::AudioBlock dryBlock(buffer); juce::dsp::AudioBlock wetBlock(buffer); - mixer.pushDrySamples(dryBlock); + mixer->pushDrySamples(dryBlock); // wetBlock = oversampler[curOS]->processSamplesUp(dryBlock); @@ -259,10 +275,8 @@ void AudioPluginAudioProcessorWrapper::processBlock(juce::AudioBuffe // its results to the block returned by getOutputBlock(). auto context = juce::dsp::ProcessContextReplacing (wetBlock); - biquadsA.process(context); - biquadsB.process(context); - biquadsC.process(context); - biquadsD.process(context); + for(auto& biquad : biquadArray) + biquad->process(context); // processContext(context); @@ -270,7 +284,7 @@ void AudioPluginAudioProcessorWrapper::processBlock(juce::AudioBuffe // applyGain(buffer, static_cast(juce::Decibels::decibelsToGain(static_cast(masterOutputPtr->get()), static_cast(-120.00)))) - mixer.mixWetSamples(wetBlock); + mixer->mixWetSamples(wetBlock); return; } @@ -305,50 +319,50 @@ void AudioPluginAudioProcessorWrapper::processBypass(juce::AudioBuff template SampleType AudioPluginAudioProcessorWrapper::processSample(int channel, SampleType inputValue) { - // return biquads.processSample(channel, inputValue); - juce::ignoreUnused(channel); - auto sample = inputValue; - return sample; + auto& sample = inputValue; + + for(int chan = 0; chan < channel; ++chan) + { + return sample; + } } template void AudioPluginAudioProcessorWrapper::snapToZero() noexcept { - biquadsA.snapToZero(); - biquadsB.snapToZero(); - biquadsC.snapToZero(); - biquadsD.snapToZero(); + // mixer->snapToZero(); // ? + + for(auto& biquad : biquadArray) + biquad->snapToZero(); } template void AudioPluginAudioProcessorWrapper::update() { - 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())); + mixer->setWetMixProportion(static_cast (0.01f * masterMixPtr->get())); + + for(auto& biquad : biquadArray) + biquad->setTransformType(static_cast (masterTransformPtr->getIndex())); + + biquadArray[0]->setFrequency (static_cast (biquadsAFrequencyPtr->get())); + biquadArray[0]->setResonance (static_cast (biquadsAResonancePtr->get())); + biquadArray[0]->setGain (static_cast (biquadsAGainPtr->get())); + biquadArray[0]->setFilterType (static_cast (biquadsATypePtr->getIndex())); + + biquadArray[1]->setFrequency (static_cast (biquadsBFrequencyPtr->get())); + biquadArray[1]->setResonance (static_cast (biquadsBResonancePtr->get())); + biquadArray[1]->setGain (static_cast (biquadsBGainPtr->get())); + biquadArray[1]->setFilterType (static_cast (biquadsBTypePtr->getIndex())); + + biquadArray[2]->setFrequency (static_cast (biquadsCFrequencyPtr->get())); + biquadArray[2]->setResonance (static_cast (biquadsCResonancePtr->get())); + biquadArray[2]->setGain (static_cast (biquadsCGainPtr->get())); + biquadArray[2]->setFilterType (static_cast (biquadsCTypePtr->getIndex())); + + biquadArray[3]->setFrequency (static_cast (biquadsDFrequencyPtr->get())); + biquadArray[3]->setResonance (static_cast (biquadsDResonancePtr->get())); + biquadArray[3]->setGain (static_cast (biquadsDGainPtr->get())); + biquadArray[3]->setFilterType (static_cast (biquadsDTypePtr->getIndex())); } // template