dsplib 1.1.0
C++ DSP library for MATLAB-like coding
Loading...
Searching...
No Matches
delay.h
1#pragma once
2
3#include <dsplib/array.h>
4
5namespace dsplib {
6
7//Delay input signal by fixed samples
8template<typename T>
9class Delay
10{
11public:
12 explicit Delay(int length)
13 : _buffer(length) {
14 }
15
16 explicit Delay(const dsplib::base_array<T>& initial)
17 : _buffer{initial} {
18 }
19
21 //TODO: use cycle buffer
22 const int nd = _buffer.size();
23 const auto tmp = concatenate(_buffer, x);
24 _buffer.slice(0, nd) = tmp.slice(tmp.size() - nd, tmp.size());
25 return tmp.slice(0, x.size());
26 }
27
28 dsplib::base_array<T> operator()(span_t<T> x) {
29 return this->process(x);
30 }
31
32private:
34};
35
38
39} // namespace dsplib
Definition delay.h:10
base dsplib array type
Definition array.h:25
Definition span.h:295