LMMS
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
27{
28namespace dsp
29{
30
36class Reverb
37{
38public:
39 //==============================================================================
41 Reverb() = default;
42
43 //==============================================================================
44 using Parameters = juce::Reverb::Parameters;
45
47 const Parameters& getParameters() const noexcept { return reverb.getParameters(); }
48
53 void setParameters (const Parameters& newParams) { reverb.setParameters (newParams); }
54
56 bool isEnabled() const noexcept { return enabled; }
57
59 void setEnabled (bool newValue) noexcept { enabled = newValue; }
60
61 //==============================================================================
63 void prepare (const ProcessSpec& spec)
64 {
65 reverb.setSampleRate (spec.sampleRate);
66 }
67
70 {
71 reverb.reset();
72 }
73
74 //==============================================================================
76 template <typename ProcessContext>
77 void process (const ProcessContext& context) noexcept
78 {
79 const auto& inputBlock = context.getInputBlock();
80 auto& outputBlock = context.getOutputBlock();
81 const auto numInChannels = inputBlock.getNumChannels();
82 const auto numOutChannels = outputBlock.getNumChannels();
83 const auto numSamples = outputBlock.getNumSamples();
84
85 jassert (inputBlock.getNumSamples() == numSamples);
86
87 outputBlock.copyFrom (inputBlock);
88
89 if (! enabled || context.isBypassed)
90 return;
91
92 if (numInChannels == 1 && numOutChannels == 1)
93 {
94 reverb.processMono (outputBlock.getChannelPointer (0), (int) numSamples);
95 }
96 else if (numInChannels == 2 && numOutChannels == 2)
97 {
98 reverb.processStereo (outputBlock.getChannelPointer (0),
99 outputBlock.getChannelPointer (1),
100 (int) numSamples);
101 }
102 else
103 {
104 jassertfalse; // invalid channel configuration
105 }
106 }
107
108private:
109 //==============================================================================
110 juce::Reverb reverb;
111 bool enabled = true;
112};
113
114} // namespace dsp
115} // namespace juce
#define noexcept
Definition DistrhoDefines.h:72
bool enabled
Definition juce_Reverb.h:111
const Parameters & getParameters() const noexcept
Definition juce_Reverb.h:47
juce::Reverb reverb
Definition juce_Reverb.h:110
void process(const ProcessContext &context) noexcept
Definition juce_Reverb.h:77
void prepare(const ProcessSpec &spec)
Definition juce_Reverb.h:63
bool isEnabled() const noexcept
Definition juce_Reverb.h:56
void setEnabled(bool newValue) noexcept
Definition juce_Reverb.h:59
void setParameters(const Parameters &newParams)
Definition juce_Reverb.h:53
void reset() noexcept
Definition juce_Reverb.h:69
juce::Reverb::Parameters Parameters
Definition juce_Reverb.h:44
#define jassert(expression)
#define jassertfalse
Definition juce_AudioBlock.h:29
Definition carla_juce.cpp:31
Definition juce_ProcessContext.h:38
double sampleRate
Definition juce_ProcessContext.h:40
#define const
Definition zconf.h:137