Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::LadderBankT< SampleType, Voices > Class Template Reference

Voices independent LadderFilterT voices advanced together. More...

#include <ladder_bank.hpp>

Public Types

using Filter = LadderFilterT<SampleType>

Public Member Functions

 LadderBankT ()
void set_sample_rate (SampleType sample_rate)
 Set the sample rate every voice runs at, and recompute every voice's coefficient for its current frequency.
SampleType sample_rate () const
void set_frequency (std::size_t voice, SampleType hz)
void set_resonance (std::size_t voice, SampleType resonance)
SampleType frequency (std::size_t voice) const
SampleType resonance (std::size_t voice) const
SampleType stage_coefficient (std::size_t voice) const
 The voice's per-stage one-pole coefficient (Filter::stage_coefficient()).
void process (const SampleType *in, SampleType *out)
 Advance every voice by one sample: out[v] = voice v's output for in[v].
void process_voices (SampleType *const *buffers, std::size_t num_samples)
 Advance every voice by num_samples samples in place, one buffer per voice (buffers[v] holds voice v's input and receives its output).
void reset (std::size_t voice)
 Clear one voice's state.
void reset ()
 Clear every voice's state.

Static Public Attributes

static constexpr std::size_t voice_count = Voices

Detailed Description

template<typename SampleType = float, std::size_t Voices = 16>
class pulp::signal::LadderBankT< SampleType, Voices >

Voices independent LadderFilterT voices advanced together.

Contract:

Selects inside the per-voice loops are bit operations (detail:: select_bits) with the same values as the scalar filter's conditionals, so the loops vectorize under GCC's default -ftrapping-math too.

Why it is faster: a ladder sample is a chain of five dependent saturations, so one voice at a time is latency-bound. The bank computes stage 1 of every voice, then stage 2 of every voice, and so on, with the voices' state in structure-of-arrays form; each stage is then a loop over independent voices that the compiler vectorizes and that keeps many recursions in flight.

RT contract: storage is fixed-size; every member function allocates no memory.

Member Typedef Documentation

◆ Filter

template<typename SampleType = float, std::size_t Voices = 16>
using pulp::signal::LadderBankT< SampleType, Voices >::Filter = LadderFilterT<SampleType>

Constructor & Destructor Documentation

◆ LadderBankT()

template<typename SampleType = float, std::size_t Voices = 16>
pulp::signal::LadderBankT< SampleType, Voices >::LadderBankT ( )
inline

Member Function Documentation

◆ frequency()

template<typename SampleType = float, std::size_t Voices = 16>
SampleType pulp::signal::LadderBankT< SampleType, Voices >::frequency ( std::size_t voice) const
inline

◆ process()

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::process ( const SampleType * in,
SampleType * out )
inline

Advance every voice by one sample: out[v] = voice v's output for in[v].

in and out may be the same array.

◆ process_voices()

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::process_voices ( SampleType *const * buffers,
std::size_t num_samples )
inline

Advance every voice by num_samples samples in place, one buffer per voice (buffers[v] holds voice v's input and receives its output).

◆ reset() [1/2]

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::reset ( )
inline

Clear every voice's state.

◆ reset() [2/2]

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::reset ( std::size_t voice)
inline

Clear one voice's state.

◆ resonance()

template<typename SampleType = float, std::size_t Voices = 16>
SampleType pulp::signal::LadderBankT< SampleType, Voices >::resonance ( std::size_t voice) const
inline

◆ sample_rate()

template<typename SampleType = float, std::size_t Voices = 16>
SampleType pulp::signal::LadderBankT< SampleType, Voices >::sample_rate ( ) const
inline

◆ set_frequency()

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::set_frequency ( std::size_t voice,
SampleType hz )
inline

◆ set_resonance()

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::set_resonance ( std::size_t voice,
SampleType resonance )
inline

◆ set_sample_rate()

template<typename SampleType = float, std::size_t Voices = 16>
void pulp::signal::LadderBankT< SampleType, Voices >::set_sample_rate ( SampleType sample_rate)
inline

Set the sample rate every voice runs at, and recompute every voice's coefficient for its current frequency.

◆ stage_coefficient()

template<typename SampleType = float, std::size_t Voices = 16>
SampleType pulp::signal::LadderBankT< SampleType, Voices >::stage_coefficient ( std::size_t voice) const
inline

The voice's per-stage one-pole coefficient (Filter::stage_coefficient()).

Member Data Documentation

◆ voice_count

template<typename SampleType = float, std::size_t Voices = 16>
std::size_t pulp::signal::LadderBankT< SampleType, Voices >::voice_count = Voices
staticconstexpr

The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/ladder_bank.hpp