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

Rising-edge detector with a refractory period. More...

#include <trigger.hpp>

Public Member Functions

void prepare (double sample_rate)
void set_refractory_ms (double ms)
void set_threshold (SampleType t)
 Threshold for the refractory process_signal() lane.
void reset ()
bool process (bool gate)
template<typename Value>
requires (!std::same_as<std::remove_cvref_t<Value>, bool>)
bool process (Value)=delete
 Prevent continuous values from silently selecting the decoded-event lane through implicit conversion to bool.
bool process_signal (SampleType input)
 Established single-threshold signal lane.
void process_signal (SampleType input, bool &rising, bool &falling)
bool armed () const

Static Public Attributes

static constexpr double kDefaultRefractoryMs = 1.0
 Long enough to swallow contact bounce and the ragged edge of a thresholded transient, short enough that a 1000 BPM 64th-note stream still passes.

Detailed Description

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

Rising-edge detector with a refractory period.

After it fires, further edges are ignored for refractory_ms. Real gate CV and real thresholded audio both chatter at the transition; without the refractory window a single musical event fires two or three triggers, and everything downstream doubles.

RT contract: prepare() and setters are control-side; process(), process_signal(), and reset() allocate nothing.

USE: extracting note-ons from gate CV; clocking a SampleHoldT; resetting an LFO on a beat; converting an envelope follower or a TransientDetectorT output into discrete hits.

Member Function Documentation

◆ armed()

template<typename SampleType = float>
bool pulp::signal::TriggerDetectT< SampleType >::armed ( ) const
inline

◆ prepare()

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

◆ process() [1/2]

template<typename SampleType = float>
bool pulp::signal::TriggerDetectT< SampleType >::process ( bool gate)
inline
Returns
true on the sample an accepted rising edge occurs.

◆ process() [2/2]

template<typename SampleType = float>
template<typename Value>
requires (!std::same_as<std::remove_cvref_t<Value>, bool>)
bool pulp::signal::TriggerDetectT< SampleType >::process ( Value )
delete

Prevent continuous values from silently selecting the decoded-event lane through implicit conversion to bool.

Use process_signal() for a refractory threshold or HystereticTriggerDetectT for Schmitt CV.

◆ process_signal() [1/2]

template<typename SampleType = float>
bool pulp::signal::TriggerDetectT< SampleType >::process_signal ( SampleType input)
inline

Established single-threshold signal lane.

It first decodes the signal with strict x > threshold, then applies the same refractory policy as an already-decoded boolean event.

◆ process_signal() [2/2]

template<typename SampleType = float>
void pulp::signal::TriggerDetectT< SampleType >::process_signal ( SampleType input,
bool & rising,
bool & falling )
inline

◆ reset()

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

◆ set_refractory_ms()

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

◆ set_threshold()

template<typename SampleType = float>
void pulp::signal::TriggerDetectT< SampleType >::set_threshold ( SampleType t)
inline

Threshold for the refractory process_signal() lane.

Ignored by the decoded-event and hysteretic-CV lanes.

Member Data Documentation

◆ kDefaultRefractoryMs

template<typename SampleType = float>
double pulp::signal::TriggerDetectT< SampleType >::kDefaultRefractoryMs = 1.0
staticconstexpr

Long enough to swallow contact bounce and the ragged edge of a thresholded transient, short enough that a 1000 BPM 64th-note stream still passes.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/signal/include/pulp/signal/trigger.hpp