LMMS
Loading...
Searching...
No Matches
juce::dsp::Bias< FloatType > Class Template Reference

#include <juce_Bias.h>

Public Member Functions

 Bias () noexcept=default
void setBias (FloatType newBias) noexcept
FloatType getBias () const noexcept
void setRampDurationSeconds (double newDurationSeconds) noexcept
double getRampDurationSeconds () const noexcept
void prepare (const ProcessSpec &spec) noexcept
void reset () noexcept
template<typename SampleType>
SampleType processSample (SampleType inputSample) noexcept
template<typename ProcessContext>
void process (const ProcessContext &context) noexcept

Private Member Functions

void updateRamp () noexcept

Private Attributes

SmoothedValue< FloatType > bias
double sampleRate = 0
double rampDurationSeconds = 0

Detailed Description

template<typename FloatType>
class juce::dsp::Bias< FloatType >

Adds a DC offset (voltage bias) to the audio samples.

This is a useful preprocessor for asymmetric waveshaping when a waveshaper is bookended by a bias on input and a DC-offset removing high pass filter on output.

This is an extremely simple bias implementation that simply adds a value to a signal. More complicated bias behaviours exist in real circuits - for your homework ;).

@tags{DSP}

Constructor & Destructor Documentation

◆ Bias()

template<typename FloatType>
juce::dsp::Bias< FloatType >::Bias ( )
defaultnoexcept

Member Function Documentation

◆ getBias()

template<typename FloatType>
FloatType juce::dsp::Bias< FloatType >::getBias ( ) const
inlinenoexcept

Returns the DC bias

Returns
DC bias, which should be in the range [-1, 1]

◆ getRampDurationSeconds()

template<typename FloatType>
double juce::dsp::Bias< FloatType >::getRampDurationSeconds ( ) const
inlinenoexcept

◆ prepare()

template<typename FloatType>
void juce::dsp::Bias< FloatType >::prepare ( const ProcessSpec & spec)
inlinenoexcept

Called before processing starts

◆ process()

template<typename FloatType>
template<typename ProcessContext>
void juce::dsp::Bias< FloatType >::process ( const ProcessContext & context)
inlinenoexcept

Processes the input and output buffers supplied in the processing context.

◆ processSample()

template<typename FloatType>
template<typename SampleType>
SampleType juce::dsp::Bias< FloatType >::processSample ( SampleType inputSample)
inlinenoexcept

Returns the result of processing a single sample.

◆ reset()

template<typename FloatType>
void juce::dsp::Bias< FloatType >::reset ( )
inlinenoexcept

◆ setBias()

template<typename FloatType>
void juce::dsp::Bias< FloatType >::setBias ( FloatType newBias)
inlinenoexcept

Sets the DC bias

Parameters
newBiasDC offset in range [-1, 1]

◆ setRampDurationSeconds()

template<typename FloatType>
void juce::dsp::Bias< FloatType >::setRampDurationSeconds ( double newDurationSeconds)
inlinenoexcept

Sets the length of the ramp used for smoothing gain changes.

◆ updateRamp()

template<typename FloatType>
void juce::dsp::Bias< FloatType >::updateRamp ( )
inlineprivatenoexcept

Member Data Documentation

◆ bias

template<typename FloatType>
SmoothedValue<FloatType> juce::dsp::Bias< FloatType >::bias
private

◆ rampDurationSeconds

template<typename FloatType>
double juce::dsp::Bias< FloatType >::rampDurationSeconds = 0
private

◆ sampleRate

template<typename FloatType>
double juce::dsp::Bias< FloatType >::sampleRate = 0
private

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