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

#include <spectral_mask_processor.hpp>

Public Types

using Config = SpectralMaskProcessorConfigT<SampleType>
using Layout = SpectralBandLayoutT<SampleType>
using Table = SpectralMaskTableT<SampleType>
using PreMaskStage = SpectralPreMaskStageT<SampleType>
using WetSourceStage = SpectralWetSourceStageT<SampleType>
using EffectiveFrameObserver = void (*)(void*, const Table&, std::uint64_t) noexcept

Public Member Functions

bool set_effective_frame_observer (void *context, EffectiveFrameObserver observer) noexcept
 Install/remove only while the processing owner is stopped.
bool prepare (const Config &config)
 Prepare a complete replacement state.
bool publish_layout (const Layout &layout)
 Compile and publish one layout from the prepared geometry.
bool publish_table (const Table &table)
 Publish a complete immutable table through the shared latest-value three-slot handoff.
bool set_layout_rt (const Layout &layout) noexcept
 Stage a layout from the single audio owner.
bool process (const SampleType *const *input, SampleType *const *output, int num_samples) noexcept
 Process one prepared planar block.
bool process_frame (std::complex< SampleType > *const *frames, int num_bins) noexcept
 Apply the current publication/transition state to one coherent complex frame group.
void set_pre_mask_stage (PreMaskStage *stage) noexcept
 Install (or clear, with nullptr) the non-owning pre-mask frame stage.
PreMaskStage * pre_mask_stage () const noexcept
void set_wet_source_stage (WetSourceStage *stage) noexcept
 Install (or clear, with nullptr) the non-owning time-domain wet-source stage.
WetSourceStage * wet_source_stage () const noexcept
void set_mix (SampleType mix) noexcept
 Audio-thread-safe dry/wet controls. Mix defaults to fully wet.
void set_mix_ramp_samples (int samples) noexcept
void set_mix_curve (MixCurve curve) noexcept
void reset () noexcept
 Clear analysis/synthesis, dry-delay, and in-flight interpolation state while preserving the latest adopted mask as the new settled curve.
bool prepared () const noexcept
int latency_samples () const noexcept
int maximum_tail_samples () const noexcept
 Conservative flush bound for the fixed-latency WOLA response.
int num_bins () const noexcept
int channels () const noexcept
std::uint64_t retained_bytes () const noexcept
std::uint64_t active_table_version () const noexcept
bool table_publication_pending () const noexcept

Member Typedef Documentation

◆ Config

template<typename SampleType = float>
using pulp::signal::SpectralMaskProcessorT< SampleType >::Config = SpectralMaskProcessorConfigT<SampleType>

◆ EffectiveFrameObserver

template<typename SampleType = float>
using pulp::signal::SpectralMaskProcessorT< SampleType >::EffectiveFrameObserver = void (*)(void*, const Table&, std::uint64_t) noexcept

◆ Layout

template<typename SampleType = float>
using pulp::signal::SpectralMaskProcessorT< SampleType >::Layout = SpectralBandLayoutT<SampleType>

◆ PreMaskStage

template<typename SampleType = float>
using pulp::signal::SpectralMaskProcessorT< SampleType >::PreMaskStage = SpectralPreMaskStageT<SampleType>

◆ Table

template<typename SampleType = float>
using pulp::signal::SpectralMaskProcessorT< SampleType >::Table = SpectralMaskTableT<SampleType>

◆ WetSourceStage

template<typename SampleType = float>
using pulp::signal::SpectralMaskProcessorT< SampleType >::WetSourceStage = SpectralWetSourceStageT<SampleType>

Member Function Documentation

◆ active_table_version()

template<typename SampleType = float>
std::uint64_t pulp::signal::SpectralMaskProcessorT< SampleType >::active_table_version ( ) const
inlinenodiscardnoexcept

◆ channels()

template<typename SampleType = float>
int pulp::signal::SpectralMaskProcessorT< SampleType >::channels ( ) const
inlinenodiscardnoexcept

◆ latency_samples()

template<typename SampleType = float>
int pulp::signal::SpectralMaskProcessorT< SampleType >::latency_samples ( ) const
inlinenodiscardnoexcept

◆ maximum_tail_samples()

template<typename SampleType = float>
int pulp::signal::SpectralMaskProcessorT< SampleType >::maximum_tail_samples ( ) const
inlinenodiscardnoexcept

Conservative flush bound for the fixed-latency WOLA response.

◆ num_bins()

template<typename SampleType = float>
int pulp::signal::SpectralMaskProcessorT< SampleType >::num_bins ( ) const
inlinenodiscardnoexcept

◆ pre_mask_stage()

template<typename SampleType = float>
PreMaskStage * pulp::signal::SpectralMaskProcessorT< SampleType >::pre_mask_stage ( ) const
inlinenodiscardnoexcept

