NAP
delay.h
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4 
5 #pragma once
6 
7 #include <audio/utility/audiotypes.h>
8 
9 namespace nap
10 {
11  namespace audio
12  {
13 
18  class NAPAPI Delay
19  {
20  public:
24  Delay(unsigned int bufferSize);
25 
26  ~Delay() = default;
27 
31  void write(SampleValue sample);
32 
37  SampleValue read(unsigned int time);
38 
42  SampleValue readInterpolating(float sampleTime);
43 
47  void clear();
48 
52  unsigned int getMaxDelay() { return mBuffer.size(); }
53 
57  inline SampleValue operator[](unsigned int index) { return read(index); }
58 
59  private:
60 
61  SampleBuffer mBuffer;
62  unsigned int mWriteIndex = 0;
63  };
64 
65  }
66 }
nap::audio::Delay::operator[]
SampleValue operator[](unsigned int index)
Definition: delay.h:57
nap::audio::SampleValue
float SampleValue
Definition: audiotypes.h:28
nap::audio::Delay::getMaxDelay
unsigned int getMaxDelay()
Definition: delay.h:52
nap
Definition: templateapp.h:17
nap::audio::Delay
Definition: delay.h:18
nap::audio::SampleBuffer
std::vector< SampleValue > SampleBuffer
Definition: audiotypes.h:34