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

Configurable Fibonacci linear-feedback shift register with a weighted register-to-output projection. More...

#include <lfsr.hpp>

Public Member Functions

bool configure (int length, std::uint32_t feedback_mask, std::uint32_t seed) noexcept
bool set_length (int length) noexcept
bool set_feedback_mask (std::uint32_t mask) noexcept
void set_seed (std::uint32_t seed) noexcept
bool set_weight (std::size_t bit, SampleType weight) noexcept
void clear_weights () noexcept
bool set_offset (SampleType offset) noexcept
void reset () noexcept
std::uint32_t clock (bool external_bit=false) noexcept
SampleType weighted_output () const noexcept
SampleType minimum_output () const noexcept
SampleType maximum_output () const noexcept
int length () const noexcept
std::uint32_t feedback_mask () const noexcept
std::uint32_t seed () const noexcept
std::uint32_t state () const noexcept
SampleType offset () const noexcept

Static Public Member Functions

static constexpr int latency_samples () noexcept
static constexpr int tail_samples () noexcept

Static Public Attributes

static constexpr int kMinLength = 2
static constexpr int kMaxLength = 32
static constexpr int kDefaultLength = 8
static constexpr std::uint32_t kDefaultFeedbackMask = 0x8Eu
static constexpr std::uint32_t kDefaultSeed = 0b10110100u

Detailed Description

template<typename SampleType = float>
class pulp::signal::LfsrT< SampleType >

Configurable Fibonacci linear-feedback shift register with a weighted register-to-output projection.

The register shifts toward the most-significant bit. On each clock(), the new bit is the parity of state & feedback_mask, optionally XOR-ed with an external bit. Bit weights are expressed directly in caller-defined output units; weighted_output() is offset + sum(weight[i]) for every high bit. Its exact range is therefore reported by minimum_output() and maximum_output().

Length is 2..32 bits. A zero seed is intentionally legal and absorbing unless an external high bit is clocked; this preserves Rungler patch semantics. A maximal-period sequence requires a nonzero seed and a primitive-polynomial feedback mask chosen by the caller. The default mask 0x8e is audited by the direct full-period oracle as a primitive 8-bit configuration; arbitrary caller masks intentionally make no period claim.

RT contract: all methods are bounded scalar/array work with no allocation, locks, I/O, or hidden entropy. reset() restores the public seed exactly. Latency and tail are both zero samples.

Member Function Documentation

◆ clear_weights()

template<typename SampleType = float>
void pulp::signal::LfsrT< SampleType >::clear_weights ( )
inlinenoexcept

◆ clock()

template<typename SampleType = float>
std::uint32_t pulp::signal::LfsrT< SampleType >::clock ( bool external_bit = false)
inlinenoexcept

◆ configure()

template<typename SampleType = float>
bool pulp::signal::LfsrT< SampleType >::configure ( int length,
std::uint32_t feedback_mask,
std::uint32_t seed )
inlinenoexcept

◆ feedback_mask()

template<typename SampleType = float>
std::uint32_t pulp::signal::LfsrT< SampleType >::feedback_mask ( ) const
inlinenoexcept

◆ latency_samples()

template<typename SampleType = float>
constexpr int pulp::signal::LfsrT< SampleType >::latency_samples ( )
inlinestaticconstexprnoexcept

◆ length()

template<typename SampleType = float>
int pulp::signal::LfsrT< SampleType >::length ( ) const
inlinenoexcept

◆ maximum_output()

template<typename SampleType = float>
SampleType pulp::signal::LfsrT< SampleType >::maximum_output ( ) const
inlinenoexcept

◆ minimum_output()

template<typename SampleType = float>
SampleType pulp::signal::LfsrT< SampleType >::minimum_output ( ) const
inlinenoexcept

◆ offset()

template<typename SampleType = float>
SampleType pulp::signal::LfsrT< SampleType >::offset ( ) const
inlinenoexcept

◆ reset()

template<typename SampleType = float>
void pulp::signal::LfsrT< SampleType >::reset ( )
inlinenoexcept

◆ seed()

template<typename SampleType = float>
std::uint32_t pulp::signal::LfsrT< SampleType >::seed ( ) const
inlinenoexcept

◆ set_feedback_mask()

template<typename SampleType = float>
bool pulp::signal::LfsrT< SampleType >::set_feedback_mask ( std::uint32_t mask)
inlinenoexcept

◆ set_length()

template<typename SampleType = float>
bool pulp::signal::LfsrT< SampleType >::set_length ( int length)
inlinenoexcept

◆ set_offset()

template<typename SampleType = float>
bool pulp::signal::LfsrT< SampleType >::set_offset ( SampleType offset)
inlinenoexcept

◆ set_seed()

template<typename SampleType = float>
void pulp::signal::LfsrT< SampleType >::set_seed ( std::uint32_t seed)
inlinenoexcept

◆ set_weight()

template<typename SampleType = float>
bool pulp::signal::LfsrT< SampleType >::set_weight ( std::size_t bit,
SampleType weight )
inlinenoexcept

◆ state()

template<typename SampleType = float>
std::uint32_t pulp::signal::LfsrT< SampleType >::state ( ) const
inlinenoexcept

◆ tail_samples()

template<typename SampleType = float>
constexpr int pulp::signal::LfsrT< SampleType >::tail_samples ( )
inlinestaticconstexprnoexcept

◆ weighted_output()

template<typename SampleType = float>
SampleType pulp::signal::LfsrT< SampleType >::weighted_output ( ) const
inlinenoexcept

Member Data Documentation

◆ kDefaultFeedbackMask

template<typename SampleType = float>
std::uint32_t pulp::signal::LfsrT< SampleType >::kDefaultFeedbackMask = 0x8Eu
staticconstexpr

◆ kDefaultLength

template<typename SampleType = float>
int pulp::signal::LfsrT< SampleType >::kDefaultLength = 8
staticconstexpr

◆ kDefaultSeed

template<typename SampleType = float>
std::uint32_t pulp::signal::LfsrT< SampleType >::kDefaultSeed = 0b10110100u
staticconstexpr

◆ kMaxLength

template<typename SampleType = float>
int pulp::signal::LfsrT< SampleType >::kMaxLength = 32
staticconstexpr

◆ kMinLength

template<typename SampleType = float>
int pulp::signal::LfsrT< SampleType >::kMinLength = 2
staticconstexpr

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