HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
Signal< SampleType, Derived > Class Template Reference

Base class for signals. More...

#include <hart_signal.hpp>

Inheritance diagram for Signal< SampleType, Derived >:

Public Member Functions

DerivedfollowedBy (const DSPBase< SampleType > &dsp)
 Adds a DSP effect to the end of signal's DSP chain by copying it.
 
SignalfollowedBy (std::unique_ptr< DSPBase< SampleType > > dsp)
 Adds a DSP effect to the end of signal's DSP chain by transfering a smart pointer.
 
template<typename DerivedDSP , typename = typename std::enable_if< std::is_base_of< DSPBase<SampleType>, typename std::decay<DerivedDSP>::type >::value >::type>
SignalfollowedBy (DerivedDSP &&dsp)
 Adds a DSP effect to the end of signal's DSP chain by moving it.
 
std::unique_ptr< SignalBase< SampleType > > copy () const override
 Returns a smart pointer with a copy of this object.
 
std::unique_ptr< SignalBase< SampleType > > move () override
 Returns a smart pointer with a moved instance of this object.
 
DerivedskipTo (double startTimestampSeconds)
 Skips the signal to a specific timestamp.
 
Derived operator- () const
 Returns a copy of this signal, but with flipped phase.
 
Derived operator~ () const
 Returns a copy of this signal, but with flipped phase.
 
- Public Member Functions inherited from SignalBase< SampleType >
 SignalBase ()=default
 Default constructor.
 
 SignalBase (const SignalBase &other)
 Copies other signal.
 
 SignalBase (SignalBase &&other) noexcept
 Moves from other signal.
 
virtual ~SignalBase ()=default
 Destructor.
 
SignalBaseoperator= (const SignalBase &other)
 Copies from other signal.
 
