VISR  0.11.8
Versatile Interactive Scene Renderer
late_reverb_filter_calculator.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_LIBREVERBOBJECT_LATE_REVERB_FILTER_CALCULATOR_HPP_INCLUDED
4 #define VISR_LIBREVERBOBJECT_LATE_REVERB_FILTER_CALCULATOR_HPP_INCLUDED
5 
7 
8 #include "export_symbols.hpp"
9 
11 #include <libvisr/constants.hpp>
14 
16 
17 #include <libefl/basic_matrix.hpp>
18 
21 
22 #include <vector>
23 #include <utility> // for std::pair
24 
25 namespace visr
26 {
27 // Forward declaration
28 namespace rbbl
29 {
30 template< typename CoefficientType >
31 class BiquadCoefficient;
32 }
33 
34 namespace reverbobject
35 {
36 
41 class VISR_REVERBOBJECT_LIBRARY_SYMBOL LateReverbFilterCalculator: public AtomicComponent
42 {
43 public:
56  explicit LateReverbFilterCalculator( SignalFlowContext const & context,
57  char const * name,
58  CompositeComponent * parent,
59  std::size_t numberOfObjects,
60  SampleType lateReflectionLengthSeconds,
61  std::size_t numLateReflectionSubBandLevels,
62  std::size_t maxUpdatesPerPeriod = 0 );
63 
68 
69 
74 
80  void process() override;
81 
82 private:
92  void calculateImpulseResponse( std::size_t objectIdx,
94  SampleType * ir,
95  std::size_t irLength, std::size_t alignment = 0 );
96 
103  static void createWhiteNoiseSequence( std::size_t numSamples, SampleType* data, std::size_t alignment = 0 );
104 
112  static void filterSequence( std::size_t numSamples, SampleType const * const input, SampleType * output,
113  rbbl::BiquadCoefficient<SampleType> const & filter );
114 
125  static void createEnvelope( std::size_t numSamples, SampleType* data,
126  SampleType initialDelay, SampleType gain, SampleType attackCoeff, SampleType decayCoeff,
127  SampleType samplingFrequency );
128 
132  std::size_t const mAlignment;
133 
137  std::size_t const mNumberOfObjects;
138 
139  std::size_t const mNumberOfSubBands;
140 
141  std::size_t const mFilterLength;
142 
143  std::size_t const mMaxUpdatesPerIteration;
144 
145  efl::BasicMatrix<SampleType> mSubBandNoiseSequences;
146 
155  SampleType const * const subBandNoiseSequence( std::size_t objectIdx, std::size_t bandIdx ) const
156  {
157  return mSubBandNoiseSequences.row( objectIdx * mNumberOfSubBands + bandIdx );
158  }
159 
164  SampleType * const subBandNoiseSequence( std::size_t objectIdx, std::size_t bandIdx )
165  {
166  return mSubBandNoiseSequences.row( objectIdx * mNumberOfSubBands + bandIdx );
167  }
168 
170 
173 };
174 
175 } // namespace reverbobject
176 } // namespace visr
177 
178 #endif // #ifndef VISR_LIBREVERBOBJECT_LATE_REVERB_FILTER_CALCULATOR_HPP_INCLUDED
Definition: parameter_output.hpp:45
Definition: late_reverb_filter_calculator.hpp:41
Definition: biquad_coefficient.hpp:30
Definition: options.cpp:10
Definition: atomic_component.hpp:21
Definition: parameter_input.hpp:45
Definition: composite_component.hpp:29
Definition: signal_flow_context.hpp:15
ElementType * row(std::size_t rowIdx)
Definition: basic_matrix.hpp:211
Definition: point_source_with_reverb.hpp:158
Definition: indexed_value_parameter.hpp:42
float SampleType
Definition: constants.hpp:14