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

#include <realtime_pitch_time_processor.hpp>

Public Member Functions

 RealtimePitchTimeProcessorT ()=default
PitchTimePrepareStatus prepare (double sample_rate, const RealtimePitchTimeConfig &config, std::uint64_t target_max_bytes=kTargetAddressMaximumBytes)
 RT contract: prepare() allocates and sizes all spectral, smoothing, ring, drain, noise-morphing, and optional sinc-resampling storage; it is not audio-thread safe.
int latency_samples () const
 Fixed pipeline delay of process() in realtime_pitch mode.
int fft_size () const
void set_pitch_semitones (float semitones)
void set_formant_semitones (float semitones)
void set_formant_mode (FormantMode mode)
void set_frozen (bool frozen)
 Freeze (infinite hold) of the current input moment.
bool is_frozen () const
void set_time_ratio (float ratio)
 time_stretch mode only; > 1 lengthens. Takes effect at the next frame.
double achieved_time_ratio () const
 Hop-quantized stretch actually applied so far (time_stretch mode).
void process (const SampleType *const *in, SampleType *const *out, int num_samples)
 realtime_pitch mode: consume and produce exactly num_samples.
PitchTimeStreamFeedStatus feed (const SampleType *const *in, int num_samples)
 time_stretch mode: atomically push one bounded input block.
int available_stretched () const
 time_stretch mode: stretched samples ready to read.
int output_free_space () const
 Remaining prepared output-ring capacity.
int input_priming_samples () const
 Input required before the first final stretched sample can become readable.
int output_alignment_samples () const
int maximum_stream_output_lag_samples () const noexcept
 Admission-time causal stream delay bound in output samples for every ratio accepted by set_time_ratio().
int samples_until_next_analysis_frame () const noexcept
 Samples remaining before the next analysis frame completes.
PitchTimeStreamFinalizeStatus finalize ()
 Seal the finite input stream and advance at most one prepared input block of zero padding.
PitchTimeStreamFinalizePlan plan_finalize (int max_samples) const noexcept
 Allocation-free, non-mutating preflight for bounded finalization.
PitchTimeStreamFinalizeStatus finalize (int max_samples)
 Bounded finalization variant.
int read_stretched (SampleType *const *out, int num_samples)
 time_stretch mode: pop stretched samples (caller respects available_stretched(); excess is zero-filled without advancing).
void reset ()

Constructor & Destructor Documentation

◆ RealtimePitchTimeProcessorT()

template<typename SampleType = float>
pulp::signal::RealtimePitchTimeProcessorT< SampleType >::RealtimePitchTimeProcessorT ( )
default

Member Function Documentation

◆ achieved_time_ratio()

template<typename SampleType = float>
double pulp::signal::RealtimePitchTimeProcessorT< SampleType >::achieved_time_ratio ( ) const
inline

Hop-quantized stretch actually applied so far (time_stretch mode).

◆ available_stretched()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::available_stretched ( ) const
inline

time_stretch mode: stretched samples ready to read.

◆ feed()

template<typename SampleType = float>
PitchTimeStreamFeedStatus pulp::signal::RealtimePitchTimeProcessorT< SampleType >::feed ( const SampleType *const * in,
int num_samples )
inline

time_stretch mode: atomically push one bounded input block.

The call accepts all samples or none; a backpressure result leaves every stream counter and DSP state unchanged. Drain output and retry the same block.

◆ fft_size()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::fft_size ( ) const
inline

◆ finalize() [1/2]

template<typename SampleType = float>
PitchTimeStreamFinalizeStatus pulp::signal::RealtimePitchTimeProcessorT< SampleType >::finalize ( )
inline

Seal the finite input stream and advance at most one prepared input block of zero padding.

Repeat after draining output until complete. The final output count is derived from the same frame map used by the realtime reader, so constant and varying feed schedules produce the same hop-quantized duration. No caller-authored silence is required.

◆ finalize() [2/2]

template<typename SampleType = float>
PitchTimeStreamFinalizeStatus pulp::signal::RealtimePitchTimeProcessorT< SampleType >::finalize ( int max_samples)
inline

