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

Executes a bounded cascade of normalized second-order sections (SOS). More...

#include <sos_cascade.hpp>

Public Types

using Coefficients = BiquadCoefficientsT<SampleType>

Public Member Functions

bool prepare (std::size_t section_capacity) noexcept
 Select the usable prefix of fixed storage and clear the active cascade.
bool prepared () const noexcept
std::size_t capacity () const noexcept
std::size_t size () const noexcept
template<typename CoefficientType, std::size_t Extent>
SosCascadeInstallStatus set_coefficients (std::span< BiquadCoefficientsT< CoefficientType >, Extent > coefficients, SosCascadeTransition transition=SosCascadeTransition::reset_state) noexcept
 Install one complete SOS cascade.
template<typename CoefficientType, std::size_t Extent>
SosCascadeInstallStatus set_coefficients (std::span< const BiquadCoefficientsT< CoefficientType >, Extent > coefficients, SosCascadeTransition transition=SosCascadeTransition::reset_state) noexcept
SampleType process (SampleType input) noexcept
void process (SampleType *buffer, std::size_t num_samples) noexcept
 Process a buffer in place through BiquadT::process_chain().
void reset () noexcept
Coefficients coefficients (std::size_t index) const noexcept

Static Public Member Functions

static constexpr std::size_t storage_capacity () noexcept
static void process_stereo (SosCascadeT &left, SosCascadeT &right, SampleType *left_buffer, SampleType *right_buffer, std::size_t num_samples) noexcept
 Process two channels in place, each through its own cascade, with the two channels in vector lanes (BiquadT::process_chain_stereo()).

Detailed Description

template<typename SampleType = float, std::size_t MaxSections = 16>
class pulp::signal::SosCascadeT< SampleType, MaxSections >

Executes a bounded cascade of normalized second-order sections (SOS).

This class deliberately accepts only BiquadCoefficientsT sections. It is not an arbitrary-order direct-form IIR implementation. Call prepare() on a control thread, then install a complete coefficient span at a block boundary. Validation is whole-cascade transactional: a rejected span leaves both the active coefficients and every recursive state unchanged.

RT contract: storage is a fixed std::array. process(), reset(), prepare(), and coefficient installation perform bounded work and allocate no memory.

Member Typedef Documentation

◆ Coefficients

template<typename SampleType = float, std::size_t MaxSections = 16>
using pulp::signal::SosCascadeT< SampleType, MaxSections >::Coefficients = BiquadCoefficientsT<SampleType>

Member Function Documentation

◆ capacity()

template<typename SampleType = float, std::size_t MaxSections = 16>
std::size_t pulp::signal::SosCascadeT< SampleType, MaxSections >::capacity ( ) const
inlinenoexcept

◆ coefficients()

template<typename SampleType = float, std::size_t MaxSections = 16>
Coefficients pulp::signal::SosCascadeT< SampleType, MaxSections >::coefficients ( std::size_t index) const
inlinenoexcept

◆ prepare()

template<typename SampleType = float, std::size_t MaxSections = 16>
bool pulp::signal::SosCascadeT< SampleType, MaxSections >::prepare ( std::size_t section_capacity)
inlinenoexcept

Select the usable prefix of fixed storage and clear the active cascade.

Invalid capacities are rejected without changing the object.

◆ prepared()

template<typename SampleType = float, std::size_t MaxSections = 16>
bool pulp::signal::SosCascadeT< SampleType, MaxSections >::prepared ( ) const
inlinenoexcept

◆ process() [1/2]

template<typename SampleType = float, std::size_t MaxSections = 16>
void pulp::signal::SosCascadeT< SampleType, MaxSections >::process ( SampleType * buffer,
std::size_t num_samples )
inlinenoexcept

Process a buffer in place through BiquadT::process_chain().

The output matches the sample path to the Biquad block path's accuracy contract (see BiquadT::process_chain()): it is not bit-identical, but its error against an exact cascade is never more than 3 dB (RMS) above the sample path's.

◆ process() [2/2]

template<typename SampleType = float, std::size_t MaxSections = 16>
SampleType pulp::signal::SosCascadeT< SampleType, MaxSections >::process ( SampleType input)
inlinenoexcept

◆ process_stereo()

template<typename SampleType = float, std::size_t MaxSections = 16>
void pulp::signal::SosCascadeT< SampleType, MaxSections >::process_stereo ( SosCascadeT< SampleType, MaxSections > & left,
SosCascadeT< SampleType, MaxSections > & right,
SampleType * left_buffer,
SampleType * right_buffer,
std::size_t num_samples )
inlinestaticnoexcept

Process two channels in place, each through its own cascade, with the two channels in vector lanes (BiquadT::process_chain_stereo()).

Each channel's output is bit-identical to that cascade's block process(); the cascades may hold different coefficients. Cascades of different lengths are processed one after the other, and one cascade passed as both channels runs the left buffer and then the right through it.

◆ reset()

template<typename SampleType = float, std::size_t MaxSections = 16>
void pulp::signal::SosCascadeT< SampleType, MaxSections >::reset ( )
inlinenoexcept

◆ set_coefficients() [1/2]

template<typename SampleType = float, std::size_t MaxSections = 16>
template<typename CoefficientType, std::size_t Extent>
SosCascadeInstallStatus pulp::signal::SosCascadeT< SampleType, MaxSections >::set_coefficients ( std::span< BiquadCoefficientsT< CoefficientType >, Extent > coefficients,
SosCascadeTransition transition = SosCascadeTransition::reset_state )
inlinenoexcept

Install one complete SOS cascade.

An empty span is a valid bypass.

With preserve_state, sections that remain at the same ordinal keep their recursive tail; newly activated and removed sections are cleared. With reset_state, every section is cleared after the coefficients commit.

◆ set_coefficients() [2/2]

template<typename SampleType = float, std::size_t MaxSections = 16>
template<typename CoefficientType, std::size_t Extent>
SosCascadeInstallStatus pulp::signal::SosCascadeT< SampleType, MaxSections >::set_coefficients ( std::span< const BiquadCoefficientsT< CoefficientType >, Extent > coefficients,
SosCascadeTransition transition = SosCascadeTransition::reset_state )
inlinenoexcept

◆ size()

template<typename SampleType = float, std::size_t MaxSections = 16>
std::size_t pulp::signal::SosCascadeT< SampleType, MaxSections >::size ( ) const
inlinenoexcept

◆ storage_capacity()

template<typename SampleType = float, std::size_t MaxSections = 16>
constexpr std::size_t pulp::signal::SosCascadeT< SampleType, MaxSections >::storage_capacity ( )
inlinestaticconstexprnoexcept

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