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

#include <sinc_resampler.hpp>

Public Member Functions

void build (int half_width=16, int phases=512, double beta=9.0, double cutoff=1.0)
 Build the kernel.
void begin_build (int half_width=16, int phases=512, double beta=9.0, double cutoff=1.0)
 Starts a resumable kernel-table build.
bool build_step ()
int half_width () const
int taps () const
bool ready () const
double cutoff () const
std::size_t prepared_bytes () const noexcept
SampleType apply (const SampleType *samples, double frac) const
 Apply the kernel at fractional phase frac (in [0,1)) to exactly taps() contiguous samples, ordered from (i0-half+1) to (i0+half) where the read point is at i0+frac.
SampleType read (const SampleType *src, int len, double pos) const
 Read src at fractional position pos (in samples).

Static Public Member Functions

static bool checked_retained_bytes (int half_width, int phases, std::uint64_t target_max_bytes, std::uint64_t &bytes) noexcept

Member Function Documentation

◆ apply()

template<typename SampleType = float>
SampleType pulp::signal::SincResamplerT< SampleType >::apply ( const SampleType * samples,
double frac ) const
inline

Apply the kernel at fractional phase frac (in [0,1)) to exactly taps() contiguous samples, ordered from (i0-half+1) to (i0+half) where the read point is at i0+frac.

Lets a caller with its own buffer layout (e.g. a power-of-two ring) gather the neighbourhood itself and reuse the kernel. RT-safe.

◆ begin_build()

template<typename SampleType = float>
void pulp::signal::SincResamplerT< SampleType >::begin_build ( int half_width = 16,
int phases = 512,
double beta = 9.0,
double cutoff = 1.0 )
inline

Starts a resumable kernel-table build.

Each build_step() computes one phase row so control-thread callers can honor an external work budget.

◆ build()

template<typename SampleType = float>
void pulp::signal::SincResamplerT< SampleType >::build ( int half_width = 16,
int phases = 512,
double beta = 9.0,
double cutoff = 1.0 )
inline

Build the kernel.

half_width taps each side (quality vs cost; 16 is a good default), phases sub-sample resolution (table rows; 512 is transparent with linear phase interpolation), beta the Kaiser shape (≈ 8–10 for deep stopband; higher = more rejection, wider transition), and cutoff the normalized source-Nyquist cutoff in (0, 1]. Values outside that interval are clamped.

◆ build_step()

template<typename SampleType = float>
bool pulp::signal::SincResamplerT< SampleType >::build_step ( )
inline

◆ checked_retained_bytes()

template<typename SampleType = float>
bool pulp::signal::SincResamplerT< SampleType >::checked_retained_bytes ( int half_width,
int phases,
std::uint64_t target_max_bytes,
std::uint64_t & bytes )
inlinestaticnoexcept

◆ cutoff()

template<typename SampleType = float>
double pulp::signal::SincResamplerT< SampleType >::cutoff ( ) const
inline

◆ half_width()

template<typename SampleType = float>
int pulp::signal::SincResamplerT< SampleType >::half_width ( ) const
inline

◆ prepared_bytes()

template<typename SampleType = float>
std::size_t pulp::signal::SincResamplerT< SampleType >::prepared_bytes ( ) const
inlinenoexcept

◆ read()

template<typename SampleType = float>
SampleType pulp::signal::SincResamplerT< SampleType >::read ( const SampleType * src,
int len,
double pos ) const
inline

Read src at fractional position pos (in samples).

The caller guarantees the kernel support [floor(pos)-half+1, floor(pos)+half] lies within [0, len); out-of-range taps are clamped to the edge so boundary reads degrade gracefully rather than read out of bounds.

◆ ready()

template<typename SampleType = float>
bool pulp::signal::SincResamplerT< SampleType >::ready ( ) const
inline

◆ taps()

template<typename SampleType = float>
int pulp::signal::SincResamplerT< SampleType >::taps ( ) const
inline

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