|
HART
0.2.0
High level Audio Regression and Testing
|
Shifts an audio signal forward in time by a fixed amount. More...
#include <hart_time_shift.hpp>
Public Member Functions | |
| TimeShift (double delaySeconds) | |
| Creates a TimeShift processor with a fixed delay. | |
| TimeShift (const TimeShift &other) | |
| Creates a TimeShift processor by copying other one. | |
| TimeShift (TimeShift &&other) noexcept | |
| Creates a TimeShift processor by moving other one. | |
| TimeShift & | operator= (const TimeShift &other) |
| Creates a TimeShift processor by copying other one. | |
| TimeShift & | operator= (TimeShift &&other) noexcept |
| Creates a TimeShift processor by moving other one. | |
| ~TimeShift () override=default | |
| void | prepare (double sampleRateHz, size_t numInputChannels, size_t numOutputChannels, size_t) override |
| Prepare for processing. | |
| void | process (const AudioBuffer< SampleType > &input, AudioBuffer< SampleType > &output, const EnvelopeBuffers &, ChannelFlags) override |
| Processes the audio. | |
| bool | supportsEnvelopeFor (int) const override |
| Tells whether this effect accepts automation envelopes for a particular parameter. | |
| bool | supportsChannelLayout (size_t numInputChannels, size_t numOutputChannels) const override |
| Tells the runner (host) whether this effect supports a specific i/o configuration. | |
| bool | supportsSampleRate (double sampleRateHz) const override |
| Tells whether this effect supports given sample rate. | |
| void | represent (std::ostream &stream) const override |
| Makes a text representation of this DSP effect for test failure outputs. | |
| void | setValue (int, double) override |
| Sets DSP value. | |
| HART_DSP_COPYABLE (TimeShift) | |
| HART_DSP_MOVABLE (TimeShift) | |
Public Member Functions inherited from DSP< SampleType, TimeShift< SampleType > > | |
| TimeShift< SampleType > & | withEnvelope (int paramId, Envelope &&envelope) & |
| Adds envelope to a specific parameter by moving it. | |
| TimeShift< SampleType > && | withEnvelope (int paramId, Envelope &&envelope) && |
| Adds envelope to a specific parameter by moving it. | |
| TimeShift< SampleType > & | withEnvelope (int paramId, const Envelope &envelope) & |
| Adds envelope to a specific parameter by copying it. | |
| TimeShift< SampleType > && | withEnvelope (int paramId, const Envelope &envelope) && |
| Adds envelope to a specific parameter by copying it. | |
| virtual std::unique_ptr< DSPBase< SampleType > > | move () override |
| Returns a smart pointer with a moved instance of this object. | |
| TimeShift< SampleType > & | atChannels (std::initializer_list< size_t > channelsToProcess) & |
| Makes this DSP process only specific channels, and ignore the rest. | |
| TimeShift< SampleType > && | atChannels (std::initializer_list< size_t > channelsToProcess) && |
| Makes this DSP process only specific channels, and ignore the rest. | |
| TimeShift< SampleType > & | atChannel (size_t channelToProcess) & |
| Makes this DSP process only specific channels, and bypass the rest. | |
| TimeShift< SampleType > && | atChannel (size_t channelToProcess) && |
| Makes this DSP process only specific channels, and bypass the rest. | |
| TimeShift< SampleType > & | atAllChannels () & |
| Makes this DSP apply to all channels. | |
| TimeShift< SampleType > && | atAllChannels () && |
| Makes this DSP apply to all channels. | |
| TimeShift< SampleType > & | atAllChannelsExcept (std::initializer_list< size_t > channelsToSkip) & |
| Makes this DSP process only specific channels, and bypass the rest. | |
| TimeShift< 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 void | reset () |
| Resets to initial state. | |
| virtual double | getValue (int) const |
| Retrieves DSP value. | |
| virtual std::unique_ptr< DSPBase< SampleType > > | copy () const |
| Returns a smart pointer with a copy of this object. | |
| 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. | |
| void | resetWithEnvelopes () |
| Resets the DSP instance, and all associated Envelopes. | |
| 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, TimeShift< SampleType > > | |
| std::ostream & | operator<< (std::ostream &stream, const DSPBase< SampleType > &dsp) |
| Prints readable text representation of the DSP object into the I/O stream. | |
Shifts an audio signal forward in time by a fixed amount.
Delays the input signal by a specified duration, expressed in seconds. Internally, the delay is converted to an integer number of frames based on the current sample rate, so it soesn't do sub-frame (fractional) elays. This DSP is a low-level utility intended for testing and signal alignment purposes, such as compensating for latency in other processors. It performs a pure time shift with no feedback or dry/wet mixing. The output is zero-filled until the internal buffer is primed. Delay time is fixed and cannot be changed after construction or copy/move assignment. The delay is identical across all channels, and processing is only supported when the number of input and output channels matches. It is encouraged to use it in conjunction with hart::Impulse signal, although other signal types may also be appropriate.
| hart::ValueError | for negative or zero delay (in seconds or frames) |
| SampleType | Floating point sample type, typecally float or double. |
Definition at line 28 of file hart_time_shift.hpp.
|
inline |
Creates a TimeShift processor with a fixed delay.
| delaySeconds | Delay duration in seconds. Must be greater than zero. The delay value is converted to an integer number of frames during prepare(), based on the provided sample rate. Values that resolve to zero frames are rejected. |
| hart::ValueError | for negative or zero delay (in seconds or frames) |
Definition at line 37 of file hart_time_shift.hpp.
Creates a TimeShift processor by copying other one.
The entire state, included internal delay byffers' content is copied as well
| other | TimeShift to copy from |
Definition at line 47 of file hart_time_shift.hpp.
Creates a TimeShift processor by moving other one.
The entire state, included internal delay byffers' content is moved as well
| other | TimeShift to move from |
Definition at line 60 of file hart_time_shift.hpp.
|
overridedefault |
|
inline |
Creates a TimeShift processor by copying other one.
The entire state, included internal delay byffers' content is copied as well
| other | TimeShift to copy from |
Definition at line 76 of file hart_time_shift.hpp.
|
inlinenoexcept |
Creates a TimeShift processor by moving other one.
The entire state, included internal delay byffers' content is moved as well
| other | TimeShift to move from |
Definition at line 95 of file hart_time_shift.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 117 of file hart_time_shift.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(). Each vector in the envelopeBuffers map is guaranteed to be at least as large as input (and output) block. For partial blocks, only the first input.getNumFrames() elements contain valid data for the current block; the rest may be stale or uninitialized. DSP implementations are expected to ignore values beyond that index range.
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 143 of file hart_time_shift.hpp.
|
inlineoverridevirtual |
Tells whether this effect accepts automation envelopes for a particular parameter.
| paramId | Some ID that your subclass understands |
Reimplemented from DSPBase< SampleType >.
Definition at line 168 of file hart_time_shift.hpp.
|
inlineoverridevirtual |
Tells the runner (host) whether this effect supports a specific i/o configuration.
It is guaranteed that the effect will not receive unsupported number of channels in process(). However, it is not always possible to handle gracefully channel layout being unsupported, so in some circumstances it can cause an exception or a test failure. This method is guaranteed to be called at least once before prepare()
Implements DSPBase< SampleType >.
Definition at line 173 of file hart_time_shift.hpp.
|
inlineoverridevirtual |
Tells whether this effect supports given sample rate.
It is guaranteed to be called before prepare()
| sampleRateHz | Sample rate in question |
Reimplemented from DSPBase< SampleType >.
Definition at line 178 of file hart_time_shift.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 183 of file hart_time_shift.hpp.
|
inlineoverridevirtual |
Sets DSP value.
| paramId | Some ID that your subclass understands; use of enums is encouraged for readability |
| value | Value of the param in an appropriate unit; use of SI units is encouraged (i.e. s instead of ms. Hz instead of kHz) to make better use of unit literals (see Units) |
envelopeBuffers provided in process() callback. Implements DSPBase< SampleType >.
Definition at line 188 of file hart_time_shift.hpp.
| HART_DSP_COPYABLE | ( | TimeShift< SampleType > | ) |
| HART_DSP_MOVABLE | ( | TimeShift< SampleType > | ) |