OpenShot Audio Library | OpenShotAudio 0.4.0

Loading...
Searching...
No Matches
juce_dsp/widgets/juce_Reverb.h
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
26 namespace juce::dsp
27{
28
34 class Reverb
35{
36 public:
37 //==============================================================================
39 Reverb() = default;
40
41 //==============================================================================
42 using Parameters = juce::Reverb::Parameters;
43
45 const Parameters& getParameters() const noexcept { return reverb.getParameters(); }
46
51 void setParameters (const Parameters& newParams) { reverb.setParameters (newParams); }
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
106 private:
107 //==============================================================================
108 juce::Reverb reverb;
109 bool enabled = true;
110};
111
112} // namespace juce::dsp
juce::Reverb
Definition juce_audio_basics/utilities/juce_Reverb.h:39
juce::Reverb::processMono
void processMono(float *const samples, const int numSamples) noexcept
Definition juce_audio_basics/utilities/juce_Reverb.h:169
juce::Reverb::reset
void reset()
Definition juce_audio_basics/utilities/juce_Reverb.h:118
juce::Reverb::processStereo
void processStereo(float *const left, float *const right, const int numSamples) noexcept
Definition juce_audio_basics/utilities/juce_Reverb.h:132
juce::Reverb::setParameters
void setParameters(const Parameters &newParams)
Definition juce_audio_basics/utilities/juce_Reverb.h:69
juce::Reverb::getParameters
const Parameters & getParameters() const noexcept
Definition juce_audio_basics/utilities/juce_Reverb.h:63
juce::Reverb::setSampleRate
void setSampleRate(const double sampleRate)
Definition juce_audio_basics/utilities/juce_Reverb.h:88
juce::Reverb::Parameters
Definition juce_audio_basics/utilities/juce_Reverb.h:51
juce::dsp::Reverb
Definition juce_dsp/widgets/juce_Reverb.h:35
juce::dsp::Reverb::getParameters
const Parameters & getParameters() const noexcept
Definition juce_dsp/widgets/juce_Reverb.h:45
juce::dsp::Reverb::process
void process(const ProcessContext &context) noexcept
Definition juce_dsp/widgets/juce_Reverb.h:75
juce::dsp::Reverb::prepare
void prepare(const ProcessSpec &spec)
Definition juce_dsp/widgets/juce_Reverb.h:61
juce::dsp::Reverb::isEnabled
bool isEnabled() const noexcept
Definition juce_dsp/widgets/juce_Reverb.h:54
juce::dsp::Reverb::Reverb
Reverb()=default
juce::dsp::Reverb::setEnabled
void setEnabled(bool newValue) noexcept
Definition juce_dsp/widgets/juce_Reverb.h:57
juce::dsp::Reverb::setParameters
void setParameters(const Parameters &newParams)
Definition juce_dsp/widgets/juce_Reverb.h:51
juce::dsp::Reverb::reset
void reset() noexcept
Definition juce_dsp/widgets/juce_Reverb.h:67
juce::dsp::ProcessSpec
Definition juce_ProcessContext.h:36
juce::dsp::ProcessSpec::sampleRate
double sampleRate
Definition juce_ProcessContext.h:38