Loading...
Searching...
No Matches
juce_dsp/widgets/juce_Reverb.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 7 End-User License
Agreement and JUCE Privacy Policy.
End User License Agreement: www.juce.com/juce-7-licence
Privacy Policy: www.juce.com/juce-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce::dsp
{
class Reverb
{
public:
//==============================================================================
Reverb() = default;
//==============================================================================
using Parameters = juce::Reverb::Parameters;
const Parameters& getParameters() const noexcept { return reverb.getParameters(); }
void setParameters (const Parameters& newParams) { reverb.setParameters (newParams); }
bool isEnabled() const noexcept { return enabled; }
void setEnabled (bool newValue) noexcept { enabled = newValue; }
//==============================================================================
void prepare (const ProcessSpec& spec)
{
reverb.setSampleRate (spec.sampleRate);
}
void reset() noexcept
{
reverb.reset();
}
//==============================================================================
template <typename ProcessContext>
void process (const ProcessContext& context) noexcept
{
const auto& inputBlock = context.getInputBlock();
auto& outputBlock = context.getOutputBlock();
const auto numInChannels = inputBlock.getNumChannels();
const auto numOutChannels = outputBlock.getNumChannels();
const auto numSamples = outputBlock.getNumSamples();
jassert (inputBlock.getNumSamples() == numSamples);
outputBlock.copyFrom (inputBlock);
if (! enabled || context.isBypassed)
return;
if (numInChannels == 1 && numOutChannels == 1)
{
reverb.processMono (outputBlock.getChannelPointer (0), (int) numSamples);
}
else if (numInChannels == 2 && numOutChannels == 2)
{
reverb.processStereo (outputBlock.getChannelPointer (0),
outputBlock.getChannelPointer (1),
(int) numSamples);
}
else
{
jassertfalse; // invalid channel configuration
}
}
private:
//==============================================================================
juce::Reverb reverb;
bool enabled = true;
};
} // namespace juce::dsp
juce::Reverb
Definition juce_audio_basics/utilities/juce_Reverb.h:39
juce::Reverb::Parameters
Definition juce_audio_basics/utilities/juce_Reverb.h:51
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