Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
unit_delay.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <type_traits>
4
5namespace pulp::signal {
6
12template <typename SampleType = float> class UnitDelayT {
13 static_assert(std::is_floating_point_v<SampleType>,
14 "UnitDelayT requires a floating-point sample type");
15
16 public:
17 [[nodiscard]] SampleType publish() const noexcept {
18 return state_;
19 }
20
21 void commit(SampleType input) noexcept {
22 state_ = input;
23 }
24
25 [[nodiscard]] SampleType process(SampleType input) noexcept {
26 const SampleType output = publish();
27 commit(input);
28 return output;
29 }
30
31 void reset() noexcept {
32 state_ = SampleType{};
33 }
34
35 private:
36 SampleType state_{};
37};
38
41
42static_assert(sizeof(UnitDelay) == sizeof(float));
43static_assert(alignof(UnitDelay) == alignof(float));
44
45} // namespace pulp::signal
One sample of explicit signal memory.
Definition unit_delay.hpp:12
void reset() noexcept
Definition unit_delay.hpp:31
SampleType publish() const noexcept
Definition unit_delay.hpp:17
void commit(SampleType input) noexcept
Definition unit_delay.hpp:21
SampleType process(SampleType input) noexcept
Definition unit_delay.hpp:25
Definition additive_bank.hpp:218
UnitDelayT< double > UnitDelay64
Definition unit_delay.hpp:40
UnitDelayT< float > UnitDelay
Definition unit_delay.hpp:39