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

Generate signals. More...

Classes

class  AudioBufferSignal< SampleType >
 Plays audio from a pre-rendered AudioBuffer. More...
 
class  Impulse< SampleType >
 Produces a {1, 0, 0, 0, ...} sequence. More...
 
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, DerivedSignal >
 Base class for signals. More...
 
class  SignalFunction< SampleType >
 Signal defined by a user-provided function. 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 DerivedSignal , typename DerivedDSP >
auto operator>> (DerivedSignal &signal, DerivedDSP &&dsp) -> decltype(signal.followedBy(std::forward< DerivedDSP >(dsp)))
 Adds a DSP effect to the end of signal's DSP chain by transfering it.
 
template<typename DerivedSignal , typename DerivedDSP >
auto operator>> (DerivedSignal &&signal, DerivedDSP &&dsp) -> decltype(std::move(signal).followedBy(std::forward< 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();
A DSP processor defined by a user-provided function.
void process(const AudioBuffer< SampleType > &input, AudioBuffer< SampleType > &output, const EnvelopeBuffers &, ChannelFlags) override
Processes the audio.

Definition at line 529 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 481 of file hart_signal.hpp.

◆ operator>>() [1/2]

auto operator>> ( DerivedSignal< SampleType, DerivedSignal > &  signal,
DerivedDSP &&  dsp 
) -> decltype (signal.followedBy (std::forward<DerivedDSP> (dsp)))
related

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

Accepts any value that can be moved into the signal's DSP chain:

  • An rvalue of a class derived from DSPBase<SampleType>
  • An std::unique_ptr<DSPBase<SampleType>>

Definition at line 494 of file hart_signal.hpp.

◆ operator>>() [2/2]

auto operator>> ( DerivedSignal< SampleType, DerivedSignal > &&  signal,
DerivedDSP &&  dsp 
) -> decltype (std::move (signal).followedBy (std::forward<DerivedDSP> (dsp)))
related

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

Accepts any value that can be moved into the signal's DSP chain:

  • An rvalue of a class derived from DSPBase<SampleType>
  • An std::unique_ptr<DSPBase<SampleType>>

Definition at line 506 of file hart_signal.hpp.