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

Converts a run level and a reset level into the (run_high, reset_edge) pair the sequencers consume, and optionally detects the clock edge alongside them. More...

#include <transport_edge.hpp>

Classes

struct  Frame
 One sample of transport, decoded. More...

Public Member Functions

void prepare (double sample_rate)
void set_refractory_ms (double ms)
void set_thresholds (double high, double low)
 Sets the hysteresis window used for all three inputs, so a patch running at ±5 V and one running at 0/1 configure in one call.
void reset ()
Frame process (SampleType run, SampleType reset_in, SampleType clock)
 Decodes run, reset and clock levels for one sample.
Frame process (SampleType run, SampleType reset_in)
 Run and reset only, for a caller whose clock edge already arrives as a boolean (a ClockDividerT output, say).

Static Public Member Functions

static constexpr int latency_samples ()

Static Public Attributes

static constexpr double kRefractoryMs = 0.5
 Debounce window after a reset edge, during which further reset edges are suppressed.
static constexpr double kMaxRefractoryMs = 1000.0
 Upper bound on the refractory window.

Detailed Description

template<typename SampleType = float>
class pulp::signal::TransportEdgeT< SampleType >

Converts a run level and a reset level into the (run_high, reset_edge) pair the sequencers consume, and optionally detects the clock edge alongside them.

It exists so that "what is a reset edge" has exactly one answer in the library. It carries no musical state at all: hand it the same three signals and it produces the same three booleans regardless of which sequencer is downstream.

The reset input gets a refractory window on top of the kit's hysteresis. Hysteresis alone already rejects a clock hovering at the threshold, but a reset jack is often driven by a physical switch or a long cable, where the signal genuinely crosses the window several times in a millisecond. A refractory window is the debounce for that, and it lives here rather than in TriggerDetectT because a clock must never be debounced — a debounced clock silently drops fast subdivisions.

RT contract: as the header. No allocation, no locks.

Member Function Documentation

◆ latency_samples()

template<typename SampleType = float>
constexpr int pulp::signal::TransportEdgeT< SampleType >::latency_samples ( )
inlinestaticconstexpr

◆ prepare()

template<typename SampleType = float>
void pulp::signal::TransportEdgeT< SampleType >::prepare ( double sample_rate)
inline

◆ process() [1/2]

template<typename SampleType = float>
Frame pulp::signal::TransportEdgeT< SampleType >::process ( SampleType run,
SampleType reset_in )
inline

Run and reset only, for a caller whose clock edge already arrives as a boolean (a ClockDividerT output, say).

◆ process() [2/2]

template<typename SampleType = float>
Frame pulp::signal::TransportEdgeT< SampleType >::process ( SampleType run,
SampleType reset_in,
SampleType clock )
inline

Decodes run, reset and clock levels for one sample.

◆ reset()

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

◆ set_refractory_ms()

template<typename SampleType = float>
void pulp::signal::TransportEdgeT< SampleType >::set_refractory_ms ( double ms)
inline

◆ set_thresholds()

template<typename SampleType = float>
void pulp::signal::TransportEdgeT< SampleType >::set_thresholds ( double high,
double low )
inline

Sets the hysteresis window used for all three inputs, so a patch running at ±5 V and one running at 0/1 configure in one call.

Member Data Documentation

◆ kMaxRefractoryMs

template<typename SampleType = float>
double pulp::signal::TransportEdgeT< SampleType >::kMaxRefractoryMs = 1000.0
staticconstexpr

Upper bound on the refractory window.

Two orders of magnitude past the documented range, purely so the sample-count conversion below cannot overflow on a nonsense value from a host. [design parameter] default 1000 ms ceiling, range 10 .. 60000 ms.

◆ kRefractoryMs

template<typename SampleType = float>
double pulp::signal::TransportEdgeT< SampleType >::kRefractoryMs = 0.5
staticconstexpr

Debounce window after a reset edge, during which further reset edges are suppressed.

Purely mechanical — long enough to swallow switch bounce, far shorter than any musical reset interval. [design parameter] default 0.5 ms, range 0.1 .. 5 ms.


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