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

#include <TimeStretch.h>

Inheritance diagram for reverb::TimeStretch:
Collaboration diagram for reverb::TimeStretch:

Public Types

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

Public Member Functions

 TimeStretch (juce::AudioProcessor *processor)
 Constructs a TimeStretch object associated with an AudioProcessor. More...
 
virtual void updateParams (const juce::AudioProcessorValueTreeState &params, const juce::String &blockID) override
 Updates parameters from processor parameter tree. More...
 
virtual AudioBlock exec (AudioBlock ir) override
 Apply time stretching algorithm to input IR buffer to change sample rate. More...
 
void prepareIR (juce::AudioSampleBuffer &ir)
 Copies given IR to internal representation and resizes it before processing. More...
 
int getOutputNumSamples ()
 Returns expected number of samples after processing. More...
 
- Public Member Functions inherited from reverb::Task
 Task (juce::AudioProcessor *processor)
 
virtual bool needsToRun () const
 Tells caller whether block must be run for current block. More...
 
virtual void updateSampleRate (double sr)
 Update sample rate for task block. More...
 

Protected Attributes

float irLengthS = 3.0f
 
juce::AudioSampleBuffer irOrig
 
std::unique_ptr< soundtouch::SoundTouch > soundtouch
 
- Protected Attributes inherited from reverb::Task
juce::AudioProcessor * processor
 
bool mustExec = true
 

Static Protected Attributes

static constexpr double MAX_IR_LENGTH_S = 5.0f
 

Additional Inherited Members

- Public Attributes inherited from reverb::Task
double sampleRate
 
- 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.
 

Detailed Description

Implements a time stretching algorithm to manage IR buffer length and sample rate.

Definition at line 22 of file TimeStretch.h.

Constructor & Destructor Documentation

◆ TimeStretch()

reverb::TimeStretch::TimeStretch ( juce::AudioProcessor *  processor)

Constructs a TimeStretch object associated with an AudioProcessor.

Creates a TimeStretch object with a handle to a SoundTouch instance

Parameters
[in]processorPointer to main processor
Exceptions
std::runtime_error

Definition at line 28 of file TimeStretch.cpp.

Member Function Documentation

◆ exec()

AudioBlock reverb::TimeStretch::exec ( AudioBlock  ir)
overridevirtual

Apply time stretching algorithm to input IR buffer to change sample rate.

Stretch or compress input buffer by a factor proportional to original and desired sample rates.

NOTE: prepareIR() method should be called before to manage buffer size. This will copy the original IR and resize the given buffer to the appropriate size based on sample rate and desired length.

Parameters
[in,out]irAudio sample buffer to process

Implements reverb::Task.

Definition at line 70 of file TimeStretch.cpp.

◆ getOutputNumSamples()

int reverb::TimeStretch::getOutputNumSamples ( )

Returns expected number of samples after processing.

Parameters
[in]inputNumSamplesNumber of samples in input buffer

Definition at line 145 of file TimeStretch.cpp.

◆ prepareIR()

void reverb::TimeStretch::prepareIR ( juce::AudioSampleBuffer &  ir)

Copies given IR to internal representation and resizes it before processing.

Parameters
[in,out]irIR to copy and resize

Definition at line 134 of file TimeStretch.cpp.

◆ updateParams()

void reverb::TimeStretch::updateParams ( const juce::AudioProcessorValueTreeState &  params,
const juce::String &  blockId 
)
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 45 of file TimeStretch.cpp.


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