|
| | 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.
|
| |
| bool | supportsNumChannelsWithDSPChain (size_t numChannels) |
| | Checks whether the signal itself, and all the DSP instances in its signal chain support the requested channel number.
|
| |
| bool | supportsSampleRateWithDSPChain (double sampleRateHz) |
| | Checks whether the signal itself, and all the DSP instances in its signal chain support the requested sample rate.
|
| |
| 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.
|
| |
| size_t | getDSPChainSize () const |
| | Returns the size of the DSP chain attached to the Signal.
|
| |
| DSPBase< SampleType > * | getDSP (int index=-1) const |
| | Access a specific element in the DSP chain.
|
| |
| std::unique_ptr< DSPBase< SampleType > > | popDSP (int index=-1) |
| | Extract a specific element in the DSP chain by removing it.
|
| |
template<typename SampleType>
class hart::SignalBase< SampleType >
Polymorphic base for all signals.
- Warning
- This class exists only for type erasure and polymorphism. Do NOT inherit custom signals from this class directly. Inherit from hart::Signal instead.
Definition at line 27 of file hart_signal.hpp.
template<typename SampleType >
| virtual bool supportsNumChannels |
( |
size_t |
| ) |
const |
|
inlinevirtual |
template<typename SampleType >
| virtual void prepare |
( |
double |
sampleRateHz, |
|
|
size_t |
numOutputChannels, |
|
|
size_t |
maxBlockSizeFrames |
|
) |
| |
|
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.
- Parameters
-
| 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 >, AudioBufferSignal< SampleType >, SignalFunction< SampleType >, WavFile< SampleType >, Sawtooth< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WhiteNoise< SampleType >, DC< SampleType >, Impulse< SampleType >, NyquistSignal< SampleType >, and Silence< SampleType >.
template<typename SampleType >
| virtual void renderNextBlock |
( |
AudioBuffer< SampleType > & |
output | ) |
|
|
pure virtual |
Renders next block audio for the signal.
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.
- Warning
- Remember that the very last block of audio is almost always smaller than the block size set in prepare(), so be careful with buffer bounds.
- Note
- Note that this method does not have to be real-time safe, as all rendering always happens offline. Also note that, unlike real-time audio applications, this method is called on the same thread as all others like prepare().
- Parameters
-
- Warning
- Output audio buffer is not guaranteed to be pre-filled with zeros, it may contain junk data.
Implemented in AudioBufferSignal< SampleType >, DC< SampleType >, Impulse< SampleType >, MixedSignal< SampleType >, NyquistSignal< SampleType >, Sawtooth< SampleType >, SignalFunction< SampleType >, Silence< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WavFile< SampleType >, and WhiteNoise< SampleType >.
template<typename SampleType >
| virtual void represent |
( |
std::ostream & |
stream | ) |
const |
|
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.
- Parameters
-
| [out] | stream | Output stream to write to |
Implemented in MixedSignal< SampleType >, AudioBufferSignal< SampleType >, DC< SampleType >, Sawtooth< SampleType >, SignalFunction< SampleType >, SineSweep< SampleType >, SineWave< SampleType >, WavFile< SampleType >, and WhiteNoise< SampleType >.
template<typename SampleType >
| void prepareWithDSPChain |
( |
double |
sampleRateHz, |
|
|
size_t |
numOutputChannels, |
|
|
size_t |
maxBlockSizeFrames |
|
) |
| |
|
inline |
template<typename SampleType >
| void renderNextBlockWithDSPChain |
( |
AudioBuffer< SampleType > & |
output | ) |
|
|
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().
- Attention
- If you're not making a custom host, you probably don't need to call this method.
Definition at line 243 of file hart_signal.hpp.