◆ prepare()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::prepare ( const Config & config)
inlinenodiscard

Prepare a complete replacement state.

Failure leaves the prior prepared state intact. This control-thread operation allocates the STFT and dry delay storage; all later audio methods stay within those capacities.

◆ prepared()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::prepared ( ) const
inlinenodiscardnoexcept

◆ process()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::process ( const SampleType *const * input,
SampleType *const * output,
int num_samples )
inlinenodiscardnoexcept

Process one prepared planar block.

The dry path is delayed by the exact WOLA latency before mixing, so any mix below 100% cannot leak an early unfiltered signal around an isolation mask.

◆ process_frame()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::process_frame ( std::complex< SampleType > *const * frames,
int num_bins )
inlinenodiscardnoexcept

Apply the current publication/transition state to one coherent complex frame group.

This narrow source-independent seam is also usable by a prepared hold, freeze, delay, or resynthesis owner; it must still be called by exactly one audio-side consumer in chronological frame order.

◆ publish_layout()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::publish_layout ( const Layout & layout)
inlinenodiscard

Compile and publish one layout from the prepared geometry.

Compilation and publication are failure-atomic control-thread operations.

◆ publish_table()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::publish_table ( const Table & table)
inlinenodiscard

Publish a complete immutable table through the shared latest-value three-slot handoff.

One control-side writer and one audio-side reader may operate concurrently.

◆ reset()

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

Clear analysis/synthesis, dry-delay, and in-flight interpolation state while preserving the latest adopted mask as the new settled curve.

◆ retained_bytes()

template<typename SampleType = float>
std::uint64_t pulp::signal::SpectralMaskProcessorT< SampleType >::retained_bytes ( ) const
inlinenodiscardnoexcept

◆ set_effective_frame_observer()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::set_effective_frame_observer ( void * context,
EffectiveFrameObserver observer )
inlinenodiscardnoexcept

Install/remove only while the processing owner is stopped.

The observer runs once per successfully processed coherent channel-group frame, after adoption/interpolation and mask application. Its Table reference is borrowed only for that call: copy into bounded prepared storage before returning. It must not allocate, wait, throw, or reenter this processor. The ordinal counts successful frames since prepare/reset, not samples or host callbacks. The caller supplies stream identity and sample chronology. Successful prepare removes the observer; reset preserves it and restarts the ordinal. Failed prepare preserves the entire previous prepared state.

◆ set_layout_rt()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::set_layout_rt ( const Layout & layout)
inlinenodiscardnoexcept

Stage a layout from the single audio owner.

The layout is copied into prepared fixed-capacity storage and compiled at the next spectral-frame boundary. This path is deliberately separate from publish_layout(): it never joins the control-side TripleBuffer writer contract and therefore cannot race a UI/state-restore publication.

◆ set_mix()

template<typename SampleType = float>
void pulp::signal::SpectralMaskProcessorT< SampleType >::set_mix ( SampleType mix)
inlinenoexcept

Audio-thread-safe dry/wet controls. Mix defaults to fully wet.

◆ set_mix_curve()

template<typename SampleType = float>
void pulp::signal::SpectralMaskProcessorT< SampleType >::set_mix_curve ( MixCurve curve)
inlinenoexcept

◆ set_mix_ramp_samples()

template<typename SampleType = float>
void pulp::signal::SpectralMaskProcessorT< SampleType >::set_mix_ramp_samples ( int samples)
inlinenoexcept

◆ set_pre_mask_stage()

template<typename SampleType = float>
void pulp::signal::SpectralMaskProcessorT< SampleType >::set_pre_mask_stage ( PreMaskStage * stage)
inlinenoexcept

Install (or clear, with nullptr) the non-owning pre-mask frame stage.

Call from the thread that runs process(), or while it is not running; the stage must outlive its installation. The stage survives prepare() and reset(), and is not applied by process_frame(), whose caller already supplies the frames it wants masked. The dry path is never routed through it.

◆ set_wet_source_stage()

template<typename SampleType = float>
void pulp::signal::SpectralMaskProcessorT< SampleType >::set_wet_source_stage ( WetSourceStage * stage)
inlinenoexcept

Install (or clear, with nullptr) the non-owning time-domain wet-source stage.

Same threading, lifetime, and prepare()/reset() rules as set_pre_mask_stage(). The dry path always carries the live input.

◆ table_publication_pending()

template<typename SampleType = float>
bool pulp::signal::SpectralMaskProcessorT< SampleType >::table_publication_pending ( ) const
inlinenodiscardnoexcept

◆ wet_source_stage()

template<typename SampleType = float>
WetSourceStage * pulp::signal::SpectralMaskProcessorT< SampleType >::wet_source_stage ( ) const
inlinenodiscardnoexcept

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