JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_Reverb.h
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce::dsp
27{
28
34class Reverb
35{
36public:
37 //==============================================================================
39 Reverb() = default;
40
41 //==============================================================================
43
45 const Parameters& getParameters() const noexcept { return reverb.getParameters(); }
46
52
54 bool isEnabled() const noexcept { return enabled; }
55
57 void setEnabled (bool newValue) noexcept { enabled = newValue; }
58
59 //==============================================================================
61 void prepare (const ProcessSpec& spec)
62 {
63 reverb.setSampleRate (spec.sampleRate);
64 }
65
67 void reset() noexcept
68 {
69 reverb.reset();
70 }
71
72 //==============================================================================
74 template <typename ProcessContext>
75 void process (const ProcessContext& context) noexcept
76 {
77 const auto& inputBlock = context.getInputBlock();
78 auto& outputBlock = context.getOutputBlock();
79 const auto numInChannels = inputBlock.getNumChannels();
80 const auto numOutChannels = outputBlock.getNumChannels();
81 const auto numSamples = outputBlock.getNumSamples();
82
83 jassert (inputBlock.getNumSamples() == numSamples);
84
85 outputBlock.copyFrom (inputBlock);
86
87 if (! enabled || context.isBypassed)
88 return;
89
90 if (numInChannels == 1 && numOutChannels == 1)
91 {
92 reverb.processMono (outputBlock.getChannelPointer (0), (int) numSamples);
93 }
94 else if (numInChannels == 2 && numOutChannels == 2)
95 {
96 reverb.processStereo (outputBlock.getChannelPointer (0),
97 outputBlock.getChannelPointer (1),
98 (int) numSamples);
99 }
100 else
101 {
102 jassertfalse; // invalid channel configuration
103 }
104 }
105
106private:
107 //==============================================================================
108 juce::Reverb reverb;
109 bool enabled = true;
110};
111
112} // namespace juce::dsp
Performs a simple reverb effect on a stream of audio data.
Definition juce_Reverb.h:39
void processMono(float *const samples, const int numSamples) noexcept
Applies the reverb to a single mono channel of audio data.
void reset()
Clears the reverb's buffers.
void processStereo(float *const left, float *const right, const int numSamples) noexcept
Applies the reverb to two stereo channels of audio data.
void setParameters(const Parameters &newParams)
Applies a new set of parameters to the reverb.
Definition juce_Reverb.h:69
const Parameters & getParameters() const noexcept
Returns the reverb's current parameters.
Definition juce_Reverb.h:63
void setSampleRate(const double sampleRate)
Sets the sample rate that will be used for the reverb.
Definition juce_Reverb.h:88
Holds the parameters being used by a Reverb object.
Definition juce_Reverb.h:51
Processor wrapper around juce::Reverb for easy integration into ProcessorChain.
Definition juce_Reverb.h:35
const Parameters & getParameters() const noexcept
Returns the reverb's current parameters.
Definition juce_Reverb.h:45
void process(const ProcessContext &context) noexcept
Applies the reverb to a mono or stereo buffer.
Definition juce_Reverb.h:75
void prepare(const ProcessSpec &spec)
Initialises the reverb.
Definition juce_Reverb.h:61
bool isEnabled() const noexcept
Returns true if the reverb is enabled.
Definition juce_Reverb.h:54
Reverb()=default
Creates an uninitialised Reverb processor.
void setEnabled(bool newValue) noexcept
Enables/disables the reverb.
Definition juce_Reverb.h:57
void setParameters(const Parameters &newParams)
Applies a new set of parameters to the reverb.
Definition juce_Reverb.h:51
void reset() noexcept
Resets the reverb's internal state.
Definition juce_Reverb.h:67
#define jassert(expression)
Platform-independent assertion macro.
#define jassertfalse
This will always cause an assertion failure.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88
This structure is passed into a DSP algorithm's prepare() method, and contains information about vari...