HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
Signals

Generate signals. More...

Classes

class  MixedSignal< SampleType >
 Produces a mix of multiple signals. More...
 
class  Sawtooth< SampleType >
 Produces a bandlimited sawtooth wave at fixed frequency. More...
 
class  SignalBase< SampleType >
 Polymorphic base for all signals. More...
 
class  Signal< SampleType, Derived >
 Base class for signals. More...
 
class  Silence< SampleType >
 Produces silence (zeros) More...
 
class  SineSweep< SampleType >
 Produces a sine sweep. More...
 
class  SineWave< SampleType >
 Produces a sine wave at fixed frequency. More...
 
class  WavFile< SampleType >
 Produces audio from a wav file. More...
 
class  WhiteNoise< SampleType >
 Produces deterministic white noise. More...
 

Macros

#define HART_SIGNAL_FORBID_COPY_AND_MOVE
 Forbids hart::Signal::copy() and hart::Signal::move() methods.
 

Functions

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.
 

Detailed Description

Generate signals.

Macro Definition Documentation

◆ HART_SIGNAL_FORBID_COPY_AND_MOVE

#define HART_SIGNAL_FORBID_COPY_AND_MOVE
Value:
std::unique_ptr<Signal<SampleType>> copy() const override { \
static_assert(false, "This Signal cannot be copied"); \
return nullptr; \
} \
std::unique_ptr<Signal<SampleType>> move() override { \
static_assert(false, "This Signal cannot be moved"); \
return nullptr; \
}

Forbids hart::Signal::copy() and hart::Signal::move() methods.

Put this into your class body's public section if either is true:

  • Your class is not trivially copyable and movable
  • You don't want to trouble yourself with implementing move and copy semantics for your class

Otherwise, use HART_SIGNAL_DEFINE_COPY_AND_MOVE() instead. Obviously, you won't be able to pass your class to the host by reference, copy or explicit move, but you still can pass it wrapped into a smart pointer like so:

processAudioWith (MyDSP())
.withInputSignal(hart::make_unique<MyDspType>()) // As input signal
.expectTrue (EqualsTo (hart::make_unique<MyDspType>())) // As reference signal
.process();

Definition at line 456 of file hart_signal.hpp.

Function Documentation

◆ operator+()

Adds one signal to another, resulting in a new mixed signal.

Definition at line 147 of file hart_mixed_signal.hpp.

◆ operator-()

Subtracts one signal from another, resulting in a new mixed signal.

Definition at line 162 of file hart_mixed_signal.hpp.

◆ operator<<()

template<typename SampleType >
std::ostream & operator<< ( std::ostream &  stream,
const SignalBase< SampleType > &  signal 
)
related

Prints readable text representation of the Signal object into the I/O stream.

Definition at line 350 of file hart_signal.hpp.

◆ operator>>() [1/7]

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< SampleType, Derived > > &  signal,
DerivedDSP &&  dsp 
)
related

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

Definition at line 365 of file hart_signal.hpp.

◆ operator>>() [2/7]

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

Definition at line 374 of file hart_signal.hpp.

◆ operator>>() [3/7]

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

Definition at line 383 of file hart_signal.hpp.

◆ operator>>() [4/7]

Signal< SampleType, DerivedSignal > & operator>> ( Signal< SampleType, DerivedSignal< SampleType, Derived > > &  signal,
std::unique_ptr< DSPBase< SampleType > > &&  dsp 
)
related

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

This is for smart pointers to abstract DSP type

Definition at line 393 of file hart_signal.hpp.

◆ operator>>() [5/7]

Signal< SampleType, DerivedSignal > && operator>> ( Signal< SampleType, DerivedSignal< SampleType, Derived > > &&  signal,
std::unique_ptr< DSPBase< SampleType > > &&  dsp 
)
related

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

This is for smart pointers to abstract DSP type

Definition at line 404 of file hart_signal.hpp.

◆ operator>>() [6/7]

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< SampleType, Derived > > &  signal,
std::unique_ptr< DerivedDSP > &&  dsp 
)
related

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

This is for smart pointers to actual (derived) DSP type

Definition at line 418 of file hart_signal.hpp.

◆ operator>>() [7/7]

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< SampleType, Derived > > &&  signal,
std::unique_ptr< DerivedDSP > &&  dsp 
)
related

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

This is for smart pointers to actual (derived) DSP type

Definition at line 432 of file hart_signal.hpp.