├── .gitattributes ├── .gitignore ├── plugins ├── CMakeLists.txt ├── CombFilter │ ├── source │ │ ├── pluginparamers │ │ │ ├── PluginParameters.h │ │ │ └── PluginParameters.cpp │ │ ├── PluginEditor.h │ │ ├── PluginEditor.cpp │ │ ├── PluginProcessor.h │ │ └── PluginProcessor.cpp │ └── CMakeLists.txt └── ParametricEQ │ ├── source │ ├── pluginparamers │ │ ├── PluginParameters.h │ │ └── PluginParameters.cpp │ ├── PluginEditor.h │ ├── PluginEditor.cpp │ ├── PluginProcessor.h │ └── PluginProcessor.cpp │ └── CMakeLists.txt ├── README.md ├── libs └── DAFX │ ├── WaveShapes │ ├── Sine.h │ ├── Sawtooth.h │ ├── UniSine.h │ ├── Square.h │ └── Triangle.h │ ├── Utility │ ├── Interpolation.h │ ├── gain_block.h │ └── Block_Smoothing.h │ ├── Filters │ ├── SecondOrder-butterworth-bandstop.h │ ├── SecondOrder-Shelving-Filters.h │ ├── so_hpf_butterworth.h │ ├── so_low_butterworth.h │ ├── FirstOrder-Filters.h │ ├── SecondOrder-Filters.h │ └── FirstOrder-Shelving-Filters.h │ ├── CombFilters │ ├── FIRCombFilter.h │ ├── UniversalCombFilter.h │ ├── IIRCombFilter.h │ └── NaturalSoundingCombFilter.h │ ├── DelayLine │ └── DelayLine.h │ ├── LFO │ └── WaveTableOscillator.h │ ├── Dynamics │ └── Limiter.h │ └── EQ │ └── ParametricEQ.h ├── CMakeLists.txt └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | **/Effects 3 | **/build 4 | **/copy_source 5 | **/modules -------------------------------------------------------------------------------- /plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | add_subdirectory(CombFilter) 3 | add_subdirectory(ParametricEQ) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DAFX 2 | C++ implementation of Matlabscripts from the book DAFX: Digital Audio Effects by Udo Zölzer. \ 3 | I use [JUCE](https://juce.com/get-juce/) to debug VST3 plugins inside hosts. \ 4 | I did this for study purposes. 5 | 6 | ## 7 | ```shell 8 | git clone https://github.com/zeloe/DAFX.git 9 | cd DAFX 10 | cmake -Bbuild 11 | ``` 12 | ## To Do 13 | - Add stereo support for each class 14 | - Refactor FX and make them Cmake compatible 15 | 16 | ## Not Working 17 | 1. Still a bit chaotic. 18 | 2. Will add more plugins in future 19 | 3. Good resource -> [ELSE](https://github.com/porres/Live-Electronics-Tutorial) 20 | -------------------------------------------------------------------------------- /plugins/CombFilter/source/pluginparamers/PluginParameters.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | #ifndef PLUGINPARAMETER_H 6 | #define PLUGINPARAMETER_H 7 | 8 | 9 | class PluginParameter 10 | { 11 | public: 12 | PluginParameter(); 13 | ~PluginParameter(); 14 | 15 | inline static const juce::String 16 | GAIN = "param_gain", 17 | FREQUENCY = "param_frequency"; 18 | 19 | inline static const juce::String 20 | GAIN_NAME = "Gain", 21 | FREQUENCY_NAME = "Frequency"; 22 | 23 | 24 | static juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout(); 25 | static juce::StringArray getPluginParameterList(); 26 | inline static juce::StringArray parameterList; 27 | }; 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /libs/DAFX/WaveShapes/Sine.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Sine.h 5 | Created: 22 Apr 2023 3:02:31pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | class Sine 14 | { 15 | public: 16 | Sine() 17 | { 18 | // wird nur einmal in Constructor ausgeführt 19 | createWavetable(); 20 | }; 21 | ~Sine(){}; 22 | 23 | void createWavetable() 24 | { 25 | //code für wavetable 26 | waveTable.setSize (1, (int) tableSize + 1); 27 | waveTable.clear(); 28 | auto* samples = waveTable.getWritePointer (0); 29 | for(int i = 0; i < tableSize; ++i) 30 | { 31 | samples[i] = std::sin(2 * M_PI * float(i) / float(tableSize)); 32 | } 33 | } 34 | 35 | juce::AudioSampleBuffer waveTable; 36 | private: 37 | const unsigned int tableSize = 512; 38 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Sine); 39 | }; 40 | -------------------------------------------------------------------------------- /libs/DAFX/WaveShapes/Sawtooth.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Sawtooth.h 5 | Created: 22 Apr 2023 3:03:00pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | class Sawtooth 14 | { 15 | public: 16 | Sawtooth() 17 | { 18 | // wird nur einmal in Constructor ausgeführt 19 | createWavetable(); 20 | }; 21 | ~Sawtooth(){}; 22 | 23 | void createWavetable() 24 | { 25 | //code für wavetable 26 | waveTable.setSize (1, (int) tableSize + 1); 27 | waveTable.clear(); 28 | auto* samples = waveTable.getWritePointer (0); 29 | for(int i = 0; i < tableSize; ++i) 30 | { 31 | samples[i] = (float(i) / float (tableSize)); 32 | } 33 | } 34 | 35 | juce::AudioSampleBuffer waveTable; 36 | private: 37 | const unsigned int tableSize = 512; 38 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Sawtooth); 39 | }; 40 | -------------------------------------------------------------------------------- /plugins/ParametricEQ/source/pluginparamers/PluginParameters.h: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | #ifndef PLUGINPARAMETER_H 6 | #define PLUGINPARAMETER_H 7 | 8 | 9 | class PluginParameter 10 | { 11 | public: 12 | PluginParameter(); 13 | ~PluginParameter(); 14 | 15 | inline static const juce::String 16 | LOW_GAIN = "param_lowGain", 17 | LOW_CUTOFF_FREQUENCY = "param_lowCutoff", 18 | HIGH_GAIN = "param_highGain", 19 | MID_GAIN = "param_midGain", 20 | HIGH_CUTOFF_FREQUENCY = "param_highCutoff"; 21 | 22 | inline static const juce::String 23 | LOW_GAIN_NAME = "Low Gain", 24 | LOW_CUTOFF_FREQUENCY_NAME = "Low Frequency Cutoff", 25 | HIGH_GAIN_NAME = "High Gain", 26 | MID_GAIN_NAME = "MID Gain", 27 | HIGH_CUTOFF_FREQUENCY_NAME = "High Frequency Cutoff"; 28 | 29 | 30 | static juce::AudioProcessorValueTreeState::ParameterLayout createParameterLayout(); 31 | static juce::StringArray getPluginParameterList(); 32 | inline static juce::StringArray parameterList; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /libs/DAFX/WaveShapes/UniSine.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Hanning.h 5 | Created: 29 May 2023 11:36:42am 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | class UniSine 14 | { 15 | public: 16 | UniSine() 17 | { 18 | // wird nur einmal in Constructor ausgeführt 19 | createWavetable(); 20 | }; 21 | ~UniSine(){}; 22 | 23 | void createWavetable() 24 | { 25 | //code für wavetable 26 | waveTable.setSize (1, (int) tableSize + 1); 27 | waveTable.clear(); 28 | auto* samples = waveTable.getWritePointer (0); 29 | for(int i = 0; i < tableSize; ++i) 30 | { 31 | samples[i] = std::sin(M_PI * float(i) / float(tableSize)); 32 | } 33 | } 34 | 35 | juce::AudioSampleBuffer waveTable; 36 | private: 37 | const unsigned int tableSize = 512; 38 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (UniSine); 39 | }; 40 | -------------------------------------------------------------------------------- /plugins/CombFilter/source/PluginEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin editor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "PluginProcessor.h" 13 | 14 | //============================================================================== 15 | /** 16 | */ 17 | class PluginAudioProcessorEditor : public juce::AudioProcessorEditor 18 | { 19 | public: 20 | PluginAudioProcessorEditor (PluginAudioProcessor&); 21 | ~PluginAudioProcessorEditor() override; 22 | 23 | //============================================================================== 24 | void paint (juce::Graphics&) override; 25 | void resized() override; 26 | 27 | private: 28 | // This reference is provided as a quick way for your editor to 29 | // access the processor object that created it. 30 | PluginAudioProcessor& audioProcessor; 31 | 32 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginAudioProcessorEditor) 33 | }; 34 | -------------------------------------------------------------------------------- /plugins/ParametricEQ/source/PluginEditor.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin editor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "PluginProcessor.h" 13 | 14 | //============================================================================== 15 | /** 16 | */ 17 | class PluginAudioProcessorEditor : public juce::AudioProcessorEditor 18 | { 19 | public: 20 | PluginAudioProcessorEditor (PluginAudioProcessor&); 21 | ~PluginAudioProcessorEditor() override; 22 | 23 | //============================================================================== 24 | void paint (juce::Graphics&) override; 25 | void resized() override; 26 | 27 | private: 28 | // This reference is provided as a quick way for your editor to 29 | // access the processor object that created it. 30 | PluginAudioProcessor& audioProcessor; 31 | 32 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginAudioProcessorEditor) 33 | }; 34 | -------------------------------------------------------------------------------- /libs/DAFX/Utility/Interpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Interpolation.h 5 | Created: 9 Apr 2023 9:37:48pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | 14 | template 15 | class Interpolation { 16 | public: 17 | static FloatType linear(FloatType v0, FloatType v1, FloatType t) { 18 | return (1 - t) * v0 + t * v1; 19 | } 20 | 21 | static FloatType cubic(FloatType y0, FloatType y1, FloatType y2, FloatType y3, FloatType x) { 22 | const FloatType a0 = y3 - y2 - y0 + y1; 23 | const FloatType a1 = y0 - y1 - a0; 24 | const FloatType a2 = y2 - y0; 25 | const FloatType a3 = y1; 26 | return a0 * x * x * x + a1 * x * x + a2 * x + a3; 27 | } 28 | 29 | static FloatType spline(FloatType y0, FloatType y1, FloatType y2, FloatType y3, FloatType t) { 30 | FloatType a0, a1, a2, a3; 31 | FloatType t2 = t * t; 32 | a0 = y3 - y2 - y0 + y1; 33 | a1 = y0 - y1 - a0; 34 | a2 = y2 - y0; 35 | a3 = y1; 36 | return a0 * t * t2 + a1 * t2 + a2 * t + a3; 37 | } 38 | 39 | static FloatType allPass(FloatType y0, FloatType y1, FloatType ya_alt, FloatType t) { 40 | return y1 + (1.0 - t) * y0 - (1.0 - t) * ya_alt; 41 | } 42 | }; 43 | -------------------------------------------------------------------------------- /libs/DAFX/WaveShapes/Square.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Square.h 5 | Created: 22 Apr 2023 3:02:40pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | class Square 14 | { 15 | public: 16 | Square() 17 | { 18 | // wird nur einmal in Constructor ausgeführt 19 | createWavetable(); 20 | }; 21 | ~Square(){}; 22 | 23 | void createWavetable() 24 | { 25 | //code für wavetable 26 | waveTable.setSize (1, (int) tableSize + 1); 27 | waveTable.clear(); 28 | auto* samples = waveTable.getWritePointer (0); 29 | bool over = false; 30 | unsigned int count = 0; 31 | unsigned int halfsize = tableSize / 2; 32 | for(int i = 0; i < tableSize; ++i) 33 | { 34 | if(over == false) 35 | { 36 | samples[i] = 1; 37 | count++; 38 | if (count > halfsize) 39 | { 40 | over = true; 41 | } 42 | } else 43 | { 44 | samples[i] = - 1; 45 | } 46 | } 47 | } 48 | 49 | juce::AudioSampleBuffer waveTable; 50 | private: 51 | const unsigned int tableSize = 512; 52 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Square); 53 | }; 54 | -------------------------------------------------------------------------------- /plugins/CombFilter/source/PluginEditor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin editor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #include "PluginProcessor.h" 10 | #include "PluginEditor.h" 11 | 12 | //============================================================================== 13 | PluginAudioProcessorEditor::PluginAudioProcessorEditor (PluginAudioProcessor& p) 14 | : AudioProcessorEditor (&p), audioProcessor (p) 15 | { 16 | // Make sure that before the constructor has finished, you've set the 17 | // editor's size to whatever you need it to be. 18 | setSize (400, 300); 19 | } 20 | 21 | PluginAudioProcessorEditor::~PluginAudioProcessorEditor() 22 | { 23 | } 24 | 25 | //============================================================================== 26 | void PluginAudioProcessorEditor::paint (juce::Graphics& g) 27 | { 28 | // (Our component is opaque, so we must completely fill the background with a solid colour) 29 | g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId)); 30 | 31 | g.setColour (juce::Colours::white); 32 | g.setFont (15.0f); 33 | g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1); 34 | } 35 | 36 | void PluginAudioProcessorEditor::resized() 37 | { 38 | // This is generally where you'll want to lay out the positions of any 39 | // subcomponents in your editor.. 40 | } 41 | -------------------------------------------------------------------------------- /plugins/ParametricEQ/source/PluginEditor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin editor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #include "PluginProcessor.h" 10 | #include "PluginEditor.h" 11 | 12 | //============================================================================== 13 | PluginAudioProcessorEditor::PluginAudioProcessorEditor (PluginAudioProcessor& p) 14 | : AudioProcessorEditor (&p), audioProcessor (p) 15 | { 16 | // Make sure that before the constructor has finished, you've set the 17 | // editor's size to whatever you need it to be. 18 | setSize (400, 300); 19 | } 20 | 21 | PluginAudioProcessorEditor::~PluginAudioProcessorEditor() 22 | { 23 | } 24 | 25 | //============================================================================== 26 | void PluginAudioProcessorEditor::paint (juce::Graphics& g) 27 | { 28 | // (Our component is opaque, so we must completely fill the background with a solid colour) 29 | g.fillAll (getLookAndFeel().findColour (juce::ResizableWindow::backgroundColourId)); 30 | 31 | g.setColour (juce::Colours::white); 32 | g.setFont (15.0f); 33 | g.drawFittedText ("Hello World!", getLocalBounds(), juce::Justification::centred, 1); 34 | } 35 | 36 | void PluginAudioProcessorEditor::resized() 37 | { 38 | // This is generally where you'll want to lay out the positions of any 39 | // subcomponents in your editor.. 40 | } 41 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The first line of any CMake project should be a call to `cmake_minimum_required`, which checks 2 | # that the installed CMake will be able to understand the following CMakeLists, and ensures that 3 | # CMake's behaviour is compatible with the named version. This is a standard CMake command, so more 4 | # information can be found in the CMake docs. 5 | 6 | cmake_minimum_required(VERSION 3.24) 7 | 8 | # IDEs: Enable grouping of source files into folders in IDEs. 9 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) 10 | 11 | # IDEs: Create a folder in the IDE with the JUCE Module code. 12 | option(JUCE_ENABLE_MODULE_SOURCE_GROUPS "Show all module sources in IDE projects" ON) 13 | 14 | 15 | set(LIB_JUCE_TAG "7.0.11") 16 | 17 | include(FetchContent) 18 | 19 | # Keep dependencies outside of the "Build" directory. 20 | # This allows to do a clean build of the project without re-downloading or 21 | # rebuilding the dependencies. 22 | set(FETCHCONTENT_BASE_DIR "${PROJECT_SOURCE_DIR}/modules" CACHE PATH "External dependencies path." FORCE) 23 | 24 | FetchContent_Declare(juce 25 | GIT_REPOSITORY https://github.com/juce-framework/JUCE.git 26 | GIT_TAG ${LIB_JUCE_TAG} 27 | GIT_SHALLOW TRUE 28 | GIT_CONFIG advice.detachedHead=false # Disable detached HEAD warning for fetching a specific tag 29 | SOURCE_DIR "${FETCHCONTENT_BASE_DIR}/JUCE" 30 | SUBBUILD_DIR "${FETCHCONTENT_BASE_DIR}/JUCE-Subbuild" 31 | BINARY_DIR "${FETCHCONTENT_BASE_DIR}/JUCE-Build") 32 | 33 | FetchContent_MakeAvailable(juce) 34 | 35 | 36 | add_subdirectory(plugins) -------------------------------------------------------------------------------- /plugins/CombFilter/source/pluginparamers/PluginParameters.cpp: -------------------------------------------------------------------------------- 1 | #include "PluginParameters.h" 2 | 3 | 4 | PluginParameter::PluginParameter() 5 | { 6 | 7 | } 8 | 9 | PluginParameter::~PluginParameter() 10 | { 11 | 12 | } 13 | 14 | 15 | juce::AudioProcessorValueTreeState::ParameterLayout PluginParameter::createParameterLayout() 16 | { 17 | std::vector> params; 18 | 19 | 20 | 21 | params.push_back (std::make_unique (GAIN, 22 | GAIN_NAME, 23 | -0.95f, 24 | 0.95f, 25 | 0.5)); 26 | 27 | 28 | 29 | params.push_back (std::make_unique (FREQUENCY, 30 | FREQUENCY_NAME, 31 | 20, 32 | 2000, 33 | 10)); 34 | 35 | for (const auto & param : params) { 36 | parameterList.add(param->getParameterID()); 37 | } 38 | 39 | 40 | return { params.begin(), params.end() }; 41 | } 42 | 43 | 44 | juce::StringArray PluginParameter::getPluginParameterList() { 45 | return parameterList; 46 | } 47 | -------------------------------------------------------------------------------- /libs/DAFX/Utility/gain_block.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | gain_block.h 5 | Created: 5 Feb 2023 11:39:34pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | 12 | #pragma once 13 | #include "JuceHeader.h" 14 | #include "math.h" 15 | class Gain_Block 16 | { 17 | public: 18 | Gain_Block() {}; 19 | ~Gain_Block() {}; 20 | 21 | void prepare(int blocksize) 22 | { 23 | temp_gain = 0; 24 | bs = blocksize; 25 | } 26 | 27 | void setGain(float gain) 28 | { 29 | current_gain = gain; 30 | } 31 | 32 | void process(float* input) noexcept 33 | { 34 | if(temp_gain != current_gain) 35 | { 36 | // this works for block based processing 37 | gain_inc = (current_gain - temp_gain) / bs; 38 | for (size_t i = 0; i < bs; ++i) 39 | { 40 | temp_gain += gain_inc; 41 | const float gain = input[i] * temp_gain; 42 | input[i] = gain; 43 | } 44 | temp_gain = current_gain; 45 | } else { 46 | for (size_t i = 0; i < bs; ++i) 47 | { 48 | const float gain = input[i] * current_gain; 49 | input[i] = gain; 50 | } 51 | } 52 | 53 | } 54 | private: 55 | float temp_gain; 56 | float current_gain; 57 | float gain_inc = 0; 58 | size_t bs = 0; 59 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Gain_Block); 60 | }; 61 | -------------------------------------------------------------------------------- /libs/DAFX/WaveShapes/Triangle.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Triangle.h 5 | Created: 22 Apr 2023 3:02:47pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | 14 | class Triangle 15 | { 16 | public: 17 | Triangle() 18 | { 19 | // wird nur einmal in Constructor ausgeführt 20 | createWavetable(); 21 | }; 22 | ~Triangle(){}; 23 | 24 | void createWavetable() 25 | { 26 | //code für wavetable 27 | waveTable.setSize (1, (int) tableSize + 1); 28 | waveTable.clear(); 29 | auto* samples = waveTable.getWritePointer (0); 30 | bool over = false; 31 | unsigned int count = 0; 32 | unsigned int halfsize = tableSize/2; 33 | for(int i = 0; i < tableSize; ++i) 34 | { 35 | if(over == false) 36 | { 37 | samples[i] = (float(count) / float (tableSize / 2)); 38 | if (count > halfsize) 39 | { 40 | over = true; 41 | } 42 | 43 | count++; 44 | } 45 | else 46 | { 47 | samples[i] = (float(count) / float (tableSize /2)); 48 | count--; 49 | } 50 | } 51 | } 52 | 53 | juce::AudioSampleBuffer waveTable; 54 | private: 55 | const unsigned int tableSize = 512; 56 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (Triangle); 57 | }; 58 | -------------------------------------------------------------------------------- /libs/DAFX/Utility/Block_Smoothing.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | #include "JuceHeader.h" 6 | 7 | #pragma once 8 | 9 | template 10 | class BlockSmoothing 11 | { 12 | public: 13 | BlockSmoothing() {} 14 | ~BlockSmoothing() 15 | { 16 | 17 | } 18 | 19 | void calcCoeff(FloatType& newParam, FloatType& currentParam, int bs) 20 | { 21 | inc = (newParam - currentParam) / bs; 22 | isSmoothing = true; 23 | } 24 | 25 | void prepare(int maxBlockSize) 26 | { 27 | maxBs = maxBlockSize; 28 | fac = 1.0f / (maxBs); 29 | } 30 | 31 | void calcCoeff(FloatType& newParam, FloatType& currentParam) 32 | { 33 | inc = (newParam - currentParam) * fac; 34 | isSmoothing = true; 35 | this->currentParam = ¤tParam; 36 | this->newParam = &newParam; 37 | } 38 | 39 | 40 | FloatType smoothing() 41 | { 42 | return *this->currentParam += inc; 43 | } 44 | 45 | void smooth(FloatType& newParam, FloatType& currentParam) 46 | { 47 | inc = (newParam - currentParam) * fac; 48 | isSmoothing = true; 49 | this->currentParam = ¤tParam; 50 | this->newParam = &newParam; 51 | *this->currentParam += inc * maxBs; 52 | *this->currentParam = *this->newParam; 53 | } 54 | 55 | void resetSmoother() 56 | { 57 | isSmoothing = false; 58 | *this->currentParam = *this->newParam; 59 | } 60 | 61 | 62 | bool isSmoothing = false; 63 | 64 | private: 65 | FloatType inc = 0; 66 | FloatType fac = 0; 67 | size_t maxBs = 0; 68 | FloatType* currentParam = nullptr; 69 | FloatType* newParam = nullptr; 70 | }; 71 | -------------------------------------------------------------------------------- /plugins/ParametricEQ/source/pluginparamers/PluginParameters.cpp: -------------------------------------------------------------------------------- 1 | #include "PluginParameters.h" 2 | 3 | 4 | PluginParameter::PluginParameter() 5 | { 6 | 7 | } 8 | 9 | PluginParameter::~PluginParameter() 10 | { 11 | 12 | } 13 | 14 | 15 | juce::AudioProcessorValueTreeState::ParameterLayout PluginParameter::createParameterLayout() 16 | { 17 | std::vector> params; 18 | 19 | 20 | 21 | params.push_back (std::make_unique (LOW_GAIN, 22 | LOW_GAIN_NAME, 23 | 0.f, 24 | 2.f, 25 | 0.5)); 26 | 27 | 28 | 29 | params.push_back (std::make_unique (LOW_CUTOFF_FREQUENCY, 30 | LOW_CUTOFF_FREQUENCY_NAME, 31 | 20, 32 | 5000, 33 | 10)); 34 | params.push_back(std::make_unique(HIGH_CUTOFF_FREQUENCY, 35 | HIGH_CUTOFF_FREQUENCY_NAME, 36 | 5000, 37 | 16000, 38 | 8000)); 39 | 40 | params.push_back(std::make_unique(HIGH_GAIN, 41 | HIGH_GAIN_NAME, 42 | 0.f, 43 | 2.f, 44 | 0.5)); 45 | 46 | 47 | 48 | params.push_back(std::make_unique(MID_GAIN, 49 | MID_GAIN_NAME, 50 | 0.f, 51 | 2.f, 52 | 0.5)); 53 | 54 | for (const auto & param : params) { 55 | parameterList.add(param->getParameterID()); 56 | } 57 | 58 | 59 | return { params.begin(), params.end() }; 60 | } 61 | 62 | 63 | juce::StringArray PluginParameter::getPluginParameterList() { 64 | return parameterList; 65 | } 66 | -------------------------------------------------------------------------------- /libs/DAFX/Filters/SecondOrder-butterworth-bandstop.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | SecondOrder-butterworth-bandstop.h 5 | Created: 17 Jul 2023 3:07:30pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | // See Designing Audio Effect Plugins in C++ -> Will C. Pirkle 11 | #pragma once 12 | 13 | #include "JuceHeader.h" 14 | 15 | class SecondOrder_Butterworth_bandstop 16 | { 17 | public: 18 | SecondOrder_Butterworth_bandstop(){} 19 | 20 | ~SecondOrder_Butterworth_bandstop(){} 21 | 22 | void prepare(float sampleRate, int blocksize) 23 | { 24 | m_sampleRate = sampleRate; 25 | bs = blocksize; 26 | a0 = 0; 27 | a1 = 0; 28 | a2 = 0; 29 | b1 = 0; 30 | b2 = 0; 31 | m_a0 = 0; 32 | m_a1 = 0; 33 | m_a2 = 0; 34 | m_b1 = 0; 35 | m_b2 = 0; 36 | } 37 | 38 | void setParams(float fc, float bw) 39 | { 40 | K = tan((M_PI * fc) / m_sampleRate); 41 | Q = (1.0 / bw); 42 | } 43 | 44 | void process(float* input) 45 | { 46 | if(K != current_K || Q != current_q) 47 | { 48 | inc_K = (K - current_K) / bs; 49 | inc_q = (Q - current_q) / bs; 50 | for(int i = 0; i < bs; i++) 51 | { 52 | 53 | current_K += inc_K; 54 | current_q += inc_q; 55 | 56 | om = current_K * current_K * current_q + current_K + current_q; 57 | m_a0 = (current_q *(current_K * current_K + 1.0)) / om; 58 | m_a1 = (current_q * 2.0* (current_K * current_K - 1.0)) / om; 59 | m_a2 = m_a0; 60 | m_b1 = (2.0* current_q *(current_K * current_K - 1.0)) / om; 61 | m_b2 = (current_K * current_K * current_q - current_K + current_q) / om; 62 | b0 = a0 * m_a0 + a1 * m_a1 + a2 * m_a2 - b1 * m_b1 - b2 * m_b2; 63 | 64 | b2 = b1; 65 | b1 = b0; 66 | a2 = a1; 67 | a1 = a0; 68 | a0 = input[i]; 69 | input[i] = b0; 70 | } 71 | current_K = K; 72 | current_q = Q; 73 | } 74 | else 75 | { 76 | for(int i = 0; i < bs; i++) 77 | { 78 | b0 = a0 * m_a0 + a1 * m_a1 + a2 * m_a2 - b1 * m_b1 - b2 * m_b2; 79 | b2 = b1; 80 | b1 = b0; 81 | a2 = a1; 82 | a1 = a0; 83 | a0 = input[i]; 84 | input[i] = b0; 85 | } 86 | } 87 | } 88 | 89 | private: 90 | float bw_; 91 | float current_K; 92 | float inc_q; 93 | float fc_; 94 | float current_fc; 95 | float inc_K; 96 | float m_sampleRate; 97 | int bs; 98 | float a0, a1, a2; 99 | float b0,b1, b2; 100 | float m_a0, m_a1, m_a2; 101 | float m_b1, m_b2; 102 | float K , om; 103 | float current_q; 104 | float Q; 105 | }; 106 | -------------------------------------------------------------------------------- /libs/DAFX/CombFilters/FIRCombFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | FIRCombFilter.h 5 | Created: 8 Apr 2023 7:47:46pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "../DelayLine/DelayLine.h" 13 | class FIRComb { 14 | public: 15 | FIRComb() 16 | { 17 | ffdelayLine = std::make_unique(); 18 | smoother = std::make_unique(); 19 | } 20 | ~FIRComb(){} 21 | 22 | void prepare(int delayLineSize, int& maxBlockSize, double sampleRate) noexcept 23 | { 24 | ffdelayLine->prepare(delayLineSize, maxBlockSize); 25 | ms = delayLineSize; 26 | ffdelayLine->setParams(delayLineSize); 27 | 28 | // 29 | this->sampleRate = sampleRate; 30 | } 31 | 32 | void setFrequency(float hz, float t60) 33 | { 34 | D = 1000.f / hz; 35 | ffdelayLine->setParams(D * sampleRate * 0.001f); 36 | //with other values of gain(0.5) it might become instable 37 | // beware of 0 gain != 0 never 38 | float temp = 20.f * log10(0.5); 39 | float temp2 = exp(log(0.001) * (-60.f * D / temp)); 40 | a = pow(10.f, temp2 / 20.f); 41 | //(); 42 | smoother->calcCoeff(a, current_a, current_bs); 43 | } 44 | 45 | 46 | 47 | 48 | void process(juce::AudioBuffer& buffer, int bs) 49 | { 50 | current_bs = bs; 51 | const float* leftInRPtr = buffer.getReadPointer(0); 52 | const float* rightInRPtr = buffer.getReadPointer(1); 53 | 54 | float* leftOutRPtr = buffer.getWritePointer(0); 55 | float* rightOutRPtr = buffer.getWritePointer(1); 56 | if(smoother->isSmoothing == true) 57 | { 58 | while(bs > 0) 59 | { 60 | 61 | 62 | const float leftIn = *leftInRPtr++; 63 | const float rightIn = *rightInRPtr; 64 | 65 | 66 | 67 | *leftOutRPtr++ = leftIn + ffdelayLine->processBlock(leftIn,current_bs) * smoother->smoothing(current_a); 68 | float rightOut = *rightOutRPtr++; 69 | bs--; 70 | } 71 | current_a = a; 72 | smoother->resetSmoother(); 73 | } 74 | else 75 | { 76 | while(bs > 0) 77 | { 78 | const float leftIn = *leftInRPtr++; 79 | const float rightIn = *rightInRPtr; 80 | 81 | *leftOutRPtr++ = leftIn + ffdelayLine->processBlock(leftIn,current_bs) * current_a; 82 | float rightOut = *rightOutRPtr++; 83 | bs--; 84 | } 85 | } 86 | } 87 | 88 | 89 | 90 | 91 | 92 | private: 93 | std::unique_ptr ffdelayLine; 94 | std::unique_ptr smoother; 95 | float sampleRate = 0; 96 | float D = 0; 97 | float a = 0; 98 | float current_a = 0; 99 | int current_bs = 0; 100 | float ms = 0; 101 | juce::AudioBuffer delayLine; 102 | }; 103 | 104 | -------------------------------------------------------------------------------- /libs/DAFX/Filters/SecondOrder-Shelving-Filters.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | SecondOrder-Shelving-Filters.h 5 | Created: 5 Apr 2023 11:13:35am 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | 14 | class SecondOrderBandPassShelfFilter { 15 | 16 | public: 17 | SecondOrderBandPassShelfFilter() {}; 18 | ~SecondOrderBandPassShelfFilter() {}; 19 | // Call this in perpare to play 20 | void prepare(float sampleRate, int blockSize) noexcept 21 | { 22 | fs = sampleRate; 23 | bs = blockSize; 24 | xh[0] = 0; 25 | xh[1] = 0; 26 | current_Wc = 0; 27 | current_V0 = 0; 28 | current_Wb = 0; 29 | } 30 | 31 | void setParams(float fc,float bw, float g) 32 | { 33 | // Wc is normalized cut-off frequency 0 0){ 57 | c = (tan((M_PI* current_Wb)/2.0)-1.0) / (tan((M_PI * current_Wb)/2.0)+1.0); 58 | } else { 59 | c = (tan((M_PI* current_Wb)/2.0)-current_V0) / (tan((M_PI * current_Wb)/2.0)+current_V0); 60 | } 61 | H0 = current_V0 -1.0; 62 | d = -cos(M_PI * current_Wc); 63 | xh_new = input[i] - d * (1.0 - c) * xh[0] + c * xh[1]; 64 | ap_y = -c * xh_new + d * (1.0 - c) * xh[0] + xh[1]; 65 | xh[1] = xh[0]; 66 | xh[0] = xh_new; 67 | input[i] = 0.5 * H0 *(input[i] - ap_y) + input[i]; 68 | 69 | } 70 | current_Wc = Wc; 71 | current_Wb = Wb; 72 | current_V0 = V0; 73 | } else { 74 | for(int i = 0; i < bs; i++){ 75 | xh_new = input[i] - d * (1.0 - c) * xh[0] + c * xh[1]; 76 | ap_y = -c * xh_new + d * (1.0 - c) * xh[0] + xh[1]; 77 | xh[1] = xh[0]; 78 | xh[0] = xh_new; 79 | input[i] = 0.5 * H0 *(input[i] - ap_y) + input[i]; 80 | } 81 | } 82 | } 83 | 84 | 85 | 86 | private: 87 | float fs = 0; 88 | size_t bs = 0; 89 | float Wc = 0; 90 | float V0 = 0; 91 | float Wb = 0; 92 | float ap_y = 0; 93 | float G = 0; 94 | float current_Wc = 0; 95 | float inc_Wc = 0; 96 | float current_V0 = 0; 97 | float inc_V0 = 0; 98 | float current_Wb = 0; 99 | float inc_Wb = 0; 100 | float c = 0; 101 | float d = 0; 102 | float H0 = 0; 103 | float xh_new = 0; 104 | float xh[2] = {0}; 105 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SecondOrderBandPassShelfFilter); 106 | }; 107 | -------------------------------------------------------------------------------- /libs/DAFX/Filters/so_hpf_butterworth.h: -------------------------------------------------------------------------------- 1 | // See Designing Audio Effect Plugins in C++ -> Will C. Pirkle 2 | 3 | #pragma once 4 | #include "JuceHeader.h" 5 | #include "math.h" 6 | class So_Hpf_Butter 7 | { 8 | public: 9 | So_Hpf_Butter() {} 10 | ~So_Hpf_Butter() {} 11 | 12 | void prepare(float sr) noexcept 13 | { 14 | m_sr = sr; 15 | a0 = 0; 16 | a1 = 0; 17 | a2 = 0; 18 | b1 = 0; 19 | b2 = 0; 20 | } 21 | 22 | void setCutoff(float fc) 23 | { 24 | m_c = tan((M_PI* fc) / m_sr); 25 | } 26 | 27 | void process(juce::AudioBuffer& bufferToProcess, int bs) 28 | { 29 | const float* inputL = bufferToProcess.getReadPointer(0); 30 | const float* inputR = bufferToProcess.getReadPointer(1); 31 | float* outL = bufferToProcess.getWritePointer(0); 32 | float* outR = bufferToProcess.getWritePointer(1); 33 | if(m_c != temp_c) 34 | { 35 | // this works for block based processing 36 | c_inc = (m_c - temp_c) / bs; 37 | for (int i = 0; i < bs; ++i) 38 | { 39 | //y(n) = a0*x(n) + a1*x(n-1) + a2*x(n-2) - b*y(n-1) + b2*y(n-2) 40 | temp_c += c_inc; 41 | a0 = 1.0 / (1.0 + sqrt2*temp_c + pow(temp_c, 2.0)); 42 | a1 = -2.0 * a0; 43 | a2 = a0; 44 | b1 = 2.0 * a0*(pow(temp_c, 2.0) - 1.0); 45 | //m_coeffs.a0 * (1.0 - sqrt2*c + pow(c, 2.0)); 46 | b2 = a0 * (1.0 - sqrt2*temp_c + pow(temp_c, 2.0)); 47 | const float inL = inputL[i]; 48 | const float inR = inputR[i]; 49 | b_0L = a_0L * a0 + a_1L * a1 + a_2L * a2 - b_1L * b1 - b_2L * b2; 50 | b_0R = a_0R * a0 + a_1R * a1 + a_2R * a2 - b_1R * b1 - b_2R * b2; 51 | 52 | b_2L = b_1L; 53 | b_1L = b_0L; 54 | a_2L = a_1L; 55 | a_1L = a_0L; 56 | a_0L = inL; 57 | 58 | b_2R = b_1R; 59 | b_1R = b_0R; 60 | a_2R = a_1R; 61 | a_1R = a_0R; 62 | a_0R = inR; 63 | 64 | outL[i] = b_0L; 65 | outR[i] = b_0R; 66 | } 67 | temp_c = m_c; 68 | } else { 69 | for (int i = 0; i < bs; ++i) 70 | { 71 | 72 | 73 | const float inL = inputL[i]; 74 | const float inR = inputR[i]; 75 | b_0L = a_0L * a0 + a_1L * a1 + a_2L * a2 - b_1L * b1 - b_2L * b2; 76 | b_0R = a_0R * a0 + a_1R * a1 + a_2R * a2 - b_1R * b1 - b_2R * b2; 77 | 78 | b_2L = b_1L; 79 | b_1L = b_0L; 80 | a_2L = a_1L; 81 | a_1L = a_0L; 82 | a_0L = inL; 83 | 84 | b_2R = b_1R; 85 | b_1R = b_0R; 86 | a_2R = a_1R; 87 | a_1R = a_0R; 88 | a_0R = inR; 89 | 90 | outL[i] = b_0L; 91 | outR[i] = b_0R; 92 | } 93 | } 94 | 95 | } 96 | private: 97 | const float sqrt2 = (2.0f * 0.707106781186547524401f); 98 | float m_sr; 99 | float m_c; 100 | float temp_c; 101 | float c_inc = 0; 102 | float a0,a1,a2; 103 | float b1,b2; 104 | 105 | float a_0L,a_1L,a_2L; 106 | float b_0L,b_1L,b_2L; 107 | float a_0R,a_1R,a_2R; 108 | float b_0R,b_1R,b_2R; 109 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (So_Hpf_Butter) 110 | }; 111 | -------------------------------------------------------------------------------- /libs/DAFX/Filters/so_low_butterworth.h: -------------------------------------------------------------------------------- 1 | // See Designing Audio Effect Plugins in C++ -> Will C. Pirkle 2 | 3 | #pragma once 4 | #include "JuceHeader.h" 5 | #include "math.h" 6 | class So_Low_Butter 7 | { 8 | public: 9 | So_Low_Butter() {} 10 | ~So_Low_Butter() {} 11 | 12 | void prepare(float sr) noexcept 13 | { 14 | m_sr = sr; 15 | a0 = 0; 16 | a1 = 0; 17 | a2 = 0; 18 | b1 = 0; 19 | b2 = 0; 20 | } 21 | 22 | void setCutoff(float fc) 23 | { 24 | m_c = 1.0 / tan((M_PI* fc) / m_sr); 25 | } 26 | 27 | void process(juce::AudioBuffer& bufferToProcess, int bs) 28 | { 29 | const float* inputL = bufferToProcess.getReadPointer(0); 30 | const float* inputR = bufferToProcess.getReadPointer(1); 31 | float* outL = bufferToProcess.getWritePointer(0); 32 | float* outR = bufferToProcess.getWritePointer(1); 33 | if(m_c != temp_c) 34 | { 35 | // this works for block based processing 36 | c_inc = (m_c - temp_c) / bs; 37 | for (int i = 0; i < bs; ++i) 38 | { 39 | //y(n) = a0*x(n) + a1*x(n-1) + a2*x(n-2) - b*y(n-1) + b2*y(n-2) 40 | temp_c += c_inc; 41 | a0 = 1.0 / (1.0 + sqrt2*temp_c + pow(temp_c, 2.0)); 42 | a1 = 2.0 * a0; 43 | a2 = a0; 44 | b1 = 2.0 * a0*( 1.0 - pow(temp_c, 2.0) ); 45 | //m_coeffs.a0 * (1.0 - sqrt2*c + pow(c, 2.0)); 46 | b2 = a0 * (1.0 - sqrt2*temp_c + pow(temp_c, 2.0)); 47 | const float inL = inputL[i]; 48 | const float inR = inputR[i]; 49 | b_0L = a_0L * a0 + a_1L * a1 + a_2L * a2 - b_1L * b1 - b_2L * b2; 50 | b_0R = a_0R * a0 + a_1R * a1 + a_2R * a2 - b_1R * b1 - b_2R * b2; 51 | 52 | b_2L = b_1L; 53 | b_1L = b_0L; 54 | a_2L = a_1L; 55 | a_1L = a_0L; 56 | a_0L = inL; 57 | 58 | b_2R = b_1R; 59 | b_1R = b_0R; 60 | a_2R = a_1R; 61 | a_1R = a_0R; 62 | a_0R = inR; 63 | 64 | outL[i] = b_0L; 65 | outR[i] = b_0R; 66 | } 67 | temp_c = m_c; 68 | } else { 69 | for (int i = 0; i < bs; ++i) 70 | { 71 | 72 | 73 | const float inL = inputL[i]; 74 | const float inR = inputR[i]; 75 | b_0L = a_0L * a0 + a_1L * a1 + a_2L * a2 - b_1L * b1 - b_2L * b2; 76 | b_0R = a_0R * a0 + a_1R * a1 + a_2R * a2 - b_1R * b1 - b_2R * b2; 77 | 78 | b_2L = b_1L; 79 | b_1L = b_0L; 80 | a_2L = a_1L; 81 | a_1L = a_0L; 82 | a_0L = inL; 83 | 84 | b_2R = b_1R; 85 | b_1R = b_0R; 86 | a_2R = a_1R; 87 | a_1R = a_0R; 88 | a_0R = inR; 89 | 90 | outL[i] = b_0L; 91 | outR[i] = b_0R; 92 | } 93 | } 94 | 95 | } 96 | private: 97 | const float sqrt2 = (2.0f * 0.707106781186547524401f); 98 | float m_sr; 99 | float m_c; 100 | float temp_c; 101 | float c_inc = 0; 102 | float a0,a1,a2; 103 | float b1,b2; 104 | 105 | float a_0L,a_1L,a_2L; 106 | float b_0L,b_1L,b_2L; 107 | float a_0R,a_1R,a_2R; 108 | float b_0R,b_1R,b_2R; 109 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (So_Low_Butter) 110 | }; 111 | -------------------------------------------------------------------------------- /libs/DAFX/DelayLine/DelayLine.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | DelayLine.h 5 | Created: 13 Apr 2023 11:08:39am 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | 13 | #include "JuceHeader.h" 14 | #include "../Utility/Interpolation.h" 15 | #include "../Utility/Block_Smoothing.h" 16 | 17 | template 18 | class DelayLine 19 | { 20 | public: 21 | DelayLine() 22 | { 23 | smoother_DelayTime = std::make_unique>(); 24 | smoother_Fraction = std::make_unique>(); 25 | cubicInter = std::make_unique>(); 26 | } 27 | ~DelayLine(){} 28 | 29 | void prepare(int delayLineSize, int& maxBlockSize, int channels) 30 | { 31 | this->channels = channels; 32 | buffer.resize(delayLineSize); 33 | std::fill(buffer.begin(), buffer.end(), 0.0f); 34 | // delBuffer(&buffer); 35 | //delBuffer.clear(); 36 | size = delayLineSize; 37 | 38 | smoother_DelayTime->prepare(maxBlockSize); 39 | smoother_Fraction->prepare(maxBlockSize); 40 | } 41 | 42 | void setParams(float del) 43 | { 44 | float temp = floor(del); 45 | fract = del - temp; 46 | delay = temp; 47 | 48 | smoother_DelayTime->smooth(delay, current_delay); 49 | smoother_Fraction->smooth(fract, current_fract); 50 | } 51 | 52 | void incrementDelayLine() 53 | { 54 | writePointer = (writePointer + 1) % size; 55 | } 56 | 57 | 58 | void resetDLine() 59 | { 60 | writePointer = 0; 61 | readPointer = 0; 62 | k = 0; 63 | } 64 | 65 | void resetSmoother() 66 | { 67 | smoother_DelayTime->resetSmoother(); 68 | smoother_Fraction->resetSmoother(); 69 | } 70 | 71 | 72 | 73 | 74 | 75 | const FloatType processBlockInter(FloatType input) 76 | { 77 | 78 | 79 | const FloatType* delRead = buffer.data(); 80 | FloatType* delWrite = buffer.data(); 81 | 82 | delWrite[writePointer] = (input); 83 | 84 | if (smoother_DelayTime->isSmoothing) 85 | { 86 | readPointer = (writePointer - current_delay); 87 | 88 | if (readPointer - 3 < 0) 89 | { 90 | readPointer += size; 91 | } 92 | 93 | const FloatType y0 = delRead[(readPointer - 3) % size]; 94 | const FloatType y1 = delRead[(readPointer - 2) % size]; 95 | const FloatType y2 = delRead[(readPointer - 1) % size]; 96 | const FloatType y3 = delRead[(readPointer) % size]; 97 | 98 | const FloatType output = cubicInter->cubic(y0, y1, y2, y3, current_fract); 99 | this->incrementDelayLine(); 100 | return output; 101 | } 102 | else 103 | { 104 | const FloatType y0 = delRead[(writePointer - int(current_delay) + size) % size]; 105 | this->incrementDelayLine(); 106 | return y0; 107 | } 108 | } 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | std::unique_ptr> smoother_DelayTime; 117 | std::unique_ptr> smoother_Fraction; 118 | private: 119 | std::vector buffer; 120 | // delBuffer; 121 | size_t current_bs = 0; 122 | float fract = 0; 123 | float delay = 0; 124 | float current_fract = 0; 125 | float current_delay = 0; 126 | std::unique_ptr> cubicInter; 127 | size_t readPointer = 0; 128 | size_t writePointer = 0; 129 | size_t k = 1; 130 | size_t channels = 0; 131 | size_t size = 0; 132 | }; 133 | 134 | 135 | 136 | 137 | -------------------------------------------------------------------------------- /libs/DAFX/LFO/WaveTableOscillator.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | WaveTableOscillator.h 5 | Created: 22 Apr 2023 3:15:11pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | #include "../Utility/Interpolation.h" 14 | template 15 | class WaveTableOscillator 16 | { 17 | public: 18 | WaveTableOscillator(std::shared_ptr waveShape) : 19 | waveShape(waveShape), 20 | //pointer ownership 21 | tableSize(waveShape->waveTable.getNumSamples() - 1), 22 | wavetable(&waveShape->waveTable) 23 | {}; 24 | 25 | ~WaveTableOscillator(){} ; 26 | 27 | void prepare(float sampleRate, int blocksize) 28 | { 29 | //prepare sampleRate 30 | m_sampleRate = sampleRate; 31 | bs = blocksize; 32 | lastTableDelta = 0.0f; 33 | } 34 | 35 | 36 | void setFrequency (float frequency) 37 | { 38 | //get the frequency for OSC 39 | auto tableSizeOverSampleRate = (float) tableSize / m_sampleRate; 40 | tableDelta = frequency * tableSizeOverSampleRate; 41 | } 42 | 43 | float getNextSample() noexcept 44 | { 45 | if(tableDelta != lastTableDelta) 46 | { 47 | increment = (tableDelta - lastTableDelta) / bs; 48 | for(int i = 0; i < bs; i++) 49 | { 50 | tableDelta += increment; 51 | auto index0 = (unsigned int) currentIndex; 52 | auto index1 = index0 + 1; 53 | auto index2 = index0 + 2; 54 | auto index3 = index0 + 3; 55 | auto frac = currentIndex - (float) index0; 56 | 57 | auto* table = wavetable->getReadPointer (0); 58 | auto value0 = table[index0 % tableSize]; 59 | auto value1 = table[index1 % tableSize]; 60 | auto value2 = table[index2 % tableSize]; 61 | auto value3 = table[index3 % tableSize]; 62 | currentSample = cubicInterpolation(value0, value1, value2, value3, frac); 63 | if ((currentIndex += tableDelta) > (float) tableSize) 64 | currentIndex -= (float) tableSize; 65 | } 66 | lastTableDelta = tableDelta; 67 | } 68 | else 69 | { 70 | for(int i = 0; i < bs; i++) 71 | { 72 | auto index0 = (unsigned int) currentIndex; 73 | auto index1 = index0 + 1; 74 | auto index2 = index0 + 2; 75 | auto index3 = index0 + 3; 76 | auto frac = currentIndex - (float) index0; 77 | auto* table = wavetable->getReadPointer (0); 78 | auto value0 = table[index0 % tableSize]; 79 | auto value1 = table[index1 % tableSize]; 80 | auto value2 = table[index2 % tableSize]; 81 | auto value3 = table[index3 % tableSize]; 82 | currentSample = cubicInterpolation(value0, value1, value2, value3, frac); 83 | if ((currentIndex += tableDelta) > (float) tableSize) 84 | currentIndex -= (float) tableSize; 85 | } 86 | } 87 | 88 | return currentSample; 89 | } 90 | 91 | 92 | 93 | 94 | private: 95 | //private Variablen 96 | float m_sampleRate = 0; 97 | float currentIndex = 0.0, tableDelta = 0.0; 98 | float lastTableDelta = 0.0; 99 | float increment = 0.0; 100 | float bs = 0; 101 | std::shared_ptr waveShape; 102 | const int tableSize; 103 | juce::AudioSampleBuffer* wavetable; 104 | float currentSample = 0.0; 105 | // check last index for fade in and out 106 | unsigned int lastIndex = 0; 107 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WaveTableOscillator); 108 | }; 109 | -------------------------------------------------------------------------------- /libs/DAFX/Filters/FirstOrder-Filters.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | FirstOrder-Filters.h 5 | Created: 3 Apr 2023 5:39:05pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | #include "JuceHeader.h" 11 | #include "../Utility/Block_Smoothing.h" 12 | #pragma once 13 | 14 | 15 | 16 | template 17 | class FirstOrderAllPass 18 | { 19 | public: 20 | FirstOrderAllPass(FloatType sign) 21 | { 22 | smoother_Cutoff = std::make_unique>(); 23 | // 1.0 = lowpass , -1.0 = highpass 24 | flip = sign; 25 | } 26 | ~FirstOrderAllPass() {}; 27 | 28 | //Call this in prepare to play 29 | void prepare(float sampleRate, int blocksize) noexcept 30 | { 31 | Fs = sampleRate; 32 | smoother_Cutoff->prepare(blocksize); 33 | } 34 | void setCutoff(float fc) 35 | { 36 | // Wc is normalized cut-off frequency 0::pi * Wc) / 2.0) - 1.0) / (tan((juce::MathConstants::pi * Wc) / 2.0) + 1.0); 39 | 40 | smoother_Cutoff->calcCoeff(c,current_c); 41 | 42 | } 43 | template 44 | void process(const ProcessContext& context) noexcept 45 | { 46 | const auto& inputBlock = context.getInputBlock(); 47 | auto& outputBlock = context.getOutputBlock(); 48 | const auto numChannels = outputBlock.getNumChannels(); 49 | const auto numSamples = outputBlock.getNumSamples(); 50 | 51 | for (size_t channel = 0; channel < numChannels; ++channel) 52 | { 53 | auto* inputSamples = inputBlock.getChannelPointer(channel); 54 | auto* outputSamples = outputBlock.getChannelPointer(channel); 55 | if (smoother_Cutoff->isSmoothing) 56 | { 57 | for (int i = 0; i < numSamples; i++) 58 | { 59 | 60 | xh_new = inputSamples[i] - smoother_Cutoff->smoothing() * xh; 61 | ap_y = current_c * xh_new + xh; 62 | xh = xh_new; 63 | outputSamples[i] = scale * (inputSamples[i] + (ap_y* flip)); 64 | } 65 | smoother_Cutoff->resetSmoother(); 66 | } 67 | else 68 | { 69 | for (int i = 0; i < numSamples; i++) 70 | { 71 | xh_new = inputSamples[i] - current_c * xh; 72 | ap_y = current_c * xh_new + xh; 73 | xh = xh_new; 74 | outputSamples[i] = scale * (inputSamples[i] + (ap_y * flip)); 75 | } 76 | } 77 | } 78 | 79 | } 80 | 81 | const FloatType processBlockInter(FloatType input) 82 | { 83 | if (smoother_Cutoff->isSmoothing) 84 | { 85 | xh_new = input - smoother_Cutoff->smoothing() * xh; 86 | ap_y = current_c * xh_new + xh; 87 | xh = xh_new; 88 | FloatType out = scale * (input + (ap_y * flip)); 89 | return out; 90 | } 91 | else 92 | { 93 | xh_new = input - current_c * xh; 94 | ap_y = current_c * xh_new + xh; 95 | xh = xh_new; 96 | FloatType out = scale * (input + (ap_y * flip)); 97 | return out; 98 | } 99 | } 100 | 101 | 102 | 103 | 104 | std::unique_ptr> smoother_Cutoff; 105 | 106 | private: 107 | 108 | float Fs = 0; 109 | float Wc = 0; 110 | float current_Wc = 0; 111 | FloatType current_c = 0; 112 | FloatType c = 0; 113 | FloatType xh = 0; 114 | FloatType xh_new = 0; 115 | FloatType ap_y = 0; 116 | const FloatType scale = 0.5; 117 | FloatType flip = 1.0; 118 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FirstOrderAllPass); 119 | }; -------------------------------------------------------------------------------- /libs/DAFX/CombFilters/UniversalCombFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | UniversalCombFilter.h 5 | Created: 10 Apr 2023 11:03:36am 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "../DelayLine/DelayLine.h" 13 | template 14 | class UniversalComb { 15 | public: 16 | UniversalComb() 17 | { 18 | fbdelayLine = std::make_unique>(); 19 | ffdelayLine = std::make_unique>(); 20 | smoother = std::make_unique>(); 21 | 22 | 23 | } 24 | ~UniversalComb(){} 25 | 26 | void prepare(int delayLineSize, int maxBlockSize, double cur_sampleRate, int channels) noexcept 27 | { 28 | ffdelayLine->prepare(delayLineSize, maxBlockSize, channels); 29 | fbdelayLine->prepare(delayLineSize,maxBlockSize, channels); 30 | 31 | smoother->prepare(maxBlockSize); 32 | this->sampleRate = cur_sampleRate; 33 | tempFB = 0; 34 | tempFF = 0; 35 | 36 | } 37 | void setFrequency(float hz) 38 | { 39 | const float period = 1.f / hz; 40 | float delayTimeSamples = (period * sampleRate); 41 | ffdelayLine->setParams(delayTimeSamples); 42 | fbdelayLine->setParams(delayTimeSamples); 43 | 44 | } 45 | void setLinGain(float g) 46 | { 47 | a = g; 48 | smoother->smooth(a, current_a); 49 | } 50 | 51 | template 52 | void process(const ProcessContext& context) noexcept 53 | { 54 | 55 | const auto& inputBlock = context.getInputBlock(); 56 | auto& outputBlock = context.getOutputBlock(); 57 | const auto numChannels = outputBlock.getNumChannels(); 58 | const auto numSamples = outputBlock.getNumSamples(); 59 | 60 | 61 | FloatType input; 62 | 63 | if (ffdelayLine->smoother_DelayTime->isSmoothing == true) 64 | { 65 | for (size_t channel = 0; channel < numChannels; ++channel) 66 | { 67 | auto* inputSamples = inputBlock.getChannelPointer(channel); 68 | auto* outputSamples = outputBlock.getChannelPointer(channel); 69 | for (int i = 0; i < numSamples; i++) 70 | { 71 | input = inputSamples[i]; 72 | tempFF = ffdelayLine->processBlockInter(input * current_a); 73 | tempFB = (input)+tempFF + fbdelayLine->processBlockInter(tempFB * current_a);; 74 | outputSamples[i] = scale * (tempFB); 75 | 76 | 77 | } 78 | } 79 | ffdelayLine->resetSmoother(); 80 | fbdelayLine->resetSmoother(); 81 | } 82 | else 83 | { 84 | for (size_t channel = 0; channel < numChannels; ++channel) 85 | { 86 | auto* inputSamples = inputBlock.getChannelPointer(channel); 87 | auto* outputSamples = outputBlock.getChannelPointer(channel); 88 | for (int i = 0; i < numSamples; i++) 89 | { 90 | input = inputSamples[i]; 91 | tempFF = ffdelayLine->processBlockInter(input * current_a); 92 | tempFB = (input)+tempFF + fbdelayLine->processBlockInter(tempFB * current_a); 93 | outputSamples[i] = scale * (tempFB); 94 | } 95 | } 96 | } 97 | } 98 | 99 | 100 | private: 101 | std::unique_ptr> ffdelayLine; 102 | std::unique_ptr> fbdelayLine; 103 | std::unique_ptr> smoother; 104 | 105 | double sampleRate = 0; 106 | float a = 0; 107 | float current_a = 0; 108 | int current_bs = 0; 109 | FloatType tempFB = 0; 110 | FloatType tempFF = 0; 111 | 112 | const FloatType scale = 0.1; 113 | }; 114 | 115 | 116 | -------------------------------------------------------------------------------- /libs/DAFX/CombFilters/IIRCombFilter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | IIRCombFilter.h 5 | Created: 8 Apr 2023 11:11:09pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "../Utility/Interpolation.h" 13 | class IIRComb { 14 | public: 15 | IIRComb(){} 16 | ~IIRComb(){} 17 | // A low Size is better like delayLineSize = 10 18 | void prepare(unsigned int delayLineSize) 19 | { 20 | delayLine.setSize(1, delayLineSize + 1); 21 | 22 | delayLine.clear(); 23 | current_g = 0; 24 | current_delay = 0; 25 | current_fract = 0; 26 | size = delayLineSize; 27 | } 28 | //delay should be smaller than size 29 | //g should be from -0.90 to 0.90 if you want higher values you should scale the output after the comb filter 30 | 31 | void setParams(float d,float g) 32 | { 33 | float temp = (int)floor(d); 34 | fract = d - temp; 35 | delay = int(d); 36 | gain = g; 37 | } 38 | 39 | 40 | void process(float* input, const int bs) 41 | { 42 | float* delayWtr = delayLine.getWritePointer(0); 43 | if(current_delay != delay) 44 | { 45 | 46 | inc_delay = (delay - current_delay) / bs; 47 | inc_fract = (fract - current_fract) / bs; 48 | 49 | for(int i = 0; i < bs; i++) 50 | { 51 | current_delay += inc_delay; 52 | current_fract += inc_fract; 53 | readPointer = (writePointer - current_delay + size); 54 | readPointer = (readPointer) % size; 55 | if(readPointer - 3 < 0 ) 56 | { 57 | readPointer = readPointer + size; 58 | } 59 | delayWtr[writePointer] = output; 60 | const float y0 = delayWtr[(readPointer - 3) % size]; 61 | const float y1 = delayWtr[(readPointer - 2) % size]; 62 | const float y2 = delayWtr[(readPointer - 1) % size]; 63 | const float y3 = delayWtr[(readPointer) % size]; 64 | //less artifacts with higher interpolation methods 65 | const float x_est = splineInterpolation(y0, y1, y2, y3, current_fract); 66 | writePointer++; 67 | if (writePointer >= size) 68 | { 69 | writePointer = 0; 70 | } 71 | output = input[i] + x_est * gain; 72 | input[i] = output; 73 | } 74 | 75 | current_delay = delay; 76 | current_fract = fract; 77 | } else if (current_g != gain) { 78 | inc_g = (gain - current_g) / bs; 79 | for(int i = 0; i < bs; i++) 80 | { 81 | current_g += inc_g; 82 | delayWtr[writePointer] = output; 83 | readPointer = (writePointer - int(delay) + size) % size; 84 | const float y0 = delayWtr[readPointer]; 85 | output = input[i] + y0 * current_g; 86 | input[i] = output; 87 | writePointer = (writePointer + 1) % size; 88 | 89 | } 90 | current_g = gain; 91 | } else { 92 | for(int i = 0; i < bs; i++) 93 | { 94 | delayWtr[writePointer] = output; 95 | readPointer = (writePointer - int(delay) + size) % size; 96 | const float y0 = delayWtr[readPointer]; 97 | output = input[i] + y0 * gain; 98 | input[i] = output; 99 | writePointer = (writePointer + 1) % size; 100 | 101 | } 102 | } 103 | } 104 | 105 | 106 | 107 | 108 | 109 | private: 110 | float current_g = 0; 111 | float inc_g = 0; 112 | float gain = 0; 113 | float current_fract = 0; 114 | float current_delay = 0; 115 | float fract = 0; 116 | unsigned int delay = 0; 117 | float inc_fract = 0; 118 | float inc_delay = 0; 119 | unsigned int readPointer = 0; 120 | unsigned int writePointer = 0; 121 | unsigned int size = 0; 122 | juce::AudioBuffer delayLine; 123 | float output = 0; 124 | }; 125 | 126 | -------------------------------------------------------------------------------- /libs/DAFX/Dynamics/Limiter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Limiter.h 5 | Created: 17 Jul 2023 8:14:48pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | class Limiter 13 | { 14 | public: 15 | Limiter(){} 16 | ~Limiter(){} 17 | 18 | void prepare(int blocksize) noexcept 19 | { 20 | bs = blocksize; 21 | attack = 0; 22 | release = 0; 23 | del4 = 0; 24 | del3 = 0; 25 | del2 = 0; 26 | del1 = 0; 27 | 28 | } 29 | 30 | void setParams(float at, float rt, float th) 31 | { 32 | attack = at; 33 | release = rt; 34 | tresh = th; 35 | } 36 | 37 | void process(float* input) 38 | { 39 | if(attack != current_attack || release != current_release || tresh != current_tresh) 40 | { 41 | inc_attack = (attack - current_attack) / bs; 42 | inc_release = (release - current_release) / bs; 43 | inc_tresh = (tresh - current_tresh) / bs; 44 | for(int i = 0; i < bs; i++) 45 | { 46 | current_attack += inc_attack; 47 | current_release += inc_release; 48 | current_tresh += inc_tresh; 49 | float a = fabs(del4); 50 | if(a > 0) 51 | { 52 | coeff = current_attack; 53 | } 54 | else 55 | { 56 | coeff = current_release; 57 | } 58 | 59 | xpeak =(1 - coeff) * xpeak + coeff * a; 60 | xpeak = current_tresh / xpeak; 61 | if(xpeak > 1.0) 62 | { 63 | f = 1.0; 64 | } 65 | else 66 | { 67 | f = xpeak; 68 | } 69 | if(f > g) 70 | { 71 | coeff = current_attack; 72 | } 73 | else 74 | { 75 | coeff = current_release; 76 | } 77 | 78 | g = (1.0 - coeff) * g + coeff * f; 79 | 80 | del4 = del3 * g; 81 | del3 = del2 * g; 82 | del2 = del1 * g; 83 | del1 = input[i] * g; 84 | 85 | 86 | input[i] = del4 * g; 87 | 88 | 89 | 90 | 91 | } 92 | current_attack = attack; 93 | current_release = release; 94 | current_tresh = tresh; 95 | } 96 | else 97 | { 98 | for(int i = 0; i < bs; i++) 99 | { 100 | float a = fabs(del4); 101 | if(a > 0) 102 | { 103 | coeff = current_attack; 104 | } 105 | else 106 | { 107 | coeff = current_release; 108 | } 109 | 110 | xpeak =(1 - coeff) * xpeak + coeff * a; 111 | //here is something wrong with fmin 112 | xpeak = current_tresh / xpeak; 113 | if(xpeak > 1.0) 114 | { 115 | f = 1.0; 116 | } 117 | else 118 | { 119 | f = xpeak; 120 | } 121 | if(f > g) 122 | { 123 | coeff = current_attack; 124 | } 125 | else 126 | { 127 | coeff = current_release; 128 | } 129 | 130 | g = (1.0 - coeff) * g + coeff * f; 131 | 132 | del4 = del3 * g; 133 | del3 = del2 * g; 134 | del2 = del1 * g; 135 | del1 = input[i] * g; 136 | 137 | 138 | input[i] = del4 * g; 139 | } 140 | } 141 | 142 | 143 | 144 | } 145 | 146 | 147 | private: 148 | float attack; 149 | float release; 150 | float tresh; 151 | 152 | float current_attack; 153 | float current_release; 154 | float current_tresh; 155 | 156 | float inc_attack; 157 | float inc_release; 158 | float inc_tresh; 159 | 160 | float bs; 161 | float del1; 162 | float del2; 163 | float del3; 164 | float del4; 165 | float coeff; 166 | float xpeak; 167 | float g; 168 | float f; 169 | 170 | }; 171 | -------------------------------------------------------------------------------- /libs/DAFX/EQ/ParametricEQ.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | FirstOrder-Filters.h 5 | Created: 3 Apr 2023 5:39:05pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | #include "JuceHeader.h" 11 | #include "../Utility/Block_Smoothing.h" 12 | #include "../Filters/FirstOrder-Filters.h" 13 | #pragma once 14 | 15 | 16 | 17 | template 18 | class ParametricEQ 19 | { 20 | public: 21 | ParametricEQ() 22 | { 23 | lowPass = std::make_unique>(1.0); 24 | lowPass2 = std::make_unique>(1.0); 25 | smoother_highGain = std::make_unique>(); 26 | smoother_lowGain = std::make_unique>(); 27 | smoother_midGain = std::make_unique>(); 28 | } 29 | ~ParametricEQ() {}; 30 | 31 | //Call this in prepare to play 32 | void prepare(float sampleRate, int blockSize) noexcept 33 | { 34 | lowPass->prepare(sampleRate, blockSize); 35 | lowPass2->prepare(sampleRate, blockSize); 36 | } 37 | void setLowCutoff(float fc) 38 | { 39 | lowPass2->setCutoff(fc); 40 | 41 | } 42 | void setHighCutoff(float fc) 43 | { 44 | lowPass->setCutoff(fc); 45 | } 46 | 47 | void setHighGain(float g) 48 | { 49 | FloatType temp = g; 50 | smoother_highGain->smooth(temp, highGain); 51 | } 52 | 53 | 54 | void setMidGain(float g) 55 | { 56 | FloatType temp = g; 57 | smoother_midGain->smooth(temp, midGain); 58 | 59 | } 60 | 61 | 62 | void setLowGain(float g) 63 | { 64 | FloatType temp = g; 65 | smoother_lowGain->smooth(temp, lowGain); 66 | 67 | } 68 | template 69 | void process(const ProcessContext& context) noexcept 70 | { 71 | const auto& inputBlock = context.getInputBlock(); 72 | auto& outputBlock = context.getOutputBlock(); 73 | const auto numChannels = outputBlock.getNumChannels(); 74 | const auto numSamples = outputBlock.getNumSamples(); 75 | 76 | for (size_t channel = 0; channel < numChannels; ++channel) 77 | { 78 | auto* inputSamples = inputBlock.getChannelPointer(channel); 79 | auto* outputSamples = outputBlock.getChannelPointer(channel); 80 | if (lowPass->smoother_Cutoff->isSmoothing) 81 | { 82 | for (int i = 0; i < numSamples; i++) 83 | { 84 | FloatType input = inputSamples[i]; 85 | FloatType mid = lowPass->processBlockInter(input); 86 | FloatType high = mid - input; 87 | FloatType low = lowPass2->processBlockInter(mid); 88 | FloatType out = high * highGain + (low - mid) * midGain + low * lowGain; 89 | outputSamples[i] = out; 90 | } 91 | lowPass->smoother_Cutoff->resetSmoother(); 92 | 93 | } 94 | else if(lowPass2->smoother_Cutoff->isSmoothing) 95 | { 96 | for (int i = 0; i < numSamples; i++) 97 | { 98 | FloatType input = inputSamples[i]; 99 | FloatType mid = lowPass->processBlockInter(input); 100 | FloatType high = mid - input; 101 | FloatType low = lowPass2->processBlockInter(mid); 102 | FloatType out = high * highGain + (low - mid) * midGain + low * lowGain; 103 | outputSamples[i] = out; 104 | } 105 | lowPass2->smoother_Cutoff->resetSmoother(); 106 | } 107 | else 108 | { 109 | for (int i = 0; i < numSamples; i++) 110 | { 111 | FloatType input = inputSamples[i]; 112 | FloatType mid = lowPass->processBlockInter(input); 113 | FloatType high = mid - input; 114 | FloatType low = lowPass2->processBlockInter(mid); 115 | FloatType out = high * highGain + (low - mid) * midGain + low * lowGain; 116 | outputSamples[i] = out; 117 | } 118 | } 119 | } 120 | 121 | } 122 | 123 | std::unique_ptr> smoother_highGain; 124 | std::unique_ptr> smoother_midGain; 125 | std::unique_ptr> smoother_lowGain; 126 | 127 | private: 128 | std::unique_ptr> lowPass; 129 | std::unique_ptr> lowPass2; 130 | FloatType midGain = 0; 131 | FloatType lowGain = 0; 132 | FloatType highGain = 0; 133 | 134 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ParametricEQ); 135 | }; 136 | -------------------------------------------------------------------------------- /libs/DAFX/Filters/SecondOrder-Filters.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | SecondOrder-FIlters.h 5 | Created: 3 Apr 2023 9:01:24pm 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | class BandpassFilter { 14 | public: 15 | BandpassFilter() {}; 16 | ~BandpassFilter() {}; 17 | 18 | //Call this in prepare to play 19 | void prepare(float sampleRate, int blocksize) noexcept 20 | { 21 | Fs = sampleRate; 22 | bs = blocksize; 23 | xh[0] = 0; 24 | xh[1] = 0; 25 | current_Wc = 0; 26 | current_Wb = 0; 27 | } 28 | 29 | void setParams(float fc, float bw) 30 | { 31 | // Wc is normalized cut-off frequency 0= size) 68 | { 69 | writePointer = 0; 70 | } 71 | yn = b_0 * x_est + b_1 * xhold - a_1 * yhold; 72 | yhold = yn; 73 | xhold = x_est; 74 | const float output = input[i] + gain * yn; 75 | delWrite[writePointer] = output; 76 | input[i] = output; 77 | } 78 | current_delay = delay; 79 | current_fract = fract; 80 | 81 | } 82 | else if(gain != current_g) 83 | { 84 | inc_g = (gain - current_g) / bs; 85 | 86 | for(int i = 0; i < bs; i++) 87 | { 88 | current_g += inc_g; 89 | readPointer = (writePointer - int(delay) + size) % size; 90 | const float y0 = delRead[readPointer]; 91 | writePointer = (writePointer + 1) % size; 92 | yn = b_0 * y0 + b_1 * xhold - a_1 * yhold; 93 | yhold = yn; 94 | xhold = y0; 95 | const float output = input[i] + current_g * yn; 96 | delWrite[writePointer] = output; 97 | input[i] = output; 98 | } 99 | current_g = gain; 100 | } 101 | else 102 | { 103 | for(int i = 0; i < bs; i++) 104 | { 105 | readPointer = (writePointer - int(delay) + size) % size; 106 | const float y0 = delRead[readPointer]; 107 | writePointer = (writePointer + 1) % size; 108 | yn = b_0 * y0 + b_1 * xhold - a_1 * yhold; 109 | yhold = yn; 110 | xhold = y0; 111 | const float output = input[i] + gain * yn; 112 | delWrite[writePointer] = output; 113 | input[i] = output; 114 | } 115 | } 116 | } 117 | 118 | 119 | 120 | 121 | 122 | private: 123 | float current_g = 0; 124 | float inc_g = 0; 125 | float b_0 = 0.5; 126 | float b_1 = 0.5; 127 | float a_1 = 0.7; 128 | float g = 0.5; 129 | float xhold = 0; 130 | float yhold = 0; 131 | float gain = 0; 132 | float current_fract = 0; 133 | float current_delay = 0; 134 | float fract = 0; 135 | float delay = 0; 136 | float inc_fract = 0; 137 | float inc_delay = 0; 138 | unsigned int readPointer = 0; 139 | unsigned int read2 = 0; 140 | unsigned int writePointer = 0; 141 | unsigned int write2 = 0; 142 | int size = 0; 143 | juce::AudioBuffer delayLine; 144 | float yn; 145 | unsigned int finalsize; 146 | }; 147 | 148 | -------------------------------------------------------------------------------- /plugins/CombFilter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The first line of any CMake project should be a call to `cmake_minimum_required`, which checks 2 | # that the installed CMake will be able to understand the following CMakeLists, and ensures that 3 | # CMake's behaviour is compatible with the named version. This is a standard CMake command, so more 4 | # information can be found in the CMake docs. 5 | 6 | cmake_minimum_required(VERSION 3.24) 7 | 8 | project(RESONATOR VERSION 0.0.1) 9 | 10 | 11 | set (TARGET_NAME ${PROJECT_NAME}) 12 | 13 | if(APPLE) 14 | set (FORMATS_TO_BUILD VST3) 15 | else() 16 | set (FORMATS_TO_BUILD VST3 ) 17 | endif() 18 | 19 | 20 | 21 | juce_add_plugin(${TARGET_NAME} 22 | # VERSION ... # Set this if the plugin version is different to the project version 23 | # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone 24 | # ICON_SMALL ... 25 | COMPANY_NAME "ZELOE" 26 | # IS_SYNTH TRUE/FALSE # Is this a synth or an effect? 27 | # NEEDS_MIDI_INPUT TRUE/FALSE # Does the plugin need midi input? 28 | # NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output? 29 | # IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect? 30 | # EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus? 31 | # COPY_PLUGIN_AFTER_BUILD TRUE/FALSE # Should the plugin be installed to a default location after building? 32 | PLUGIN_MANUFACTURER_CODE ZELO # A four-character manufacturer id with at least one upper-case character 33 | PLUGIN_CODE ONEZ # A unique four-character plugin id with exactly one upper-case character 34 | # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case 35 | 36 | 37 | 38 | FORMATS ${FORMATS_TO_BUILD} # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 39 | PRODUCT_NAME ${TARGET_NAME} # The name of the final executable, which can differ from the target name 40 | ) 41 | 42 | # `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated 43 | # into your build tree. This should be included with `#include `. The include path for 44 | # this header will be automatically added to the target. The main function of the JuceHeader is to 45 | # include all your JUCE module headers; if you're happy to include module headers directly, you 46 | # probably don't need to call this. 47 | 48 | juce_generate_juce_header(${TARGET_NAME}) 49 | 50 | # Sets the cpp language minimum 51 | set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) 52 | set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) 53 | 54 | # Add all source files to file list 55 | file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/source/*.h) 56 | 57 | # Add all sources to target 58 | target_sources(${TARGET_NAME} PRIVATE ${SOURCES}) 59 | 60 | # Add include directories for all folders in the source 61 | file(GLOB_RECURSE source_dirs LIST_DIRECTORIES true ${CMAKE_CURRENT_LIST_DIR}/source/*) 62 | 63 | foreach (dir ${source_dirs}) 64 | if (IS_DIRECTORY ${dir}) 65 | target_include_directories(${TARGET_NAME} PRIVATE ${dir}) 66 | endif () 67 | endforeach () 68 | 69 | # Make the folder structure visible in the IDE 70 | source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/source PREFIX "source" FILES ${SOURCES}) 71 | 72 | 73 | # Add all source files to file list 74 | 75 | file(GLOB_RECURSE LIBS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/DAFX/**/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/DAFX/**/*.h) 76 | 77 | 78 | # Add all sources to target 79 | target_sources(${TARGET_NAME} PRIVATE ${LIBS}) 80 | 81 | # Add include directories for all folders in the source 82 | file(GLOB_RECURSE source_dirs LIST_DIRECTORIES true ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/DAFX/**/*) 83 | 84 | foreach (dir ${source_dirs}) 85 | if (IS_DIRECTORY ${dir}) 86 | target_include_directories(${TARGET_NAME} PRIVATE ${dir}) 87 | endif () 88 | endforeach () 89 | 90 | # Make the folder structure visible in the IDE 91 | source_group(TREE ${PROJECT_SOURCE_DIR}/../../libs/DAFX/ PREFIX "libs" FILES ${LIBS}) 92 | 93 | 94 | 95 | target_compile_definitions(${TARGET_NAME} 96 | PUBLIC 97 | # JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them. 98 | JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call 99 | JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call 100 | JUCE_VST3_CAN_REPLACE_VST2=0 101 | JUCE_DISPLAY_SPLASH_SCREEN=1 102 | DONT_SET_USING_JUCE_NAMESPACE=1 103 | ) 104 | 105 | 106 | 107 | target_link_libraries(${TARGET_NAME} 108 | PRIVATE 109 | juce::juce_audio_utils 110 | juce::juce_dsp 111 | juce::juce_opengl 112 | juce::juce_graphics 113 | juce::juce_gui_basics 114 | juce::juce_gui_extra 115 | 116 | 117 | PUBLIC 118 | juce::juce_recommended_config_flags 119 | juce::juce_recommended_lto_flags 120 | juce::juce_recommended_warning_flags 121 | ) -------------------------------------------------------------------------------- /plugins/ParametricEQ/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The first line of any CMake project should be a call to `cmake_minimum_required`, which checks 2 | # that the installed CMake will be able to understand the following CMakeLists, and ensures that 3 | # CMake's behaviour is compatible with the named version. This is a standard CMake command, so more 4 | # information can be found in the CMake docs. 5 | 6 | cmake_minimum_required(VERSION 3.24) 7 | 8 | project(ParametricEQ VERSION 0.0.1) 9 | 10 | 11 | set (TARGET_NAME ${PROJECT_NAME}) 12 | 13 | if(APPLE) 14 | set (FORMATS_TO_BUILD VST3) 15 | else() 16 | set (FORMATS_TO_BUILD VST3 ) 17 | endif() 18 | 19 | 20 | 21 | juce_add_plugin(${TARGET_NAME} 22 | # VERSION ... # Set this if the plugin version is different to the project version 23 | # ICON_BIG ... # ICON_* arguments specify a path to an image file to use as an icon for the Standalone 24 | # ICON_SMALL ... 25 | COMPANY_NAME "ZELOE" 26 | # IS_SYNTH TRUE/FALSE # Is this a synth or an effect? 27 | # NEEDS_MIDI_INPUT TRUE/FALSE # Does the plugin need midi input? 28 | # NEEDS_MIDI_OUTPUT TRUE/FALSE # Does the plugin need midi output? 29 | # IS_MIDI_EFFECT TRUE/FALSE # Is this plugin a MIDI effect? 30 | # EDITOR_WANTS_KEYBOARD_FOCUS TRUE/FALSE # Does the editor need keyboard focus? 31 | # COPY_PLUGIN_AFTER_BUILD TRUE/FALSE # Should the plugin be installed to a default location after building? 32 | PLUGIN_MANUFACTURER_CODE ZELO # A four-character manufacturer id with at least one upper-case character 33 | PLUGIN_CODE ONEZ # A unique four-character plugin id with exactly one upper-case character 34 | # GarageBand 10.3 requires the first letter to be upper-case, and the remaining letters to be lower-case 35 | 36 | 37 | 38 | FORMATS ${FORMATS_TO_BUILD} # The formats to build. Other valid formats are: AAX Unity VST AU AUv3 39 | PRODUCT_NAME ${TARGET_NAME} # The name of the final executable, which can differ from the target name 40 | ) 41 | 42 | # `juce_generate_juce_header` will create a JuceHeader.h for a given target, which will be generated 43 | # into your build tree. This should be included with `#include `. The include path for 44 | # this header will be automatically added to the target. The main function of the JuceHeader is to 45 | # include all your JUCE module headers; if you're happy to include module headers directly, you 46 | # probably don't need to call this. 47 | 48 | juce_generate_juce_header(${TARGET_NAME}) 49 | 50 | # Sets the cpp language minimum 51 | set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD 17) 52 | set_property(TARGET ${TARGET_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) 53 | 54 | # Add all source files to file list 55 | file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/source/*.h) 56 | 57 | # Add all sources to target 58 | target_sources(${TARGET_NAME} PRIVATE ${SOURCES}) 59 | 60 | # Add include directories for all folders in the source 61 | file(GLOB_RECURSE source_dirs LIST_DIRECTORIES true ${CMAKE_CURRENT_LIST_DIR}/source/*) 62 | 63 | foreach (dir ${source_dirs}) 64 | if (IS_DIRECTORY ${dir}) 65 | target_include_directories(${TARGET_NAME} PRIVATE ${dir}) 66 | endif () 67 | endforeach () 68 | 69 | # Make the folder structure visible in the IDE 70 | source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR}/source PREFIX "source" FILES ${SOURCES}) 71 | 72 | 73 | # Add all source files to file list 74 | 75 | file(GLOB_RECURSE LIBS CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/DAFX/**/*.cpp ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/DAFX/**/*.h) 76 | 77 | 78 | # Add all sources to target 79 | target_sources(${TARGET_NAME} PRIVATE ${LIBS}) 80 | 81 | # Add include directories for all folders in the source 82 | file(GLOB_RECURSE source_dirs LIST_DIRECTORIES true ${CMAKE_CURRENT_SOURCE_DIR}/../../libs/DAFX/**/*) 83 | 84 | foreach (dir ${source_dirs}) 85 | if (IS_DIRECTORY ${dir}) 86 | target_include_directories(${TARGET_NAME} PRIVATE ${dir}) 87 | endif () 88 | endforeach () 89 | 90 | # Make the folder structure visible in the IDE 91 | source_group(TREE ${PROJECT_SOURCE_DIR}/../../libs/DAFX/ PREFIX "libs" FILES ${LIBS}) 92 | 93 | 94 | 95 | target_compile_definitions(${TARGET_NAME} 96 | PUBLIC 97 | # JUCE_WEB_BROWSER and JUCE_USE_CURL would be on by default, but you might not need them. 98 | JUCE_WEB_BROWSER=0 # If you remove this, add `NEEDS_WEB_BROWSER TRUE` to the `juce_add_plugin` call 99 | JUCE_USE_CURL=0 # If you remove this, add `NEEDS_CURL TRUE` to the `juce_add_plugin` call 100 | JUCE_VST3_CAN_REPLACE_VST2=0 101 | JUCE_DISPLAY_SPLASH_SCREEN=1 102 | DONT_SET_USING_JUCE_NAMESPACE=1 103 | ) 104 | 105 | 106 | 107 | target_link_libraries(${TARGET_NAME} 108 | PRIVATE 109 | juce::juce_audio_utils 110 | juce::juce_dsp 111 | juce::juce_opengl 112 | juce::juce_graphics 113 | juce::juce_gui_basics 114 | juce::juce_gui_extra 115 | 116 | 117 | PUBLIC 118 | juce::juce_recommended_config_flags 119 | juce::juce_recommended_lto_flags 120 | juce::juce_recommended_warning_flags 121 | ) -------------------------------------------------------------------------------- /libs/DAFX/Filters/FirstOrder-Shelving-Filters.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | Shelving-Filters.h 5 | Created: 4 Apr 2023 11:39:50am 6 | Author: Onez 7 | 8 | ============================================================================== 9 | */ 10 | 11 | #pragma once 12 | #include "JuceHeader.h" 13 | class FirstOrderLowshelvingFilter { 14 | public: 15 | FirstOrderLowshelvingFilter() {}; 16 | ~FirstOrderLowshelvingFilter() {}; 17 | 18 | // Call this in perpare to play 19 | void prepare(float sampleRate, int blocksize) noexcept 20 | { 21 | Fs = sampleRate; 22 | bs = blocksize; 23 | current_Wc = 0; 24 | current_V0 = 0; 25 | } 26 | 27 | void setParams(float fc, float g) 28 | { 29 | // Wc is normalized cut-off frequency 0 0){ 46 | c = (tan((M_PI* current_Wc)/2.0)-1.0) / (tan((M_PI * current_Wc)/2.0)+1.0); 47 | } else { 48 | c = (tan((M_PI* current_Wc)/2.0)-current_V0) / (tan((M_PI * current_Wc)/2.0)+current_V0); 49 | } 50 | xh_new = input[i] - c * xh; 51 | H0 = current_V0 - 1.0; 52 | ap_y = c * xh_new + xh; 53 | xh = xh_new; 54 | input[i] = 0.5 * H0 * (input[i] + ap_y) + input[i]; 55 | } 56 | current_Wc = Wc; 57 | current_V0 = V0; 58 | } else { 59 | for(int i = 0; i < bs; i++) { 60 | xh_new = input[i] - c * xh; 61 | H0 = V0 - 1.0; 62 | ap_y = c * xh_new + xh; 63 | xh = xh_new; 64 | input[i] = 0.5 * H0 * (input[i] + ap_y) + input[i]; 65 | } 66 | } 67 | } 68 | 69 | 70 | private: 71 | float Fs = 0; 72 | float Wc = 0; 73 | float current_Wc = 0; 74 | float inc_Wc = 0; 75 | float G = 0; 76 | float current_V0 = 0; 77 | float inc_V0 = 0; 78 | float c = 0; 79 | float V0 = 0; 80 | float H0 = 0; 81 | float xh = 0; 82 | float xh_new = 0; 83 | float ap_y = 0; 84 | size_t bs = 0; 85 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FirstOrderLowshelvingFilter); 86 | }; 87 | 88 | class FirstOrderHighshelvingFilter { 89 | public: 90 | FirstOrderHighshelvingFilter() {}; 91 | ~FirstOrderHighshelvingFilter() {}; 92 | 93 | // Call this in perpare to play 94 | void prepare(float sampleRate, int blocksize) noexcept 95 | { 96 | Fs = sampleRate; 97 | bs = blocksize; 98 | current_Wc = 0; 99 | current_V0 = 0; 100 | } 101 | 102 | void setParams(float fc, float g) 103 | { 104 | // Wc is normalized cut-off frequency 0 0){ 121 | c = (tan((M_PI* current_Wc)/2.0)-1.0) / (tan((M_PI * current_Wc)/2.0)+1.0); 122 | } else { 123 | c = (tan((M_PI* current_Wc)/2.0)-current_V0) / (tan((M_PI * current_Wc)/2.0)+current_V0); 124 | } 125 | xh_new = input[i] - c * xh; 126 | H0 = current_V0 - 1.0; 127 | ap_y = c * xh_new + xh; 128 | xh = xh_new; 129 | input[i] = 0.5 * H0 * (input[i] - ap_y) + input[i]; 130 | } 131 | current_Wc = Wc; 132 | current_V0 = V0; 133 | } else { 134 | for(int i = 0; i < bs; i++) { 135 | xh_new = input[i] - c * xh; 136 | H0 = V0 - 1.0; 137 | ap_y = c * xh_new + xh; 138 | xh = xh_new; 139 | input[i] = 0.5 * H0 * (input[i] - ap_y) + input[i]; 140 | } 141 | } 142 | } 143 | 144 | 145 | private: 146 | float Fs = 0; 147 | float Wc = 0; 148 | float current_Wc = 0; 149 | float inc_Wc = 0; 150 | float current_V0 = 0; 151 | float inc_V0 = 0; 152 | float c = 0; 153 | float G = 0; 154 | float V0 = 0; 155 | float H0 = 0; 156 | float xh = 0; 157 | float xh_new = 0; 158 | float ap_y = 0; 159 | size_t bs = 0; 160 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FirstOrderHighshelvingFilter); 161 | }; 162 | 163 | -------------------------------------------------------------------------------- /plugins/ParametricEQ/source/PluginProcessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin processor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "../../../libs/DAFX/EQ/ParametricEQ.h" 13 | #include "pluginparamers/PluginParameters.h" 14 | 15 | #if JUCE_USE_SIMD 16 | 17 | //============================================================================== 18 | template 19 | static T* toBasePointer(juce::dsp::SIMDRegister* r) noexcept 20 | { 21 | return reinterpret_cast (r); 22 | } 23 | 24 | constexpr auto registerSize = juce::dsp::SIMDRegister::size(); 25 | 26 | class SIMDEQ 27 | { 28 | public: 29 | SIMDEQ() 30 | { 31 | eq = std::make_unique>>(); 32 | 33 | }; 34 | ~SIMDEQ() {}; 35 | void prepare(const juce::dsp::ProcessSpec& spec) 36 | { 37 | interleaved =juce::dsp::AudioBlock>(interleavedBlockData, 1, spec.maximumBlockSize); 38 | zero = juce::dsp::AudioBlock(zeroData, juce::dsp::SIMDRegister::size(), spec.maximumBlockSize); // [6] 39 | 40 | zero.clear(); 41 | sampleRate = spec.sampleRate; // [4] 42 | samplesPerBlock = spec.maximumBlockSize; 43 | eq->prepare(sampleRate, samplesPerBlock); 44 | 45 | } 46 | 47 | template 48 | auto prepareChannelPointers(const juce::dsp::AudioBlock& block) 49 | { 50 | std::array result{}; 51 | 52 | for (size_t ch = 0; ch < result.size(); ++ch) 53 | result[ch] = (ch < block.getNumChannels() ? block.getChannelPointer(ch) : zero.getChannelPointer(ch)); 54 | 55 | return result; 56 | } 57 | 58 | void process(const juce::dsp::ProcessContextReplacing& context) 59 | { 60 | jassert(context.getInputBlock().getNumSamples() == context.getOutputBlock().getNumSamples()); 61 | jassert(context.getInputBlock().getNumChannels() == context.getOutputBlock().getNumChannels()); 62 | 63 | const auto& input = context.getInputBlock(); // [9] 64 | const auto numSamples = (int)input.getNumSamples(); 65 | 66 | auto inChannels = prepareChannelPointers(input); // [10] 67 | 68 | using Format = juce::AudioData::Format; 69 | 70 | juce::AudioData::interleaveSamples(juce::AudioData::NonInterleavedSource { inChannels.data(), registerSize, }, 71 | juce::AudioData::InterleavedDest { toBasePointer(interleaved.getChannelPointer(0)), registerSize }, 72 | numSamples); // [11] 73 | 74 | eq->process(juce::dsp::ProcessContextReplacing>(interleaved)); // [12] 75 | 76 | auto outChannels = prepareChannelPointers(context.getOutputBlock()); // [13] 77 | 78 | juce::AudioData::deinterleaveSamples(juce::AudioData::InterleavedSource { toBasePointer(interleaved.getChannelPointer(0)), registerSize }, 79 | juce::AudioData::NonInterleavedDest { outChannels.data(), registerSize }, 80 | numSamples); // [14] 81 | } 82 | 83 | 84 | 85 | 86 | //============================================================================== 87 | 88 | std::unique_ptr>> eq; 89 | juce::dsp::AudioBlock> interleaved; // [2] 90 | juce::dsp::AudioBlock zero; 91 | 92 | juce::HeapBlock interleavedBlockData, zeroData; // [3] 93 | 94 | 95 | double sampleRate = 0.0; 96 | size_t samplesPerBlock = 0; 97 | }; 98 | #endif 99 | //============================================================================= 100 | /* 101 | */ 102 | class PluginAudioProcessor : public juce::AudioProcessor, public juce::AudioProcessorValueTreeState::Listener 103 | #if JucePlugin_Enable_ARA 104 | , public juce::AudioProcessorARAExtension 105 | #endif 106 | 107 | { 108 | public: 109 | //============================================================================== 110 | PluginAudioProcessor(); 111 | ~PluginAudioProcessor() override; 112 | 113 | //============================================================================== 114 | void prepareToPlay (double sampleRate, int samplesPerBlock) override; 115 | void releaseResources() override; 116 | 117 | #ifndef JucePlugin_PreferredChannelConfigurations 118 | bool isBusesLayoutSupported (const BusesLayout& layouts) const override; 119 | #endif 120 | 121 | void processBlock (juce::AudioBuffer&, juce::MidiBuffer&) override; 122 | 123 | //============================================================================== 124 | juce::AudioProcessorEditor* createEditor() override; 125 | bool hasEditor() const override; 126 | 127 | //============================================================================== 128 | const juce::String getName() const override; 129 | 130 | bool acceptsMidi() const override; 131 | bool producesMidi() const override; 132 | bool isMidiEffect() const override; 133 | double getTailLengthSeconds() const override; 134 | 135 | //============================================================================== 136 | int getNumPrograms() override; 137 | int getCurrentProgram() override; 138 | void setCurrentProgram (int index) override; 139 | const juce::String getProgramName (int index) override; 140 | void changeProgramName (int index, const juce::String& newName) override; 141 | 142 | //============================================================================== 143 | void getStateInformation (juce::MemoryBlock& destData) override; 144 | void setStateInformation (const void* data, int sizeInBytes) override; 145 | juce::AudioProcessorValueTreeState treeState; 146 | private: 147 | 148 | void parameterChanged(const juce::String& parameterID, float newValue) override; 149 | void initParams(); 150 | 151 | std::unique_ptr simdEQ; 152 | 153 | juce::CriticalSection audioCallbackLock; 154 | //============================================================================== 155 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginAudioProcessor) 156 | }; 157 | -------------------------------------------------------------------------------- /plugins/CombFilter/source/PluginProcessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin processor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | #include "../../../libs/DAFX/CombFilters/UniversalCombFilter.h" 13 | #include "pluginparamers/PluginParameters.h" 14 | 15 | #if JUCE_USE_SIMD 16 | 17 | //============================================================================== 18 | template 19 | static T* toBasePointer(juce::dsp::SIMDRegister* r) noexcept 20 | { 21 | return reinterpret_cast (r); 22 | } 23 | 24 | constexpr auto registerSize = juce::dsp::SIMDRegister::size(); 25 | 26 | class SIMDCOMB 27 | { 28 | public: 29 | SIMDCOMB() 30 | { 31 | uniComb = std::make_unique>>(); 32 | 33 | }; 34 | ~SIMDCOMB() {}; 35 | void prepare(const juce::dsp::ProcessSpec& spec) 36 | { 37 | interleaved =juce::dsp::AudioBlock>(interleavedBlockData, 1, spec.maximumBlockSize); 38 | zero = juce::dsp::AudioBlock(zeroData, juce::dsp::SIMDRegister::size(), spec.maximumBlockSize); // [6] 39 | 40 | zero.clear(); 41 | sampleRate = spec.sampleRate; // [4] 42 | samplesPerBlock = spec.maximumBlockSize; 43 | uniComb->prepare(samplesPerBlock * 50, samplesPerBlock, sampleRate, 2); 44 | 45 | } 46 | 47 | template 48 | auto prepareChannelPointers(const juce::dsp::AudioBlock& block) 49 | { 50 | std::array result{}; 51 | 52 | for (size_t ch = 0; ch < result.size(); ++ch) 53 | result[ch] = (ch < block.getNumChannels() ? block.getChannelPointer(ch) : zero.getChannelPointer(ch)); 54 | 55 | return result; 56 | } 57 | 58 | void process(const juce::dsp::ProcessContextReplacing& context) 59 | { 60 | jassert(context.getInputBlock().getNumSamples() == context.getOutputBlock().getNumSamples()); 61 | jassert(context.getInputBlock().getNumChannels() == context.getOutputBlock().getNumChannels()); 62 | 63 | const auto& input = context.getInputBlock(); // [9] 64 | const auto numSamples = (int)input.getNumSamples(); 65 | 66 | auto inChannels = prepareChannelPointers(input); // [10] 67 | 68 | using Format = juce::AudioData::Format; 69 | 70 | juce::AudioData::interleaveSamples(juce::AudioData::NonInterleavedSource { inChannels.data(), registerSize, }, 71 | juce::AudioData::InterleavedDest { toBasePointer(interleaved.getChannelPointer(0)), registerSize }, 72 | numSamples); // [11] 73 | 74 | uniComb->process(juce::dsp::ProcessContextReplacing>(interleaved)); // [12] 75 | 76 | auto outChannels = prepareChannelPointers(context.getOutputBlock()); // [13] 77 | 78 | juce::AudioData::deinterleaveSamples(juce::AudioData::InterleavedSource { toBasePointer(interleaved.getChannelPointer(0)), registerSize }, 79 | juce::AudioData::NonInterleavedDest { outChannels.data(), registerSize }, 80 | numSamples); // [14] 81 | } 82 | 83 | 84 | 85 | 86 | //============================================================================== 87 | 88 | std::unique_ptr>> uniComb; 89 | juce::dsp::AudioBlock> interleaved; // [2] 90 | juce::dsp::AudioBlock zero; 91 | 92 | juce::HeapBlock interleavedBlockData, zeroData; // [3] 93 | 94 | 95 | double sampleRate = 0.0; 96 | size_t samplesPerBlock = 0; 97 | }; 98 | #endif 99 | //============================================================================= 100 | /** 101 | */ 102 | class PluginAudioProcessor : public juce::AudioProcessor, public juce::AudioProcessorValueTreeState::Listener 103 | #if JucePlugin_Enable_ARA 104 | , public juce::AudioProcessorARAExtension 105 | #endif 106 | 107 | { 108 | public: 109 | //============================================================================== 110 | PluginAudioProcessor(); 111 | ~PluginAudioProcessor() override; 112 | 113 | //============================================================================== 114 | void prepareToPlay (double sampleRate, int samplesPerBlock) override; 115 | void releaseResources() override; 116 | 117 | #ifndef JucePlugin_PreferredChannelConfigurations 118 | bool isBusesLayoutSupported (const BusesLayout& layouts) const override; 119 | #endif 120 | 121 | void processBlock (juce::AudioBuffer&, juce::MidiBuffer&) override; 122 | 123 | //============================================================================== 124 | juce::AudioProcessorEditor* createEditor() override; 125 | bool hasEditor() const override; 126 | 127 | //============================================================================== 128 | const juce::String getName() const override; 129 | 130 | bool acceptsMidi() const override; 131 | bool producesMidi() const override; 132 | bool isMidiEffect() const override; 133 | double getTailLengthSeconds() const override; 134 | 135 | //============================================================================== 136 | int getNumPrograms() override; 137 | int getCurrentProgram() override; 138 | void setCurrentProgram (int index) override; 139 | const juce::String getProgramName (int index) override; 140 | void changeProgramName (int index, const juce::String& newName) override; 141 | 142 | //============================================================================== 143 | void getStateInformation (juce::MemoryBlock& destData) override; 144 | void setStateInformation (const void* data, int sizeInBytes) override; 145 | juce::AudioProcessorValueTreeState treeState; 146 | private: 147 | 148 | void parameterChanged(const juce::String& parameterID, float newValue) override; 149 | void initParams(); 150 | // Declare std::unique_ptr member variable for simdComb 151 | std::unique_ptr simdComb; 152 | std::atomic* freq = nullptr; 153 | std::atomic* gain = nullptr; 154 | juce::CriticalSection audioCallbackLock; 155 | //============================================================================== 156 | JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PluginAudioProcessor) 157 | }; 158 | -------------------------------------------------------------------------------- /plugins/CombFilter/source/PluginProcessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin processor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #include "PluginProcessor.h" 10 | #include "PluginEditor.h" 11 | 12 | //============================================================================== 13 | PluginAudioProcessor::PluginAudioProcessor() 14 | #ifndef JucePlugin_PreferredChannelConfigurations 15 | : AudioProcessor (BusesProperties() 16 | #if ! JucePlugin_IsMidiEffect 17 | #if ! JucePlugin_IsSynth 18 | .withInput ("Input", juce::AudioChannelSet::stereo(), true) 19 | #endif 20 | .withOutput ("Output", juce::AudioChannelSet::stereo(), true) 21 | #endif 22 | ), treeState(*this, nullptr, juce::Identifier("Parameters"), PluginParameter::createParameterLayout()) 23 | #endif 24 | { 25 | 26 | simdComb = std::make_unique() ; 27 | freq = treeState.getRawParameterValue(PluginParameter::FREQUENCY); 28 | gain = treeState.getRawParameterValue(PluginParameter::GAIN); 29 | for (auto param : PluginParameter::getPluginParameterList()) 30 | { 31 | treeState.addParameterListener(param, this); 32 | } 33 | 34 | } 35 | 36 | PluginAudioProcessor::~PluginAudioProcessor() 37 | { 38 | for (auto param : PluginParameter::getPluginParameterList()) 39 | treeState.removeParameterListener(param, this); 40 | } 41 | 42 | 43 | 44 | void PluginAudioProcessor::parameterChanged(const juce::String& parameterID, float newValue) 45 | { 46 | if (parameterID == PluginParameter::FREQUENCY) 47 | { 48 | simdComb->uniComb->setFrequency(newValue); 49 | 50 | } 51 | if (parameterID == PluginParameter::GAIN) 52 | { 53 | simdComb->uniComb->setLinGain(newValue); 54 | } 55 | 56 | } 57 | 58 | void PluginAudioProcessor::initParams() 59 | { 60 | simdComb->uniComb->setFrequency(*freq); 61 | simdComb->uniComb->setLinGain(*gain); 62 | 63 | } 64 | 65 | //============================================================================== 66 | const juce::String PluginAudioProcessor::getName() const 67 | { 68 | return JucePlugin_Name; 69 | } 70 | 71 | bool PluginAudioProcessor::acceptsMidi() const 72 | { 73 | #if JucePlugin_WantsMidiInput 74 | return true; 75 | #else 76 | return false; 77 | #endif 78 | } 79 | 80 | bool PluginAudioProcessor::producesMidi() const 81 | { 82 | #if JucePlugin_ProducesMidiOutput 83 | return true; 84 | #else 85 | return false; 86 | #endif 87 | } 88 | 89 | bool PluginAudioProcessor::isMidiEffect() const 90 | { 91 | #if JucePlugin_IsMidiEffect 92 | return true; 93 | #else 94 | return false; 95 | #endif 96 | } 97 | 98 | double PluginAudioProcessor::getTailLengthSeconds() const 99 | { 100 | return 0.0; 101 | } 102 | 103 | int PluginAudioProcessor::getNumPrograms() 104 | { 105 | return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs, 106 | // so this should be at least 1, even if you're not really implementing programs. 107 | } 108 | 109 | int PluginAudioProcessor::getCurrentProgram() 110 | { 111 | return 0; 112 | } 113 | 114 | void PluginAudioProcessor::setCurrentProgram (int index) 115 | { 116 | } 117 | 118 | const juce::String PluginAudioProcessor::getProgramName (int index) 119 | { 120 | return {}; 121 | } 122 | 123 | void PluginAudioProcessor::changeProgramName (int index, const juce::String& newName) 124 | { 125 | } 126 | 127 | //============================================================================== 128 | void PluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) 129 | { 130 | juce::dsp::ProcessSpec specs; 131 | 132 | specs.sampleRate = sampleRate; 133 | specs.maximumBlockSize = samplesPerBlock; 134 | specs.numChannels = 2; 135 | simdComb->prepare(specs); 136 | this->initParams(); 137 | } 138 | 139 | void PluginAudioProcessor::releaseResources() 140 | { 141 | // When playback stops, you can use this as an opportunity to free up any 142 | // spare memory, etc. 143 | } 144 | 145 | #ifndef JucePlugin_PreferredChannelConfigurations 146 | bool PluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const 147 | { 148 | #if JucePlugin_IsMidiEffect 149 | juce::ignoreUnused (layouts); 150 | return true; 151 | #else 152 | // This is the place where you check if the layout is supported. 153 | // In this template code we only support mono or stereo. 154 | // Some plugin hosts, such as certain GarageBand versions, will only 155 | // load plugins that support stereo bus layouts. 156 | if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::mono() 157 | && layouts.getMainOutputChannelSet() != juce::AudioChannelSet::stereo()) 158 | return false; 159 | 160 | // This checks if the input layout matches the output layout 161 | #if ! JucePlugin_IsSynth 162 | if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) 163 | return false; 164 | #endif 165 | 166 | return true; 167 | #endif 168 | } 169 | #endif 170 | 171 | void PluginAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages) 172 | { 173 | juce::ScopedNoDenormals noDenormals; 174 | auto totalNumInputChannels = getTotalNumInputChannels(); 175 | auto totalNumOutputChannels = getTotalNumOutputChannels(); 176 | 177 | // Use the actual number of channels from the buffer 178 | size_t numChannels = buffer.getNumChannels(); 179 | 180 | // Prepare the process context with the input and output buffers 181 | juce::dsp::AudioBlock audioBlock(buffer.getArrayOfWritePointers(), numChannels, buffer.getNumSamples()); 182 | juce::dsp::ProcessContextReplacing context(audioBlock); 183 | 184 | // Ensure thread safety when accessing the SIMD comb filter 185 | juce::ScopedLock audioLock(audioCallbackLock); 186 | 187 | // Process the audio using the SIMD comb filter 188 | simdComb->process(context); 189 | } 190 | 191 | 192 | //============================================================================== 193 | bool PluginAudioProcessor::hasEditor() const 194 | { 195 | return true; // (change this to false if you choose to not supply an editor) 196 | } 197 | 198 | juce::AudioProcessorEditor* PluginAudioProcessor::createEditor() 199 | { 200 | return new juce::GenericAudioProcessorEditor (*this);//new PluginAudioProcessorEditor (*this); 201 | } 202 | 203 | //============================================================================== 204 | void PluginAudioProcessor::getStateInformation (juce::MemoryBlock& destData) 205 | { 206 | juce::MemoryOutputStream mos(destData, true); 207 | treeState.state.writeToStream(mos); 208 | } 209 | 210 | void PluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes) 211 | { 212 | auto tree = juce::ValueTree::readFromData(data, sizeInBytes); 213 | if (tree.isValid()) 214 | { 215 | treeState.replaceState(tree); 216 | } 217 | } 218 | 219 | //============================================================================== 220 | // This creates new instances of the plugin.. 221 | juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() 222 | { 223 | return new PluginAudioProcessor(); 224 | } 225 | -------------------------------------------------------------------------------- /plugins/ParametricEQ/source/PluginProcessor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | ============================================================================== 3 | 4 | This file contains the basic framework code for a JUCE plugin processor. 5 | 6 | ============================================================================== 7 | */ 8 | 9 | #include "PluginProcessor.h" 10 | #include "PluginEditor.h" 11 | 12 | //============================================================================== 13 | PluginAudioProcessor::PluginAudioProcessor() 14 | #ifndef JucePlugin_PreferredChannelConfigurations 15 | : AudioProcessor (BusesProperties() 16 | #if ! JucePlugin_IsMidiEffect 17 | #if ! JucePlugin_IsSynth 18 | .withInput ("Input", juce::AudioChannelSet::stereo(), true) 19 | #endif 20 | .withOutput ("Output", juce::AudioChannelSet::stereo(), true) 21 | #endif 22 | ), treeState(*this, nullptr, juce::Identifier("Parameters"), PluginParameter::createParameterLayout()) 23 | #endif 24 | { 25 | 26 | simdEQ = std::make_unique(); 27 | for (auto param : PluginParameter::getPluginParameterList()) 28 | { 29 | treeState.addParameterListener(param, this); 30 | } 31 | 32 | } 33 | 34 | PluginAudioProcessor::~PluginAudioProcessor() 35 | { 36 | for (auto param : PluginParameter::getPluginParameterList()) 37 | treeState.removeParameterListener(param, this); 38 | } 39 | 40 | 41 | 42 | void PluginAudioProcessor::parameterChanged(const juce::String& parameterID, float newValue) 43 | { 44 | if (parameterID == PluginParameter::LOW_CUTOFF_FREQUENCY) 45 | { 46 | simdEQ->eq->setLowCutoff(newValue); 47 | 48 | } 49 | 50 | if (parameterID == PluginParameter::HIGH_CUTOFF_FREQUENCY) 51 | { 52 | simdEQ->eq->setHighCutoff(newValue); 53 | 54 | } 55 | if (parameterID == PluginParameter::HIGH_GAIN) 56 | { 57 | simdEQ->eq->setHighGain(newValue); 58 | 59 | } 60 | 61 | if (parameterID == PluginParameter::MID_GAIN) 62 | { 63 | simdEQ->eq->setMidGain(newValue); 64 | 65 | } 66 | 67 | 68 | 69 | if (parameterID == PluginParameter::LOW_GAIN) 70 | { 71 | simdEQ->eq->setLowGain(newValue); 72 | 73 | } 74 | 75 | } 76 | 77 | void PluginAudioProcessor::initParams() 78 | { 79 | simdEQ->eq->setLowCutoff(treeState.getRawParameterValue(PluginParameter::LOW_CUTOFF_FREQUENCY)->load()); 80 | simdEQ->eq->setHighCutoff(treeState.getRawParameterValue(PluginParameter::HIGH_CUTOFF_FREQUENCY)->load()); 81 | simdEQ->eq->setHighGain(treeState.getRawParameterValue(PluginParameter::HIGH_GAIN)->load()); 82 | simdEQ->eq->setMidGain(treeState.getRawParameterValue(PluginParameter::MID_GAIN)->load()); 83 | simdEQ->eq->setLowGain(treeState.getRawParameterValue(PluginParameter::LOW_GAIN)->load()); 84 | } 85 | 86 | //============================================================================== 87 | const juce::String PluginAudioProcessor::getName() const 88 | { 89 | return JucePlugin_Name; 90 | } 91 | 92 | bool PluginAudioProcessor::acceptsMidi() const 93 | { 94 | #if JucePlugin_WantsMidiInput 95 | return true; 96 | #else 97 | return false; 98 | #endif 99 | } 100 | 101 | bool PluginAudioProcessor::producesMidi() const 102 | { 103 | #if JucePlugin_ProducesMidiOutput 104 | return true; 105 | #else 106 | return false; 107 | #endif 108 | } 109 | 110 | bool PluginAudioProcessor::isMidiEffect() const 111 | { 112 | #if JucePlugin_IsMidiEffect 113 | return true; 114 | #else 115 | return false; 116 | #endif 117 | } 118 | 119 | double PluginAudioProcessor::getTailLengthSeconds() const 120 | { 121 | return 0.0; 122 | } 123 | 124 | int PluginAudioProcessor::getNumPrograms() 125 | { 126 | return 1; // NB: some hosts don't cope very well if you tell them there are 0 programs, 127 | // so this should be at least 1, even if you're not really implementing programs. 128 | } 129 | 130 | int PluginAudioProcessor::getCurrentProgram() 131 | { 132 | return 0; 133 | } 134 | 135 | void PluginAudioProcessor::setCurrentProgram (int index) 136 | { 137 | } 138 | 139 | const juce::String PluginAudioProcessor::getProgramName (int index) 140 | { 141 | return {}; 142 | } 143 | 144 | void PluginAudioProcessor::changeProgramName (int index, const juce::String& newName) 145 | { 146 | } 147 | 148 | //============================================================================== 149 | void PluginAudioProcessor::prepareToPlay (double sampleRate, int samplesPerBlock) 150 | { 151 | juce::dsp::ProcessSpec specs; 152 | 153 | specs.sampleRate = sampleRate; 154 | specs.maximumBlockSize = samplesPerBlock; 155 | specs.numChannels = 2; 156 | simdEQ->prepare(specs); 157 | this->initParams(); 158 | } 159 | 160 | void PluginAudioProcessor::releaseResources() 161 | { 162 | // When playback stops, you can use this as an opportunity to free up any 163 | // spare memory, etc. 164 | } 165 | 166 | #ifndef JucePlugin_PreferredChannelConfigurations 167 | bool PluginAudioProcessor::isBusesLayoutSupported (const BusesLayout& layouts) const 168 | { 169 | #if JucePlugin_IsMidiEffect 170 | juce::ignoreUnused (layouts); 171 | return true; 172 | #else 173 | // This is the place where you check if the layout is supported. 174 | // In this template code we only support mono or stereo. 175 | // Some plugin hosts, such as certain GarageBand versions, will only 176 | // load plugins that support stereo bus layouts. 177 | if (layouts.getMainOutputChannelSet() != juce::AudioChannelSet::mono() 178 | && layouts.getMainOutputChannelSet() != juce::AudioChannelSet::stereo()) 179 | return false; 180 | 181 | // This checks if the input layout matches the output layout 182 | #if ! JucePlugin_IsSynth 183 | if (layouts.getMainOutputChannelSet() != layouts.getMainInputChannelSet()) 184 | return false; 185 | #endif 186 | 187 | return true; 188 | #endif 189 | } 190 | #endif 191 | 192 | void PluginAudioProcessor::processBlock (juce::AudioBuffer& buffer, juce::MidiBuffer& midiMessages) 193 | { 194 | juce::ScopedNoDenormals noDenormals; 195 | auto totalNumInputChannels = getTotalNumInputChannels(); 196 | auto totalNumOutputChannels = getTotalNumOutputChannels(); 197 | 198 | // Use the actual number of channels from the buffer 199 | size_t numChannels = buffer.getNumChannels(); 200 | 201 | // Prepare the process context with the input and output buffers 202 | juce::dsp::AudioBlock audioBlock(buffer.getArrayOfWritePointers(), numChannels, buffer.getNumSamples()); 203 | juce::dsp::ProcessContextReplacing context(audioBlock); 204 | 205 | // Ensure thread safety when accessing the SIMD comb filter 206 | juce::ScopedLock audioLock(audioCallbackLock); 207 | 208 | // Process the audio using the SIMD comb filter 209 | simdEQ->process(context); 210 | } 211 | 212 | 213 | //============================================================================== 214 | bool PluginAudioProcessor::hasEditor() const 215 | { 216 | return true; // (change this to false if you choose to not supply an editor) 217 | } 218 | 219 | juce::AudioProcessorEditor* PluginAudioProcessor::createEditor() 220 | { 221 | return new juce::GenericAudioProcessorEditor (*this);//new PluginAudioProcessorEditor (*this); 222 | } 223 | 224 | //============================================================================== 225 | void PluginAudioProcessor::getStateInformation (juce::MemoryBlock& destData) 226 | { 227 | juce::MemoryOutputStream mos(destData, true); 228 | treeState.state.writeToStream(mos); 229 | } 230 | 231 | void PluginAudioProcessor::setStateInformation (const void* data, int sizeInBytes) 232 | { 233 | auto tree = juce::ValueTree::readFromData(data, sizeInBytes); 234 | if (tree.isValid()) 235 | { 236 | treeState.replaceState(tree); 237 | } 238 | } 239 | 240 | //============================================================================== 241 | // This creates new instances of the plugin.. 242 | juce::AudioProcessor* JUCE_CALLTYPE createPluginFilter() 243 | { 244 | return new PluginAudioProcessor(); 245 | } 246 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------