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

Process signals. More...

Classes

class  AdditiveNoise< SampleType >
 Mixes additive white noise to the signal. More...
 
class  DSPBase< SampleType >
 Polymorphic base for all DSP. More...
 
class  DSP< SampleType, Derived >
 Base for DSP effects. More...
 
class  DSPFunction< SampleType >
 A DSP processor defined by a user-provided function. More...
 
class  DSPSequence< SampleType >
 A DSP unit that renders audio through a linear sequence of DSP instances. More...
 
class  GainDb< SampleType >
 Applies gain in decibels to the signal. More...
 
class  GainLinear< SampleType >
 Applies linear gain (not decibels) to the signal. More...
 
class  HardClip< SampleType >
 Applies symmetrical hard clipping (no knee) to the signal. More...
 
class  Mute< SampleType >
 Mutes selected channels in the signal. More...
 
class  StereoToMidSide< SampleType >
 Converts regular stereo signal into mid-side signal. More...
 
class  TimeShift< SampleType >
 Shifts an audio signal forward in time by a fixed amount. More...
 

Macros

#define HART_DSP_NON_COPYABLE    std::unique_ptr<DSP<SampleType>> copy() const override { return nullptr; }
 Forbids hart::DSP::copy() method.
 
#define HART_DSP_NON_MOVABLE    std::unique_ptr<DSP<SampleType>> move() override { return nullptr; }
 Forbids hart::DSP::move() method.
 
#define HART_DSP_COPYABLE(ClassName)
 Implements a generic hart::DSP::copy() method.
 
#define HART_DSP_MOVABLE(ClassName)
 Implements a generic hart::DSP::move() method.
 
#define HART_DSP_SEQUENCE(...)    (DSPSequenceBuilder() >> __VA_ARGS__).build()
 Creates a linear DSP sequence using concise chain syntax.
 
#define HART_DSP_SEQUENCE_T(SampleType, ...)    (hart::DSPSequenceBuilder<SampleType>() >> __VA_ARGS__).build()
 Creates a DSP sequence for an explicit sample type.
 

Functions

template<typename SampleType >
std::ostream & operator<< (std::ostream &stream, const DSPBase< SampleType > &dsp)
 Prints readable text representation of the DSP object into the I/O stream.
 

Detailed Description

Process signals.

Macro Definition Documentation

◆ HART_DSP_NON_COPYABLE

#define HART_DSP_NON_COPYABLE    std::unique_ptr<DSP<SampleType>> copy() const override { return nullptr; }

Forbids hart::DSP::copy() method.

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

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

Definition at line 582 of file hart_dsp.hpp.

◆ HART_DSP_NON_MOVABLE

#define HART_DSP_NON_MOVABLE    std::unique_ptr<DSP<SampleType>> move() override { return nullptr; }

Forbids hart::DSP::move() method.

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

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

Obviously, you won't be able to pass your class to the host by rvalue or explicit move, but you still can pass it wrapped into a smart pointer like so:

processAudioWith (hart::make_unique<MyDspType>()).withThis().withThat().process();

Definition at line 597 of file hart_dsp.hpp.

◆ HART_DSP_COPYABLE

#define HART_DSP_COPYABLE (   ClassName)
Value:
virtual std::unique_ptr<DSPBase<SampleType>> copy() const override \
{ \
return hart::make_unique<ClassName> (static_cast<const ClassName&> (*this)); \
}

Implements a generic hart::DSP::copy() method.

Definition at line 602 of file hart_dsp.hpp.

◆ HART_DSP_MOVABLE

#define HART_DSP_MOVABLE (   ClassName)
Value:
virtual std::unique_ptr<DSPBase<SampleType>> move() override \
{ \
return hart::make_unique<ClassName> (std::move (static_cast<ClassName&> (*this))); \
}

Implements a generic hart::DSP::move() method.

Definition at line 610 of file hart_dsp.hpp.

◆ HART_DSP_SEQUENCE

#define HART_DSP_SEQUENCE (   ...)     (DSPSequenceBuilder() >> __VA_ARGS__).build()

Creates a linear DSP sequence using concise chain syntax.

This macro is the preferred way to create a DSPSequence.

It accepts a chain of DSP units chained with >>, preserving the exact order in which they should process the audio.

Example:

auto myDspChain = HART_DSP_SEQUENCE (
GainDb (-3_dB) >> HardClip (-1_dB) >> TimeShift (5_ms)
);
#define HART_DSP_SEQUENCE(...)
Creates a linear DSP sequence using concise chain syntax.

The resulting object behaves as a normal DSP subclass and can, among other things, be:

  • passed into processAudioWith()
  • used in a Signal's DSP chain
  • nested into another sequence
  • modified by appending or popping DSP elements
  • deep-copied via copy()
Note
This macro depends on HART DSP aliases being declared for the chosen sample type, for example:
#define HART_DECLARE_ALIASES_FOR_FLOAT
Put it before you test cases to use hart classes without hart:: namespace prefix and explicit float t...
Definition hart.hpp:107
(or a similar macro for double). You can also just use explicitly typedHART_DSP_SEQUENCE_T().

Definition at line 328 of file hart_dsp_sequence.hpp.

◆ HART_DSP_SEQUENCE_T

#define HART_DSP_SEQUENCE_T (   SampleType,
  ... 
)     (hart::DSPSequenceBuilder<SampleType>() >> __VA_ARGS__).build()

Creates a DSP sequence for an explicit sample type.

This typed variant of HART_DSP_SEQUENCE(...) is useful when DSP aliases are not declared.

Example:

auto chain = HART_DSP_SEQUENCE_T (
float,
GainDb<float> (-3_dB) >> HardClip<float> (-1_dB)
);
#define HART_DSP_SEQUENCE_T(SampleType,...)
Creates a DSP sequence for an explicit sample type.
Parameters
SampleTypeThe sample type used by the sequence and all DSP units

Definition at line 346 of file hart_dsp_sequence.hpp.

Function Documentation

◆ operator<<()

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

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

Definition at line 570 of file hart_dsp.hpp.