Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels > Class Template Reference

Per-channel dry-signal delay used by an adapter's bypass path. More...

#include <adapter_boundary.hpp>

Public Member Functions

void prepare (int latency_samples)
 Size the per-channel delay to latency_samples (the processor's reported latency, i.e.
void reset ()
 Clear the delay history without resizing (e.g. on a transport reset).
bool is_latency_compensated () const noexcept
 True when a non-zero reported latency is being compensated.
int delay_samples () const noexcept
 The compensation delay in samples (0 when uncompensated).
float process_sample (float in, std::size_t ch)
 Push one dry sample through channel ch's delay and return the compensated output (in[n - delay] in steady state).
void process_channel (float *out, const float *in, std::uint32_t count, std::size_t ch)
 Emit in[n - delay] into out for channel ch (steady state), or a straight copy of in when uncompensated.

Static Public Member Functions

static constexpr std::size_t channel_capacity () noexcept
 Number of per-channel delay lines this instance owns.

Detailed Description

template<std::size_t MaxChannels = kBoundaryMaxChannels>
class pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >

Per-channel dry-signal delay used by an adapter's bypass path.

A latent processor is compensated by the host: the host delays every other track by the plugin's reported latency so the plugin path stays aligned. When the plugin is bypassed the adapter emits the dry input directly, but that input is now early relative to the host's compensation by exactly the reported latency — so a correct bypass delays the dry signal by the same amount. CLAP and VST3 both drive this class; AU/AAX/LV2 still memcpy the input straight through and are a latency samples early while bypassed.

prepare() (off the audio thread) sizes the lines. process_channel() is RT-safe. A reported latency of <= 0 means no compensation, and process_channel() degrades to a plain copy so callers use one code path.

Member Function Documentation

◆ channel_capacity()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
constexpr std::size_t pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::channel_capacity ( )
inlinestaticconstexprnoexcept

Number of per-channel delay lines this instance owns.

◆ delay_samples()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
int pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::delay_samples ( ) const
inlinenoexcept

The compensation delay in samples (0 when uncompensated).

◆ is_latency_compensated()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
bool pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::is_latency_compensated ( ) const
inlinenoexcept

True when a non-zero reported latency is being compensated.

◆ prepare()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
void pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::prepare ( int latency_samples)
inline

Size the per-channel delay to latency_samples (the processor's reported latency, i.e.

already run through reported_latency_samples() so the host-quirk clamp applies). Allocates; call off the audio thread at activate/setup. A value <= 0 disables compensation and frees nothing the hot path touches.

◆ process_channel()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
void pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::process_channel ( float * out,
const float * in,
std::uint32_t count,
std::size_t ch )
inline

Emit in[n - delay] into out for channel ch (steady state), or a straight copy of in when uncompensated.

A null in writes silence (a bypassed effect fed no dry signal on that channel). RT-safe: no allocation, no lock. out must be valid for count samples.

◆ process_sample()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
float pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::process_sample ( float in,
std::size_t ch )
inline

Push one dry sample through channel ch's delay and return the compensated output (in[n - delay] in steady state).

Returns in unchanged when uncompensated or ch is out of range, so a caller that already gated on is_latency_compensated() gets a 1:1 replacement for a raw DelayLine::process. RT-safe. Callers that mix compensated and uncompensated channels in one block (more channels than channel_capacity()) must gate on is_latency_compensated() themselves so every channel takes the same path.

◆ reset()

template<std::size_t MaxChannels = kBoundaryMaxChannels>
void pulp::format::boundary::LatencyCompensatedBypassT< MaxChannels >::reset ( )
inline

Clear the delay history without resizing (e.g. on a transport reset).


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