VISR  0.11.6
Versatile Interactive Scene Renderer
gain_vector.hpp
Go to the documentation of this file.
1 /* Copyright Institute of Sound and Vibration Research - All rights reserved */
2 
3 #ifndef VISR_LIBRCL_GAIN_VECTOR_HPP_INCLUDED
4 #define VISR_LIBRCL_GAIN_VECTOR_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
7 
10 #include <libvisr/audio_output.hpp>
11 #include <libvisr/constants.hpp>
13 
16 
17 #include <cstddef> // for std::size_t
18 #include <memory>
19 #include <valarray>
20 
21 namespace visr
22 {
23 
24 // forward declaration
25 namespace rbbl
26 {
27 template<typename ElementType>
28 class GainFader;
29 }
30 
31 namespace rcl
32 {
33 
43 class VISR_RCL_LIBRARY_SYMBOL GainVector: public AtomicComponent
44 {
45  using SampleType = visr::SampleType;
46 public:
54  explicit GainVector( SignalFlowContext const & context,
55  char const * name,
56  CompositeComponent * parent = nullptr );
57 
62  ~GainVector();
63 
64 
77  void setup( std::size_t numberOfChannels,
78  std::size_t interpolationSteps,
79  bool controlInputs = false,
80  SampleType initialGainLinear = static_cast<SampleType>(1.0) );
91  void setup( std::size_t numberOfChannels,
92  std::size_t interpolationSteps,
93  bool controlInputs,
94  efl::BasicVector< SampleType > const & initialGainsLinear );
95 
100  void process( );
101 
102 private:
103 
118  void setGain( efl::BasicVector< SampleType > const & newGains );
119 
123  AudioInput mInput;
124 
128  AudioOutput mOutput;
129 
130  std::unique_ptr<ParameterInput<pml::DoubleBufferingProtocol, pml::VectorParameter<SampleType> > > mGainInput;
131 
135  std::size_t mNumberOfChannels;
136 
140  efl::BasicVector< SampleType > mCurrentGains;
141 
146 
150  std::size_t mInterpolationPeriods;
151 
157  std::size_t mInterpolationCounter;
158 
159  std::unique_ptr<rbbl::GainFader< SampleType > > mFader;
160 
161  };
162 
163 } // namespace rcl
164 } // namespace visr
165 
166 #endif // #ifndef VISR_LIBRCL_GAIN_VECTOR_HPP_INCLUDED
Definition: gain_vector.hpp:43
Definition: options.cpp:10
Definition: atomic_component.hpp:21
Definition: composite_component.hpp:29
Definition: signal_flow_context.hpp:15
float SampleType
Definition: constants.hpp:14