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

#include <PluginProcessor.h>

Inheritance diagram for reverb::AudioProcessor:
Collaboration diagram for reverb::AudioProcessor:

Public Member Functions

 AudioProcessor ()
 Constructs a reverb audio processor & initialises its inner pipelines.
 
void prepareToPlay (double sampleRate, int samplesPerBlock) override
 Prepare the processor before playback starts. More...
 
void releaseResources () override
 Release resource when playback stops. More...
 
void processBlock (juce::AudioSampleBuffer &audio, juce::MidiBuffer &) override
 Applies reverb effect on audio buffer using parameters given through the editor. More...
 
void processBlockBypassed (juce::AudioSampleBuffer &audio, juce::MidiBuffer &midi) override
 
juce::AudioProcessorEditor * createEditor () override
 
bool hasEditor () const override
 
const juce::String getName () const override
 
bool acceptsMidi () const override
 
bool producesMidi () const override
 
bool isMidiEffect () const override
 
double getTailLengthSeconds () const override
 
int getNumPrograms () override
 
int getCurrentProgram () override
 
void setCurrentProgram (int index) override
 
const juce::String getProgramName (int index) override
 
void changeProgramName (int index, const juce::String &newName) override
 
void getStateInformation (juce::MemoryBlock &destData) override
 
void setStateInformation (const void *data, int sizeInBytes) override
 

Public Attributes

juce::AudioProcessorValueTreeState parameters
 
std::vector< IRPipeline::Ptr > irPipelines
 
std::vector< MainPipeline::Ptr > mainPipelines
 
std::mutex updatingParams
 

Static Public Attributes

static constexpr const char * PID_ACTIVE = "is_active"
 
static constexpr const char * PID_IR_FILE_CHOICE = "ir_file_choice"
 
static constexpr const char * PID_IR_LENGTH = "ir_length"
 
static constexpr const char * PID_FILTER_PREFIX = "filter"
 
static constexpr const char * PID_FILTER_FREQ_SUFFIX = "_freq"
 
static constexpr const char * PID_FILTER_Q_SUFFIX = "_q"
 
static constexpr const char * PID_FILTER_GAIN_SUFFIX = "_gain"
 
static constexpr const char * PID_PREDELAY = "predelay"
 
static constexpr const char * PID_IR_GAIN = "ir_gain"
 
static constexpr const char * PID_WETRATIO = "wetratio"
 
static constexpr const char * PID_AUDIO_OUT_GAIN = "audio_out_gain"
 

Protected Member Functions

void initParams ()
 
void updateParams (double sampleRate)
 Update parameters across all channels. More...
 
void updateParamsForChannel (int channelIdx, double sampleRate)
 Update parameters for a given channel. More...
 
void processChannel (int channelIdx)
 Applies reverb effect on single channel using preconfigured pipelines. More...
 

Protected Attributes

bool paramsInitialised = false
 
int64_t blocksProcessed = 0
 
AudioBlock audioChannels
 

Static Protected Attributes

static constexpr int NUM_BLOCKS_PER_UPDATE_PARAMS = 5
 

Detailed Description

Main reverb audio processor class. Contains all processing steps and provides a user- facing editor for parameter adjustment.

Definition at line 31 of file PluginProcessor.h.

Member Function Documentation

◆ initParams()

void reverb::AudioProcessor::initParams ( )
protected

Low-shelf filter

Peak filter 1

Peak filter 2

High-shelf filter

IR gain

IR length

Pre-delay

Dry/wet mixer

Output gain

Meta: Bypass detection flag

Impulse responses

IR file choice is given by a string that may be one of the following: 1) name of a valid audio resource in BinaryData.h 2) full path to user-provided IR file

END: Processor is responsible for deleting parameters on destruction

Definition at line 475 of file PluginProcessor.cpp.

◆ prepareToPlay()

void reverb::AudioProcessor::prepareToPlay ( double  sampleRate,
int  samplesPerBlock 
)
override

Prepare the processor before playback starts.

Called before playback starts, to let the processor prepare itself.

You can call getTotalNumInputChannels and getTotalNumOutputChannels or query the busLayout member variable to find out the number of channels your processBlock callback must process.

The samplesPerBlock value is a strong hint about the maximum number of samples that will be provided in each block. You may want to use this value to resize internal buffers. You should program defensively in case a buggy host exceeds this value. The actual block sizes that the host uses may be different each time the callback happens: completely variable block sizes can be expected from some hosts.

Parameters
sampleRate[in] Target sample rate (constant until playback stops)
samplesPerBlock[in] Hint about max. expected samples in upcoming block

Definition at line 131 of file PluginProcessor.cpp.

◆ processBlock()

void reverb::AudioProcessor::processBlock ( juce::AudioSampleBuffer &  audio,
juce::MidiBuffer &   
)
override

Applies reverb effect on audio buffer using parameters given through the editor.

Parameters
[in]bufferAudio buffer containing samples to process
midiMessagesUnused

Definition at line 212 of file PluginProcessor.cpp.

◆ processChannel()

void reverb::AudioProcessor::processChannel ( int  channelIdx)
protected

Applies reverb effect on single channel using preconfigured pipelines.

Parameters
[in]channelIdxIndex of channel to process

Definition at line 313 of file PluginProcessor.cpp.

◆ releaseResources()

void reverb::AudioProcessor::releaseResources ( )
override

Release resource when playback stops.

Used when playback stops as an opportunity to free up any spare memory, etc.

Definition at line 178 of file PluginProcessor.cpp.

◆ updateParams()

void reverb::AudioProcessor::updateParams ( double  sampleRate)
protected

Update parameters across all channels.

Update parameters in all IRPipeline and MainPipeline objects. If necessary, reprocess IR and add to MainPipeline.

MainPipeline is double-buffered to avoid interfering with processChannel(). IRPipeline is not used by any other methods, so it does not need protection.

Parameters
[in]sampleRateCurrent sample rate

Definition at line 341 of file PluginProcessor.cpp.

◆ updateParamsForChannel()

void reverb::AudioProcessor::updateParamsForChannel ( int  channelIdx,
double  sampleRate 
)
protected

Update parameters for a given channel.

Update parameters in IRPipeline and Mainpipeline for given channel. If necessary, reprocess IR using new parameters and copy to MainPipeline.

MainPipeline is double-buffered to avoid interfering with processChannel(). IRPipeline is not used by any other methods, so it does not need protection.

Parameters
[in]channelIdxChannel parameters should be updated for
[in]sampleRateCurrent sample rate

Definition at line 380 of file PluginProcessor.cpp.


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