|
HART
0.2.0
High level Audio Regression and Testing
|
Applies linear gain (not decibels) to the signal. More...
#include <hart_gainlinear.hpp>
Public Types | |
| enum | Params { gainLinear } |
Public Member Functions | |
| GainLinear (double initialGainLinear=1.0) | |
| Constructor. | |
| void | prepare (double, size_t, size_t, size_t) override |
| Prepare for processing. | |
| void | process (const AudioBuffer< SampleType > &input, AudioBuffer< SampleType > &output, const EnvelopeBuffers &envelopeBuffers, ChannelFlags channelsToProcess) override |
| Processes the audio. | |
| void | reset () override |
| Resets to initial state. | |
| void | setValue (int id, double value) override |
| double | getValue (int id) const override |
| virtual bool | supportsChannelLayout (size_t numInputChannels, size_t numOutputChannels) const override |
| virtual void | represent (std::ostream &stream) const override |
| Makes a text representation of this DSP effect for test failure outputs. | |
| bool | supportsEnvelopeFor (int id) const override |
Public Member Functions inherited from DSP< SampleType, GainLinear< SampleType > > | |
| GainLinear< SampleType > & | withEnvelope (int paramId, Envelope &&envelope) |
| Adds envelope to a specific parameter by moving it. | |
| GainLinear< SampleType > & | 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. | |
| GainLinear< SampleType > & | atChannels (std::initializer_list< size_t > channelsToProcess) |
| Makes this DSP process only specific channels, and ignore the rest. | |
| GainLinear< SampleType > & | atChannel (size_t channelToProcess) |
| Makes this DSP process only specific channels, and bypass the rest. | |
| GainLinear< SampleType > & | atAllChannels () |
| Makes this DSP apply to all channels. | |
| GainLinear< SampleType > & | 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 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. | |
Additional Inherited Members | |
Protected Attributes inherited from DSPBase< SampleType > | |
| std::unordered_map< int, std::unique_ptr< Envelope > > | m_envelopes |
| ChannelFlags | m_channelsToProcess {true} |
Related Symbols inherited from DSP< SampleType, GainLinear< SampleType > > | |
| std::ostream & | operator<< (std::ostream &stream, const DSPBase< SampleType > &dsp) |
| Prints readable text representation of the DSP object into the I/O stream. | |
Applies linear gain (not decibels) to the signal.
To set gain in decibels, consider using GainDb class instead
Definition at line 17 of file hart_gainlinear.hpp.
| enum Params |
| Enumerator | |
|---|---|
| gainLinear | Linear gain. |
Definition at line 21 of file hart_gainlinear.hpp.
|
inline |
Constructor.
| initialGainLinear | Linear gain |
Definition at line 28 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
Prepare for processing.
In real-time DSP, such methods are usually used for allocating memory and other non-realtime-safe and heavyweight operations. But keep in mind that that HART does not do real-time processing, so this merely follows common real-time DSP design conventions, where non-realtime operations are done in a separate callback like this one. This method is guaranteed to be called after supportsChannelLayout() and supportsSampleRate(), but before process(). It is guaranteed that the number of input and output channels obeys supportsChannelLayout() and supportsSampleRate() preferences. It is guaranteed that all subsequent process() calls will be in line with the arguments received in this callback.
| sampleRateHz | sample rate at which the audio should be interpreted and processed |
| numInputChannels | Number of input channels |
| numOutputChannels | Number of output channels |
| maxBlockSizeFrames | Maximum block size in frames (samples) |
Implements DSPBase< SampleType >.
Definition at line 34 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
Processes the audio.
Depending on circumstances, this callback will either be called once to process an entire piece of audio from start to finish, or called repeatedly, one block at a time (see AudioTestBuilder::withBlockSize()). All audio blocks except the last one are guaranteed to be equal to maxBlockSizeFrames set in prepare() callback. It is guaranteed that input and output buffers are equal in length in frames (samples) to each, but they might have different number of channels. Use supportsChannelLayout() to indicate whether the effect supports a specific i/o configuration or not, as it will be called before prepare(). It is guaranteed that envelopeBuffers will only contain the values for all attached envelopes for this instance of DSP effect, and will not contain any data (including key with empty item) if there's no envelope attached to a specific parameter ID in this effects's instance. It will never contain envelopes for IDs that get rejected by supportsEnvelopeFor().
input and output may be references to the same object. | input | Input audio block |
| output | Output audio block |
| envelopeBuffers | Envelope values for this block, see EnvelopeBuffers |
| channelsToProcess | Channels that need processing. Process channels that are marked true, bypass ones marked false. |
Implements DSPBase< SampleType >.
Definition at line 36 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
Resets to initial state.
Ideally should be implemented in a way that audio produced after resetting is identical to audio produced after instantiation
Implements DSPBase< SampleType >.
Definition at line 53 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
| id | Only GainLinear::gainLinear is accepted |
| value | linear gain |
Implements DSPBase< SampleType >.
Definition at line 57 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
| id | Only GainLinear::gainLinear is accepted |
Implements DSPBase< SampleType >.
Definition at line 65 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
Supports n-to-n configurations
Implements DSPBase< SampleType >.
Definition at line 74 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
Makes a text representation of this DSP effect for test failure outputs.
It is strongly encouraged to follow python's repr() conventions for returned text - basically, put something like "MyClass(value1, value2)" (with no quotes) into the stream whenever possible, or "<Readable info in angled brackets>" otherwise. Also, use built-in stream manipulators like dbPrecision wherever applicable. Use HART_DEFINE_GENERIC_REPRESENT() to get a basic implementation for this method.
| [out] | stream | Output stream to write to |
Implements DSPBase< SampleType >.
Definition at line 79 of file hart_gainlinear.hpp.
|
inlineoverridevirtual |
| id | Only GainLinear::gainLinear is accepted return true for GainLinear::gainLinear, else otherwise |
Reimplemented from DSPBase< SampleType >.
Definition at line 86 of file hart_gainlinear.hpp.