VISR  0.11.8
Versatile Interactive Scene Renderer
multichannel_delay_line.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_LIBRBBL_MULTICHANNEL_DELAY_LINE_HPP_INCLUDED
4 #define VISR_LIBRBBL_MULTICHANNEL_DELAY_LINE_HPP_INCLUDED
5 
6 #include "circular_buffer.hpp"
8 #include "export_symbols.hpp"
9 
10 #include <libvisr/constants.hpp>
11 
12 #include <cassert>
13 #include <complex>
14 #include <memory>
15 #include <vector>
16 
17 namespace visr
18 {
19 namespace rbbl
20 {
21 
28 template< typename SampleType >
29 class VISR_RBBL_LIBRARY_SYMBOL MultichannelDelayLine
30 {
31 public:
36  enum class MethodDelayPolicy: char
37  {
38  Add,
39  Limit,
41  Reject
42  };
43 
58  explicit MultichannelDelayLine( std::size_t numberOfChannels,
59  SamplingFrequencyType samplingFrequency,
60  std::size_t blockLength,
61  SampleType maxDelaySeconds,
62  char const * interpolationMethod,
63  MethodDelayPolicy methodDelayPolicy = MethodDelayPolicy::Add,
64  std::size_t alignment = 0 );
65 
70 
74  std::size_t numberOfChannels() const;
75 
79  std::size_t blockLength() const;
80 
85  SampleType methodDelaySeconds() const;
86 
91  SampleType methodDelaySamples() const;
92 
101  void write( SampleType const * input,
102  std::size_t channelStride,
103  std::size_t numberOfChannels,
104  std::size_t alignment );
105 
128  void interpolate( SampleType * output,
129  std::size_t channelIdx,
130  std::size_t numberOfSamples,
131  SampleType startDelay, SampleType endDelay,
132  SampleType startGain, SampleType endGain );
133 
134 private:
142  SampleType adjustDelay( SampleType rawDelay ) const;
143 
149  std::size_t const cBlockLength;
150 
154  SampleType const cSamplingFrequency;
155 
159  SampleType const cMaxDelaySamples;
160 
164  MethodDelayPolicy const cMethodDelayPolicy;
165 
170 
176  std::unique_ptr<FractionalDelayBase<SampleType> > mInterpolator;
177 
181  SampleType cMethodDelay;
182 };
183 
184 } // namespace rbbl
185 } // namespace visr
186 
187 #endif // #ifndef VISR_LIBRBBL_MULTICHANNEL_DELAY_LINE_HPP_INCLUDED
MethodDelayPolicy
Definition: multichannel_delay_line.hpp:36
Definition: multichannel_delay_line.hpp:29
Definition: options.cpp:10
std::size_t SamplingFrequencyType
Definition: constants.hpp:19
float SampleType
Definition: constants.hpp:14