VISR  0.11.1
Versatile Interactive Scene Renderer
gain_matrix.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_MATRIX_HPP_INCLUDED
4 #define VISR_LIBRCL_GAIN_MATRIX_HPP_INCLUDED
5 
6 #include "export_symbols.hpp"
7 
10 #include <libvisr/audio_output.hpp>
11 #include <libvisr/constants.hpp>
13 
14 // TODO: make it a forward declaration
15 #include <librbbl/gain_matrix.hpp>
16 
17 // For some reason, the forward declaration causes a compile error on MSVC,
18 // so we include the header for the moment.
19 // Also, I am not sure whether it makes sense to use a separate type as an alias to efl::BasicMatrix
22 
23 #include <libefl/aligned_array.hpp>
24 
25 
26 #include <cstddef> // for std::size_t
27 #include <memory>
28 #include <valarray>
29 
30 namespace visr
31 {
32 
33 namespace rcl
34 {
35 
46 class VISR_RCL_LIBRARY_SYMBOL GainMatrix: public AtomicComponent
47 {
48  using SampleType = visr::SampleType;
49 public:
56  explicit GainMatrix( SignalFlowContext const & context,
57  char const * name,
58  CompositeComponent * parent = nullptr );
59 
72  void setup( std::size_t numberOfInputs,
73  std::size_t numberOfOutputs,
74  std::size_t interpolationSteps,
75  SampleType initialGain = static_cast<SampleType>(0.0),
76  bool controlInput = true );
88  void setup( std::size_t numberOfInputs,
89  std::size_t numberOfOutputs,
90  std::size_t interpolationSteps,
91  efl::BasicMatrix< SampleType > const & initialGains,
92  bool controlInput = true );
93 
94  void process( );
95 
96 private:
97  std::unique_ptr< rbbl::GainMatrix< SampleType > > mMatrix;
98 
99  AudioInput mInput;
100  AudioOutput mOutput;
101 
108  std::valarray<SampleType const *> mInputChannels;
109  std::valarray<SampleType * > mOutputChannels;
111 
112  std::unique_ptr<ParameterInput<pml::SharedDataProtocol, pml::MatrixParameter<SampleType> > > mGainInput;
113 };
114 
115 } // namespace rcl
116 } // namespace visr
117 
118 #endif // #ifndef VISR_LIBRCL_GAIN_MATRIX_HPP_INCLUDED
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
Definition: gain_matrix.hpp:46