OpenShot Audio Library | OpenShotAudio 0.3.2

Loading...
Searching...
No Matches
juce_dsp/processors/juce_Reverb.h
1/*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2017 - ROLI Ltd.
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 5 End-User License
11 Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
12 27th April 2017).
13
14 End User License Agreement: www.juce.com/juce-5-licence
15 Privacy Policy: www.juce.com/juce-5-privacy-policy
16
17 Or: You may also use this code under the terms of the GPL v3 (see
18 www.gnu.org/licenses).
19
20 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
21 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
22 DISCLAIMED.
23
24 ==============================================================================
25*/
26
27 namespace juce
28{
29 namespace dsp
30{
31
37 class Reverb
38{
39 public:
40 //==============================================================================
42 Reverb() = default;
43
44 //==============================================================================
45 using Parameters = juce::Reverb::Parameters;
46
48 const Parameters& getParameters() const noexcept { return reverb.getParameters(); }
49
54 void setParameters (const Parameters& newParams) { reverb.setParameters (newParams); }
55
57 bool isEnabled() const noexcept { return enabled; }
58
60 void setEnabled (bool newValue) noexcept { enabled = newValue; }
61
62 //==============================================================================
64 void prepare (const juce::dsp::ProcessSpec& spec)
65 {
66 reverb.setSampleRate (spec.sampleRate);
67 }
68
70 void reset() noexcept
71 {
72 reverb.reset();
73 }
74
75 //==============================================================================
77 template <typename ProcessContext>
78 void process (const ProcessContext& context) noexcept
79 {
80 const auto& inputBlock = context.getInputBlock();
81 auto& outputBlock = context.getOutputBlock();
82 const auto numInChannels = inputBlock.getNumChannels();
83 const auto numOutChannels = outputBlock.getNumChannels();
84 const auto numSamples = outputBlock.getNumSamples();
85
86 jassert (inputBlock.getNumSamples() == numSamples);
87
88 outputBlock.copyFrom (inputBlock);
89
90 if (! enabled || context.isBypassed)
91 return;
92
93 if (numInChannels == 1 && numOutChannels == 1)
94 {
95 reverb.processMono (outputBlock.getChannelPointer (0), (int) numSamples);
96 }
97 else if (numInChannels == 2 && numOutChannels == 2)
98 {
99 reverb.processStereo (outputBlock.getChannelPointer (0),
100 outputBlock.getChannelPointer (1),
101 (int) numSamples);
102 }
103 else
104 {
105 jassertfalse; // invalid channel configuration
106 }
107 }
108
109 private:
110 //==============================================================================
111 juce::Reverb reverb;
112 bool enabled = true;
113};
114
115} // namespace dsp
116} // namespace juce
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:166
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/processors/juce_Reverb.h:38
juce::dsp::Reverb::getParameters
const Parameters & getParameters() const noexcept
Definition: juce_dsp/processors/juce_Reverb.h:48
juce::dsp::Reverb::process
void process(const ProcessContext &context) noexcept
Definition: juce_dsp/processors/juce_Reverb.h:78
juce::dsp::Reverb::isEnabled
bool isEnabled() const noexcept
Definition: juce_dsp/processors/juce_Reverb.h:57
juce::dsp::Reverb::Reverb
Reverb()=default
juce::dsp::Reverb::setEnabled
void setEnabled(bool newValue) noexcept
Definition: juce_dsp/processors/juce_Reverb.h:60
juce::dsp::Reverb::setParameters
void setParameters(const Parameters &newParams)
Definition: juce_dsp/processors/juce_Reverb.h:54
juce::dsp::Reverb::reset
void reset() noexcept
Definition: juce_dsp/processors/juce_Reverb.h:70
juce::dsp::Reverb::prepare
void prepare(const juce::dsp::ProcessSpec &spec)
Definition: juce_dsp/processors/juce_Reverb.h:64
juce::dsp::ProcessSpec
Definition: juce_ProcessContext.h:39
juce::dsp::ProcessSpec::sampleRate
double sampleRate
Definition: juce_ProcessContext.h:41