|
HART
0.2.0
High level Audio Regression and Testing
|
Polymorphic base for all signals. More...
#include <hart_signal.hpp>
Public Member Functions | |
| SignalBase ()=default | |
| Default constructor. | |
| SignalBase (const SignalBase &other) | |
| Copies other signal. | |
| SignalBase (SignalBase &&other) noexcept | |
| Moves from other signal. | |
| virtual | ~SignalBase ()=default |
| Destructor. | |
| SignalBase & | operator= (const SignalBase &other) |
| Copies from other signal. | |
| SignalBase & | operator= (SignalBase &&other) noexcept |
| Moves from other signal. | |
| virtual bool | supportsNumChannels (size_t) const |
| Tells the host whether this Signal is capable of generating audio for a certain amount of channels. | |
| virtual bool | supportsSampleRate (double) const |
| Tells whether this Signal supports given sample rate. | |
| virtual void | prepare (double sampleRateHz, size_t numOutputChannels, size_t maxBlockSizeFrames)=0 |
| Prepare the signal for rendering. | |
| virtual void | renderNextBlock (AudioBuffer< SampleType > &output)=0 |
| Renders next block audio for the signal. | |
| virtual void | reset ()=0 |
| Resets the Signal to initial state. | |
| virtual std::unique_ptr< SignalBase< SampleType > > | copy () const =0 |
| Returns a smart pointer with a copy of this object. | |
| virtual std::unique_ptr< SignalBase< SampleType > > | move ()=0 |
| Returns a smart pointer with a moved instance of this object. | |
| virtual void | represent (std::ostream &stream) const =0 |
| Makes a text representation of this Signal for test failure outputs. | |
| void | prepareWithDSPChain (double sampleRateHz, size_t numOutputChannels, size_t maxBlockSizeFrames) |
| Prepares the signal and all attached effects in the DSP chain for rendering. | |
| void | renderNextBlockWithDSPChain (AudioBuffer< SampleType > &output) |
| Renders next block audio for the signal and all the effects in the DSP chain. | |
| virtual void | resetWithDSPChain () |
| Resets to Signal and all the effects attached to its DSP chain to initial state. | |
Protected Member Functions | |
| void | setNumChannels (size_t numChannels) |
| size_t | getNumChannels () |
Protected Attributes | |
| size_t | m_numChannels = 1 |
| double | m_startTimestampSeconds = 0.0 |
| std::vector< std::unique_ptr< DSPBase< SampleType > > > | dspChain |
Polymorphic base for all signals.
Definition at line 27 of file hart_signal.hpp.
|
default |
Default constructor.
|
inline |
Copies other signal.
Definition at line 34 of file hart_signal.hpp.
|
inlinenoexcept |
Moves from other signal.
Definition at line 48 of file hart_signal.hpp.
|
virtualdefault |
Destructor.
|
inline |
Copies from other signal.
Definition at line 61 of file hart_signal.hpp.
|
inlinenoexcept |
Moves from other signal.
Definition at line 80 of file hart_signal.hpp.
|
inlinevirtual |
Tells the host whether this Signal is capable of generating audio for a certain amount of channels.
It is guaranteed that the signal will not receive unsupported number of channels in renderNextBlock(). This method is guaranteed to be called at least once before prepare()
| numChannels | Number of output channels that will need to be filled |
Reimplemented in WavFile< SampleType >, Silence< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, and WhiteNoise< SampleType >.
Definition at line 100 of file hart_signal.hpp.
|
inlinevirtual |
Tells whether this Signal supports given sample rate.
It is guaranteed to be called before prepare()
| sampleRateHz | sample rate at which the audio should be generated |
Definition at line 107 of file hart_signal.hpp.
|
pure virtual |
Prepare the signal for rendering.
This method is guaranteed to be called after supportsNumChannels() and supportsSampleRate(), but before renderNextBlock(). It is guaranteed that numChannels obeys supportsNumChannels() preferences, same with sampleRateHz and supportsSampleRate(). It is guaranteed that all subsequent renderNextBlock() calls will be in line with the arguments received in this callback.
| sampleRateHz | sample rate at which the audio should be generated |
| numOutputChannels | Number of output channels to be filled |
| maxBlockSizeFrames | Maximum block size in frames (samples) |
Implemented in MixedSignal< SampleType >, WavFile< SampleType >, Sawtooth< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WhiteNoise< SampleType >, and Silence< SampleType >.
|
pure virtual |
Renders next block audio for the signal.
Depending on circumstances, this callback will either be called once to generate an entire piece of audio from start to finish, or called repeatedly, one block at a time. This method is guaranteed to be called strictly after prepare(), or not called at all. Number of channels and max block size are guaranteed to be in line with the ones set by prepare() callback. Assume sample rate to always be equal to the one received in the last prepare() callback. All audio blocks except the last one are guaranteed to be equal to maxBlockSizeFrames set in prepare() callback.
| output | Output audio block |
Implemented in MixedSignal< SampleType >, Sawtooth< SampleType >, Silence< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WavFile< SampleType >, and WhiteNoise< SampleType >.
|
pure virtual |
Resets the Signal to initial state.
Ideally should be implemented in a way that audio produced after resetting is identical to audio produced after instantiation
Implemented in MixedSignal< SampleType >, Sawtooth< SampleType >, Silence< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WavFile< SampleType >, and WhiteNoise< SampleType >.
|
pure virtual |
Returns a smart pointer with a copy of this object.
Implemented in Signal< SampleType, Derived >, Signal< SampleType, MixedSignal< SampleType > >, Signal< SampleType, Sawtooth< SampleType > >, Signal< SampleType, Silence< SampleType > >, Signal< SampleType, SineSweep< SampleType > >, Signal< SampleType, SineWave< SampleType > >, Signal< SampleType, WavFile< SampleType > >, and Signal< SampleType, WhiteNoise< SampleType > >.
|
pure virtual |
Returns a smart pointer with a moved instance of this object.
Implemented in Signal< SampleType, Derived >, Signal< SampleType, MixedSignal< SampleType > >, Signal< SampleType, Sawtooth< SampleType > >, Signal< SampleType, Silence< SampleType > >, Signal< SampleType, SineSweep< SampleType > >, Signal< SampleType, SineWave< SampleType > >, Signal< SampleType, WavFile< SampleType > >, and Signal< SampleType, WhiteNoise< SampleType > >.
|
pure virtual |
Makes a text representation of this Signal 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 |
Implemented in MixedSignal< SampleType >, Sawtooth< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WavFile< SampleType >, and WhiteNoise< SampleType >.
|
inline |
Prepares the signal and all attached effects in the DSP chain for rendering.
This method is intended to be called by Signal hosts like AudioTestBuilder or Matcher. If you're making something that owns an instance of a Signal and needs it to generate audio, like a custom Matcher, you must call this method before calling renderNextBlockWithDSPChain(). You must also call supportsNumChannels() and supportsSampleRate() before calling this method.
Definition at line 161 of file hart_signal.hpp.
|
inline |
Renders next block audio for the signal and all the effects in the DSP chain.
This method is intended to be called by Signal hosts like AudioTestBuilder or Matcher If you're making something that owns an instance of a Signal and needs it to generate audio, like a custom Matcher, you must call it after calling prepareWithDSPChain().
Definition at line 187 of file hart_signal.hpp.
|
inlinevirtual |
Resets to Signal and all the effects attached to its DSP chain to initial state.
This method is intended to be called by hosts like AudioTestBuilder or Matcher. If you're not making a custom host, you probably don't need this method.
Definition at line 199 of file hart_signal.hpp.
|
inlineprotected |
Definition at line 224 of file hart_signal.hpp.
|
inlineprotected |
Definition at line 229 of file hart_signal.hpp.
|
protected |
Definition at line 234 of file hart_signal.hpp.
|
protected |
Definition at line 235 of file hart_signal.hpp.
|
protected |
Definition at line 236 of file hart_signal.hpp.