|
HART
0.2.0
High level Audio Regression and Testing
|
#include <hart_dsp.hpp>
Public Member Functions | |
| Derived & | withEnvelope (int paramId, Envelope &&envelope) |
| Adds envelope to a specific parameter by moving it. | |
| Derived & | withEnvelope (int paramId, const Envelope &envelope) |
| Adds envelope to a specific parameter by copying it. | |
| virtual std::unique_ptr< DSPBase< SampleType > > | copy () const override |
| Returns a smart pointer with a copy of this object. | |
| virtual std::unique_ptr< DSPBase< SampleType > > | move () override |
| Returns a smart pointer with a moved instance of this object. | |
| Derived & | atChannels (std::initializer_list< size_t > channelsToProcess) |
| Makes this DSP process only specific channels, and ignore the rest. | |
| Derived & | atChannel (size_t channelToProcess) |
| Makes this DSP process only specific channels, and bypass the rest. | |
| Derived & | atAllChannels () |
| Makes this DSP apply to all channels. | |
| Derived & | atAllChannelsExcept (std::initializer_list< size_t > channelsToSkip) |
| Makes this DSP process only specific channels, and bypass the rest. | |
Public Member Functions inherited from DSPBase< SampleType > | |
| virtual void | prepare (double sampleRateHz, size_t numInputChannels, size_t numOutputChannels, size_t maxBlockSizeFrames)=0 |
| Prepare for processing. | |
| virtual void | process (const AudioBuffer< SampleType > &input, AudioBuffer< SampleType > &output, const EnvelopeBuffers &envelopeBuffers, ChannelFlags channelsToProcess)=0 |
| Processes the audio. | |
| virtual void | reset ()=0 |
| Resets to initial state. | |
| virtual void | setValue (int paramId, double value)=0 |
| Sets DSP value. | |
| virtual double | getValue (int paramId) const =0 |
| Retrieves DSP value. | |
| virtual bool | supportsChannelLayout (size_t numInputChannels, size_t numOutputChannels) const =0 |
| Tells the runner (host) whether this effect supports a specific i/o configuration. | |
| virtual void | represent (std::ostream &stream) const =0 |
| Makes a text representation of this DSP effect for test failure outputs. | |
| virtual bool | supportsEnvelopeFor (int) const |
| Tells whether this effect accepts automation envelopes for a particular parameter. | |
| virtual bool | supportsSampleRate (double) const |
| Tells whether this effect supports given sample rate. | |
| virtual | ~DSPBase ()=default |
| Destructor. | |
| DSPBase ()=default | |
| Default constructor. | |
| DSPBase (const DSPBase &other) | |
| Copies from another DSP effect instance. | |
| DSPBase (DSPBase &&other) noexcept | |
| Move constructor. | |
| DSPBase & | operator= (const DSPBase &other) |
| Copies from another DSP effect instance. | |
| DSPBase & | operator= (DSPBase &&other) noexcept |
| Move assignment. | |
| bool | hasEnvelopeFor (int paramId) |
| Checks if there's an automation envelope attached to a specific parameter. | |
| void | prepareWithEnvelopes (double sampleRateHz, size_t numInputChannels, size_t numOutputChannels, size_t maxBlockSizeFrames) |
| Prepares all the attached envelopes and the effect itself for processing. | |
| ChannelFlags | getChannelsToProcess () |
| Returns a structure indicating which channels should be processed by this DSP. | |
| void | processWithEnvelopes (const AudioBuffer< SampleType > &input, AudioBuffer< SampleType > &output) |
| Renders all the automation envelopes and processes the audio. | |
| void | representWithActiveChannels (std::ostream &stream) const |
| Makes a text representation of this DSP with optional "atChannels" appendix. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| template<typename SampleType > | |
| std::ostream & | operator<< (std::ostream &stream, const DSPBase< SampleType > &dsp) |
| Prints readable text representation of the DSP object into the I/O stream. | |
Additional Inherited Members | |
Protected Attributes inherited from DSPBase< SampleType > | |
| std::unordered_map< int, std::unique_ptr< Envelope > > | m_envelopes |
| ChannelFlags | m_channelsToProcess {true} |
Base for DSP effects.
This class is used both for adapting your DSP classes that you wish to test, and for using in DSP chains of Signals, so you can use stock effects like GainDb as tested processors, and you can use your tested DSP subclasses in Signals' DSP chains with other effects. You can even chain multiple of your own DSP classes together this way. All the callbacks of this class are guaranteed to be called from the same thread. To make your custom DSP wrapper, inherit from it like so (note the CRTP in the template args here, it's important!):
| SampleType | Type of values that will be processed, typically float or double |
| Derived | Subclass for CRTP |
Definition at line 320 of file hart_dsp.hpp.
Adds envelope to a specific parameter by moving it.
Guaranteed to be called strictly after the supportsEnvelopeFor() callback, and only if it has returned true for this specific paramId. Can be chained together like myEffect.withEnvelope (someId, someEnvelope).withEnvelope (otherId, otherEnvelope). If called multiple times for the same paramId, only last envelope for this ID will be used, all previous ones will be descarded.
| paramId | Some ID that your subclass understands |
| envelope | Envelope to be attached |
Definition at line 333 of file hart_dsp.hpp.
Adds envelope to a specific parameter by copying it.
Guaranteed to be called strictly after the supportsEnvelopeFor() callback, and only if it has returned true for this specific paramId. Can be chained together like myEffect.withEnvelope (someId, someEnvelope).withEnvelope (otherId, otherEnvelope). If called multiple times for the same paramId, only last envelope for this ID will be used, all previous ones will be descarded.
| paramId | Some ID that your subclass understands |
| envelope | Envelope to be attached |
Definition at line 350 of file hart_dsp.hpp.
|
inlineoverridevirtual |
Returns a smart pointer with a copy of this object.
Implements DSPBase< SampleType >.
Definition at line 362 of file hart_dsp.hpp.
|
inlineoverridevirtual |
Returns a smart pointer with a moved instance of this object.
Implements DSPBase< SampleType >.
Definition at line 368 of file hart_dsp.hpp.
Makes this DSP process only specific channels, and ignore the rest.
If not set, the DSP applies to all channels by default. If you call this method multiple times, only the last one will be applied. To select only one channel, consider using DSP::atChannel() instead.
| channelsToProcess | List of channels this DSP should apply to, e.g. {0, 1} or {Channel::left, Channel::right} for left and right channels only. |
hart::Channel Definition at line 380 of file hart_dsp.hpp.
Makes this DSP process only specific channels, and bypass the rest.
If not set, the DSP applies to all channels by default. If you call this method multiple times, only the last one will be applied. To select multiple channels, use DSP::atChannels() or atAllChannelsExcept() instead.
| channelToProcess | Channel this DSP should apply to (zero-based), e.g. 0 or Channel::left for left channel. |
hart::Channel Definition at line 404 of file hart_dsp.hpp.
|
inline |
Makes this DSP apply to all channels.
This is the default setting anyway, so this method is only for cases when you need to override previous atChannel(), atChannels() or atAllChannelsExcept() calls.
Definition at line 419 of file hart_dsp.hpp.
Makes this DSP process only specific channels, and bypass the rest.
If not set, DSP applies to all channels by default. If you call this method multiple times, only the last one will be applied.
| channelsToSkip | List of channels this DSP should NOT apply to, e.g. {0, 1} or {Channel::left, Channel::right} to bypass left and right channels, and process the rest |
hart::Channel Definition at line 432 of file hart_dsp.hpp.