Bounded finalization variant.

Advances no more than max_samples of prepared zero padding, so a driver can stop exactly at the next analysis boundary and update per-frame controls before continuing.

◆ input_priming_samples()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::input_priming_samples ( ) const
inline

Input required before the first final stretched sample can become readable.

The pull stream itself has no silence prefix: output sample zero is aligned to input sample zero.

◆ is_frozen()

template<typename SampleType = float>
bool pulp::signal::RealtimePitchTimeProcessorT< SampleType >::is_frozen ( ) const
inline

◆ latency_samples()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::latency_samples ( ) const
inline

Fixed pipeline delay of process() in realtime_pitch mode.

◆ maximum_stream_output_lag_samples()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::maximum_stream_output_lag_samples ( ) const
inlinenoexcept

Admission-time causal stream delay bound in output samples for every ratio accepted by set_time_ratio().

A fixed-latency driver may stage by this amount without deriving DSP geometry itself.

◆ output_alignment_samples()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::output_alignment_samples ( ) const
inline

◆ output_free_space()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::output_free_space ( ) const
inline

Remaining prepared output-ring capacity.

A producer can drain output and retry after feed()/finalize() reports backpressure.

◆ plan_finalize()

template<typename SampleType = float>
PitchTimeStreamFinalizePlan pulp::signal::RealtimePitchTimeProcessorT< SampleType >::plan_finalize ( int max_samples) const
inlinenoexcept

Allocation-free, non-mutating preflight for bounded finalization.

A ready plan is guaranteed admissible until another stream operation mutates the processor. Drivers can therefore resolve a boundary control exactly once only after rejected/terminal work has been ruled out.

◆ prepare()

template<typename SampleType = float>
PitchTimePrepareStatus pulp::signal::RealtimePitchTimeProcessorT< SampleType >::prepare ( double sample_rate,
const RealtimePitchTimeConfig & config,
std::uint64_t target_max_bytes = kTargetAddressMaximumBytes )
inline

RT contract: prepare() allocates and sizes all spectral, smoothing, ring, drain, noise-morphing, and optional sinc-resampling storage; it is not audio-thread safe.

After prepare(), process(), feed(), read_stretched(), reset(), control setters, and accessors are allocation-free for blocks no larger than config.max_block and the prepared channel count. target_max_bytes defaults to the native address limit and may be lowered to validate a narrower deployment target.

◆ process()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::process ( const SampleType *const * in,
SampleType *const * out,
int num_samples )
inline

realtime_pitch mode: consume and produce exactly num_samples.

◆ read_stretched()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::read_stretched ( SampleType *const * out,
int num_samples )
inline

time_stretch mode: pop stretched samples (caller respects available_stretched(); excess is zero-filled without advancing).

Returns the number of real stream samples copied.

◆ reset()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::reset ( )
inline

◆ samples_until_next_analysis_frame()

template<typename SampleType = float>
int pulp::signal::RealtimePitchTimeProcessorT< SampleType >::samples_until_next_analysis_frame ( ) const
inlinenoexcept

Samples remaining before the next analysis frame completes.

This is exposed for finite-stream drivers that must apply control changes at analysis boundaries independently of their own feed quantum. Returns zero outside prepared time_stretch mode.

◆ set_formant_mode()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::set_formant_mode ( FormantMode mode)
inline

◆ set_formant_semitones()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::set_formant_semitones ( float semitones)
inline

◆ set_frozen()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::set_frozen ( bool frozen)
inline

Freeze (infinite hold) of the current input moment.

Held audio remains pitch/formant-controllable: the hold replaces analysis frames at the head of the chain, upstream of phase propagation.

◆ set_pitch_semitones()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::set_pitch_semitones ( float semitones)
inline

◆ set_time_ratio()

template<typename SampleType = float>
void pulp::signal::RealtimePitchTimeProcessorT< SampleType >::set_time_ratio ( float ratio)
inline

time_stretch mode only; > 1 lengthens. Takes effect at the next frame.


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