SignalBaseoperator= (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 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.
 

Related Symbols

(Note that these are not member symbols.)

template<typename SampleType , typename DerivedSignalTypeLHS , typename DerivedSignalTypeRHS >
MixedSignal< SampleTypeoperator+ (const Signal< SampleType, DerivedSignalTypeLHS > &lhs, const Signal< SampleType, DerivedSignalTypeRHS > &rhs)
 Adds one signal to another, resulting in a new mixed signal.
 
template<typename SampleType , typename DerivedSignalTypeLHS , typename DerivedSignalTypeRHS >
MixedSignal< SampleTypeoperator- (const Signal< SampleType, DerivedSignalTypeLHS > &lhs, const Signal< SampleType, DerivedSignalTypeRHS > &rhs)
 Subtracts one signal from another, resulting in a new mixed signal.
 
template<typename SampleType >
std::ostream & operator<< (std::ostream &stream, const SignalBase< SampleType > &signal)
 Prints readable text representation of the Signal object into the I/O stream.
 
template<typename SampleType , typename DerivedSignal , typename DerivedDSP , typename std::enable_if< std::is_base_of< DSPBase< SampleType >, typename std::decay< DerivedDSP >::type >::value >::type >
Signal< SampleType, DerivedSignal > & operator>> (Signal< SampleType, DerivedSignal > &signal, DerivedDSP &&dsp)
 Adds a DSP effect to the end of signal's DSP chain by moving it.
 
template<typename SampleType , typename DerivedSignal >
Signal< SampleType, DerivedSignal > & operator>> (Signal< SampleType, DerivedSignal > &signal, const DSPBase< SampleType > &dsp)
 Adds a DSP effect to the end of signal's DSP chain by copying it.
 
template<typename SampleType , typename DerivedSignal >
Signal< SampleType, DerivedSignal > && operator>> (Signal< SampleType, DerivedSignal > &&signal, const DSPBase< SampleType > &dsp)
 Adds a DSP effect to the end of signal's DSP chain by copying it.
 
template<typename SampleType , typename DerivedSignal >
Signal< SampleType, DerivedSignal > & operator>> (Signal< SampleType, DerivedSignal > &signal, std::unique_ptr< DSPBase< SampleType > > &&dsp)
 Adds a DSP effect to the end of signal's DSP chain by transfering it.
 
template<typename SampleType , typename DerivedSignal >
Signal< SampleType, DerivedSignal > && operator>> (Signal< SampleType, DerivedSignal > &&signal, std::unique_ptr< DSPBase< SampleType > > &&dsp)
 Adds a DSP effect to the end of signal's DSP chain by transfering it.
 
template<typename SampleType , typename DerivedSignal , typename DerivedDSP , typename = typename std::enable_if<std::is_base_of<DSPBase<SampleType>, DerivedDSP>::value>::type>
Signal< SampleType, DerivedSignal > & operator>> (Signal< SampleType, DerivedSignal > &signal, std::unique_ptr< DerivedDSP > &&dsp)
 Adds a DSP effect to the end of signal's DSP chain by transfering it.
 
template<typename SampleType , typename DerivedSignal , typename DerivedDSP , typename = typename std::enable_if<std::is_base_of<DSPBase<SampleType>, DerivedDSP>::value>::type>
Signal< SampleType, DerivedSignal > && operator>> (Signal< SampleType, DerivedSignal > &&signal, std::unique_ptr< DerivedDSP > &&dsp)
 Adds a DSP effect to the end of signal's DSP chain by transfering it.
 

Additional Inherited Members

- Protected Member Functions inherited from SignalBase< SampleType >
void setNumChannels (size_t numChannels)
 
size_t getNumChannels ()
 
- Protected Attributes inherited from SignalBase< SampleType >
size_t m_numChannels = 1
 
double m_startTimestampSeconds = 0.0
 
std::vector< std::unique_ptr< DSPBase< SampleType > > > dspChain
 

Detailed Description

template<typename SampleType, typename Derived>
class hart::Signal< SampleType, Derived >

Base class for signals.

Template Parameters
SampleTypeType of values that will be generated, typically float or double
DerivedSubclass for CRTP

Definition at line 262 of file hart_signal.hpp.

Member Function Documentation

◆ followedBy() [1/3]

Derived & followedBy ( const DSPBase< SampleType > &  dsp)
inline

Adds a DSP effect to the end of signal's DSP chain by copying it.

Note
If your DSP object does not support copying or moving, use version of this method that takes a unique_ptr instead
Parameters
dspA DSP effect instance

Definition at line 269 of file hart_signal.hpp.

◆ followedBy() [2/3]

Signal & followedBy ( std::unique_ptr< DSPBase< SampleType > >  dsp)
inline

Adds a DSP effect to the end of signal's DSP chain by transfering a smart pointer.

Note
If your DSP object does not support copying or moving, use version of this method that takes a unique_ptr instead
Parameters
dspA DSP effect instance

Definition at line 278 of file hart_signal.hpp.

◆ followedBy() [3/3]

template<typename DerivedDSP , typename = typename std::enable_if< std::is_base_of< DSPBase<SampleType>, typename std::decay<DerivedDSP>::type >::value >::type>
Signal & followedBy ( DerivedDSP &&  dsp)
inline

Adds a DSP effect to the end of signal's DSP chain by moving it.

Note
If your DSP object does not support copying or moving, use version of this method that takes a unique_ptr instead
Parameters
dspA DSP effect instance

Definition at line 298 of file hart_signal.hpp.

◆ copy()

std::unique_ptr< SignalBase< SampleType > > copy ( ) const
inlineoverridevirtual

Returns a smart pointer with a copy of this object.

Implements SignalBase< SampleType >.

Definition at line 307 of file hart_signal.hpp.

◆ move()

std::unique_ptr< SignalBase< SampleType > > move ( )
inlineoverridevirtual

Returns a smart pointer with a moved instance of this object.

Implements SignalBase< SampleType >.

Definition at line 312 of file hart_signal.hpp.

◆ skipTo()

Derived & skipTo ( double  startTimestampSeconds)
inline

Skips the signal to a specific timestamp.

Fast-forwards the signal, with all attaches DSP effects and their automation envelopes. Calling it multiple times on one instance will stack the skip times.

Note
Keep in mind that the skip is accurate within one audio frame tolerance
Parameters
startTimestampSecondsHow much time to skip from the start of the signal

Definition at line 322 of file hart_signal.hpp.

◆ operator-()

Derived operator- ( ) const
inline

Returns a copy of this signal, but with flipped phase.

Definition at line 332 of file hart_signal.hpp.

◆ operator~()

Derived operator~ ( ) const
inline

Returns a copy of this signal, but with flipped phase.

Definition at line 340 of file hart_signal.hpp.


The documentation for this class was generated from the following files: