quantumVERB  1.0.0
A FOSS convolution reverb plugin
reverb::IRPipeline Class Reference

#include <IRPipeline.h>

Inheritance diagram for reverb::IRPipeline:
Collaboration diagram for reverb::IRPipeline:

Public Types

using Ptr = std::shared_ptr< IRPipeline >
 
- Public Types inherited from reverb::Task
using Ptr = std::shared_ptr< Task >
 

Public Member Functions

 IRPipeline (juce::AudioProcessor *processor, int channelIdx)
 Constructs an IRPipeline object associated with an AudioProcessor. More...
 
virtual void updateParams (const juce::AudioProcessorValueTreeState &params, const juce::String &="") override
 Updates parameters from processor parameter tree. More...
 
virtual AudioBlock exec (AudioBlock=AudioBlock()) override
 Manipulate the input IR file and place it in the given buffer. More...
 
virtual bool needsToRun () const override
 Check if this or any subtasks needs to be executed. More...
 
virtual void updateSampleRate (double sr) override
 Update sample rate for pipeline and child tasks. More...
 
AudioBlock reloadIR ()
 Loads an impulse response from disk or IR bank. More...
 
- Public Member Functions inherited from reverb::Task
 Task (juce::AudioProcessor *processor)
 

Static Public Attributes

static constexpr float MAX_IR_INTENSITY = 0.5f
 

Protected Member Functions

void loadIRFromBank (const std::string &irBuffer)
 Loads an impulse response from provided IR bank. More...
 
void loadIRFromDisk (const std::string &irFilePath)
 Loads an impulse response from a file (.WAV or .AIFF) to internal representation. More...
 
- Protected Member Functions inherited from reverb::Task
float getParam (const juce::AudioProcessorValueTreeState &params, const juce::String &blockId) const
 Internal method used to get (and check) a parameter's value.
 

Protected Attributes

Equalizer::Ptr equalizer
 
TimeStretch::Ptr timeStretch
 
Gain::Ptr gain
 
PreDelay::Ptr preDelay
 
double lastSampleRate = 0
 
int channelIdx
 
std::string irNameOrFilePath = ""
 
juce::AudioSampleBuffer ir
 
- Protected Attributes inherited from reverb::Task
juce::AudioProcessor * processor
 
bool mustExec = true
 

Additional Inherited Members

- Public Attributes inherited from reverb::Task
double sampleRate
 

Detailed Description

A pipeline implementing various transformation steps that are applied to impulse responses. This pipeline is executed only as needed (i.e. when a new IR is requested or when one of its parameters is changed). Therefore, it is not part of the critical path (its speed does not have a huge impact on plugin performance).

Definition at line 33 of file IRPipeline.h.

Constructor & Destructor Documentation

◆ IRPipeline()

reverb::IRPipeline::IRPipeline ( juce::AudioProcessor *  processor,
int  channelIdx 
)

Constructs an IRPipeline object associated with an AudioProcessor.

Creates an IRPipeline and each of its steps. Also sets the default IR file path and ensures it can be found.

Parameters
[in]processorPointer to main processor

Definition at line 29 of file IRPipeline.cpp.

Member Function Documentation

◆ exec()

AudioBlock reverb::IRPipeline::exec ( AudioBlock  = AudioBlock())
overridevirtual

Manipulate the input IR file and place it in the given buffer.

Applies filtering (EQ), time stretching (sample rate conversion) and gain to internal IR channel buffers to prepare it for main audio processing, then write channels to given output buffer.

Parameters
[out]irChannelOutProcessed impulse response channel
Exceptions
std::runtime_error

Implements reverb::Task.

Definition at line 154 of file IRPipeline.cpp.

◆ loadIRFromBank()

void reverb::IRPipeline::loadIRFromBank ( const std::string &  irName)
protected

Loads an impulse response from provided IR bank.

Loads the appropriate impulse response (IR) from binary data.

Parameters
[in]irNameName of banked IR file
Exceptions
std::invalid_argument

Definition at line 227 of file IRPipeline.cpp.

◆ loadIRFromDisk()

void reverb::IRPipeline::loadIRFromDisk ( const std::string &  irFilePath)
protected

Loads an impulse response from a file (.WAV or .AIFF) to internal representation.

Loads the selected impulse response (IR) from disk and splits it into individual buffers for each channel. This operation is potentially very heavy so processing is suspended until completion.

Parameters
[in]irFilePathPath to impulse response file
Exceptions
std::invalid_argument

Definition at line 261 of file IRPipeline.cpp.

◆ needsToRun()

bool reverb::IRPipeline::needsToRun ( ) const
overridevirtual

Check if this or any subtasks needs to be executed.

Pipeline must be executed if any IR-related parameters were changed since the last run.

Returns
True if IRPipeline must be executed

Reimplemented from reverb::Task.

Definition at line 112 of file IRPipeline.cpp.

◆ reloadIR()

AudioBlock reverb::IRPipeline::reloadIR ( )

Loads an impulse response from disk or IR bank.

If given string is the name of an IR in IR bank, load that buffer. Otherwise, look for IR on disk.

Parameters
[in]irNameName or path of IR file
Exceptions
std::invalid_argument

Definition at line 194 of file IRPipeline.cpp.

◆ updateParams()

void reverb::IRPipeline::updateParams ( const juce::AudioProcessorValueTreeState &  params,
const juce::String &  = "" 
)
overridevirtual

Updates parameters from processor parameter tree.

Parameters
[in]paramsProcessor parameter tree
[in]blockIdID of block whose paramters should be checked

Implements reverb::Task.

Definition at line 46 of file IRPipeline.cpp.

◆ updateSampleRate()

void reverb::IRPipeline::updateSampleRate ( double  sr)
overridevirtual

Update sample rate for pipeline and child tasks.

Compares new sample rate with previous value. If different, sets mustExec to true in order to re-run pipeline for new sample rate. Store new sample rate value in object.

Parameters
[in]srSample rate

Reimplemented from reverb::Task.

Definition at line 89 of file IRPipeline.cpp.


The documentation for this class was generated from the following files: