diff options
| author | Dominik Kaiser | 2025-09-26 11:55:59 +0200 |
|---|---|---|
| committer | Dominik Kaiser | 2025-09-26 11:55:59 +0200 |
| commit | 6084053d60d2afb4de6a4e1448436fd13ab88493 (patch) | |
| tree | bd9aef68b4a8a8a2ea8fc0ee83a97dabca96401a | |
| parent | 98a69bf0cb95296fc4afd3d943a63db73a1ae22a (diff) | |
| download | SchroederReverb-6084053d60d2afb4de6a4e1448436fd13ab88493.tar.gz SchroederReverb-6084053d60d2afb4de6a4e1448436fd13ab88493.zip | |
Implement SchroederReverb framework
| -rw-r--r-- | src/DSP/SchroederReverb.cpp | 27 | ||||
| -rw-r--r-- | src/DSP/SchroederReverb.h | 16 | ||||
| -rw-r--r-- | src/PluginProcessor.cpp | 4 | ||||
| -rw-r--r-- | src/PluginProcessor.h | 4 |
4 files changed, 47 insertions, 4 deletions
diff --git a/src/DSP/SchroederReverb.cpp b/src/DSP/SchroederReverb.cpp new file mode 100644 index 0000000..8bd764d --- /dev/null +++ b/src/DSP/SchroederReverb.cpp @@ -0,0 +1,27 @@ +#include "SchroederReverb.h" + +void SchroederReverb::prepare(double sampleRate, int samplesPerBlock) { + combFilter0.prepare(sampleRate, samplesPerBlock); + combFilter1.prepare(sampleRate, samplesPerBlock); + combFilter2.prepare(sampleRate, samplesPerBlock); + combFilter3.prepare(sampleRate, samplesPerBlock); + allPassFilter0.prepare(sampleRate, samplesPerBlock); + allPassFilter1.prepare(sampleRate, samplesPerBlock); +} + +void SchroederReverb::process(float *sample) { + float in0 = *sample; + float in1 = *sample; + float in2 = *sample; + float in3 = *sample; + + combFilter0.process(&in0); + combFilter1.process(&in1); + combFilter2.process(&in2); + combFilter3.process(&in3); + + float allPassIn = in0 + in1 + in2 + in3; + allPassFilter0.process(&allPassIn); + allPassFilter1.process(&allPassIn); + *sample = allPassIn; +} diff --git a/src/DSP/SchroederReverb.h b/src/DSP/SchroederReverb.h new file mode 100644 index 0000000..8c4567a --- /dev/null +++ b/src/DSP/SchroederReverb.h @@ -0,0 +1,16 @@ +#pragma once + +#include <juce_audio_processors/juce_audio_processors.h> +#include "CombFilter.h" +#include "AllPassFilter.h" + +class SchroederReverb { +public: + void prepare(double sampleRate, int samplesPerBlock); + void reset(); + void process(float* sample); + +private: + CombFilter combFilter0, combFilter1, combFilter2, combFilter3; + AllPassFilter allPassFilter0, allPassFilter1; +}; diff --git a/src/PluginProcessor.cpp b/src/PluginProcessor.cpp index 1b4ada7..c1f4373 100644 --- a/src/PluginProcessor.cpp +++ b/src/PluginProcessor.cpp @@ -88,7 +88,7 @@ void SchroederReverbAudioProcessor::prepareToPlay (double sampleRate, int sample { // Use this method as the place to do any pre-playback // initialisation that you need.. - combFilter.prepare(sampleRate, samplesPerBlock); + schroederReverb.prepare(sampleRate, samplesPerBlock); } void SchroederReverbAudioProcessor::releaseResources() @@ -149,7 +149,7 @@ void SchroederReverbAudioProcessor::processBlock (juce::AudioBuffer<float>& buff { auto *channelData = buffer.getWritePointer(channel); for (int i = 0; i < buffer.getNumSamples(); ++i) { - combFilter.process(&channelData[i]); + schroederReverb.process(&channelData[i]); } // ..do something to the data... } diff --git a/src/PluginProcessor.h b/src/PluginProcessor.h index ce21b96..1d31a49 100644 --- a/src/PluginProcessor.h +++ b/src/PluginProcessor.h @@ -1,7 +1,7 @@ #pragma once #include <juce_audio_processors/juce_audio_processors.h> -#include "DSP/CombFilter.h" +#include "DSP/SchroederReverb.h" //============================================================================== class SchroederReverbAudioProcessor final : public juce::AudioProcessor @@ -45,6 +45,6 @@ public: private: //============================================================================== - CombFilter combFilter; + SchroederReverb schroederReverb; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (SchroederReverbAudioProcessor) }; |
