Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
transition_mixer.hpp File Reference

Shared click-free crossfade primitive. More...

#include "crossfade.hpp"
#include <algorithm>
#include <cmath>
#include <cstddef>

Go to the source code of this file.

Classes

class  pulp::signal::TransitionMixerT< SampleType >

Namespaces

namespace  pulp
namespace  pulp::signal

Typedefs

using pulp::signal::TransitionMixer = TransitionMixerT<float>
using pulp::signal::TransitionMixer64 = TransitionMixerT<double>

Enumerations

enum class  pulp::signal::TransitionCurve { pulp::signal::Smoothstep , pulp::signal::EqualPower }

Functions

template<class Mixer, class OutView, class OldView>
bool pulp::signal::blend_fade_out (Mixer &mixer, OutView &out, const OldView &old_render) noexcept
 Blend an already-rendered fading-out buffer into the live output under a TransitionMixer's old->new gains, then advance the mixer by the block.

Detailed Description

Shared click-free crossfade primitive.

The one place the live-swap machinery computes old→new blend gains, so the DSP hot-swap slot, the convolver IR swapper, and the Phase-2 SwapUnit transitions all fade identically and are tested by one fixture. Pure math + a sample position; no allocation, no locks — safe to advance on the audio thread.

Both laws are evaluated over a smoothstep ramp (zero slope at both ends), so both are click-free at the swap instant AND the fade end; they differ only in the mid-fade sum:

  • Smoothstep — equal-GAIN (old + new == 1). No power bump for correlated old/new (the usual hot-reload: same input, a small DSP tweak). Default.
  • EqualPower — constant POWER (old² + new² == 1), cos/sin. Avoids the mid-fade level dip when old/new are decorrelated (a big DSP change). Mirrors DryWetMixer's EqualPower law.

The smoothstep shaping and the two gain laws live in the shared crossfade.hpp — the one place the SIGNAL side computes old→new gains — so a TransitionMixer fade, a LoopRenderer wrap, and the live-kernel swap all blend by the identical math.