VISR  0.12.0
Versatile Interactive Scene Renderer
VBAP.h
Go to the documentation of this file.
1 //
2 // VBAP.h
3 //
4 // Created by Dylan Menzies on 10/11/2014.
5 // Copyright (c) ISVR, University of Southampton. All rights reserved.
6 //
7 
8 #ifndef __S3A_renderer_dsp__VBAP__
9 #define __S3A_renderer_dsp__VBAP__
10 
11 // uncomment to enable debug output
12 // #define VBAP_DEBUG_MESSAGES
13 
14 #include "defs.h"
15 #include "LoudspeakerArray.h"
16 
17 #include "export_symbols.hpp"
18 
19 #include <libefl/basic_matrix.hpp>
20 
21 namespace visr
22 {
23 namespace panning
24 {
25 
26 class VISR_PANNING_LIBRARY_SYMBOL VBAP
27 {
28 public:
36  explicit VBAP( const LoudspeakerArray &array, SampleType x = 0.0f, SampleType y = 0.0f, SampleType z = 0.0f );
37  VBAP( VBAP const & ) = delete;
38 
47  void calculateGains( SampleType x, SampleType y, SampleType z, SampleType * gains ) const;
48 
57  void calculateGainsUnNormalised( SampleType x, SampleType y, SampleType z, SampleType * gains ) const;
58 
66  void setListenerPosition( SampleType x, SampleType y, SampleType z );
67 
68 private:
69 
70  bool is2D;
71  bool isInfinite;
72 
73  size_t numTotLoudspeakers;
74  size_t numRegLoudspeakers;
75  size_t numVirtLoudspeakers;
76  size_t numTriplets;
82 
88 
93  efl::BasicMatrix<SampleType> mReroutingMatrix;
94 
98  std::vector<LoudspeakerArray::TripletType> mTriplets;
99 
103  std::array<SampleType, 3> mListenerPos;
110  mutable std::vector<SampleType> mGain;
111 
115  void calcInvMatrices();
116 
125  void calcPlainVBAP( SampleType posX, SampleType posY, SampleType posZ ) const;
126 
130  void applyRerouting() const;
131 
132 };
133 
134 } // namespace panning
135 } // namespace visr
136 
137 #endif /* defined(__S3A_renderer_dsp__VBAP__) */
Definition: VBAP.h:26
Definition: options.cpp:10
Definition: LoudspeakerArray.h:42
float SampleType
Definition: constants.hpp:14