3#include <pulp/signal/detail/modular_sequencing_common.hpp>
32template <
typename SampleType =
float>
49 if (std::isfinite(sample_rate) && sample_rate > 0.0) sample_rate_ = sample_rate;
67 run_.set_thresholds(high, low);
68 reset_.set_thresholds(high, low);
69 clock_.set_thresholds(high, low);
82 Frame
process(SampleType run, SampleType reset_in, SampleType clock) {
85 f.run_high = run_.high();
87 const bool raw_reset = reset_.process(reset_in);
88 if (refractory_ > 0) --refractory_;
89 if (raw_reset && refractory_ == 0) {
91 refractory_ = refractory_samples_;
94 f.clock_edge = clock_.process(clock);
100 Frame
process(SampleType run, SampleType reset_in) {
101 return process(run, reset_in, SampleType{0});
106 refractory_samples_ =
static_cast<std::int64_t
>(
108 if (refractory_samples_ < 0) refractory_samples_ = 0;
111 double sample_rate_ = 44100.0;
113 std::int64_t refractory_samples_ = 0;
114 std::int64_t refractory_ = 0;
115 HystereticTriggerDetectT<SampleType> run_{};
116 HystereticTriggerDetectT<SampleType> reset_{};
117 HystereticTriggerDetectT<SampleType> clock_{};
Converts a run level and a reset level into the (run_high, reset_edge) pair the sequencers consume,...
Definition transport_edge.hpp:33
Frame process(SampleType run, SampleType reset_in, SampleType clock)
Decodes run, reset and clock levels for one sample.
Definition transport_edge.hpp:82
Frame process(SampleType run, SampleType reset_in)
Run and reset only, for a caller whose clock edge already arrives as a boolean (a ClockDividerT outpu...
Definition transport_edge.hpp:100
static constexpr int latency_samples()
Definition transport_edge.hpp:79
static constexpr double kRefractoryMs
Definition transport_edge.hpp:39
static constexpr double kMaxRefractoryMs
Definition transport_edge.hpp:57
void set_refractory_ms(double ms)
Definition transport_edge.hpp:59
void prepare(double sample_rate)
Definition transport_edge.hpp:48
void reset()
Definition transport_edge.hpp:72
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...
Definition transport_edge.hpp:66
T ms_to_samples(T ms, T sample_rate)
Milliseconds → samples at sample_rate Hz.
Definition units.hpp:147
Definition additive_bank.hpp:218
TransportEdgeT< double > TransportEdge64
Definition transport_edge.hpp:121
TransportEdgeT< float > TransportEdge
Definition transport_edge.hpp:120
One sample of transport, decoded.
Definition transport_edge.hpp:42
bool clock_edge
Definition transport_edge.hpp:45
bool run_high
Definition transport_edge.hpp:43
bool reset_edge
Definition transport_edge.hpp:44
The real-unit vocabulary shared by every DSP block in the catalog.