SAL
A C++ library for spatial audio.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sphericalheadmic.h
Go to the documentation of this file.
1 /*
2  directivityhrtf.h
3  Spatial Audio Library (SAL)
4  Copyright (c) 2011, Enzo De Sena
5  All rights reserved.
6 
7  Authors: Enzo De Sena, enzodesena@gmail.com
8 
9  */
10 
11 #ifndef SAL_DIRECTIVITYSPHERICAL_H
12 #define SAL_DIRECTIVITYSPHERICAL_H
13 
14 #include "microphone.h"
15 #include "saltypes.h"
16 #include "kemarmic.h"
17 #include <map>
18 #include "salconstants.h"
19 
20 namespace sal {
21 
26 class SphericalHeadMic : public BinauralMic {
27 public:
28  SphericalHeadMic(const mcl::Point position, const mcl::Quaternion orientation,
29  const Angle ears_angle,
30  const Length sphere_radius,
31  const Int ir_length,
32  const Time sampling_frequency,
33  const Int update_length = 0);
34 
35  static bool Test();
36 
37  virtual ~SphericalHeadMic() {}
38 private:
39 
40  virtual Signal GetBrir(const Ear ear, const mcl::Point& point) noexcept;
41 
43  static mcl::Complex Sphere(Length a, Length r, Angle theta,
44  Time f, Time c, mcl::Real threshold);
45 
53  static Signal GenerateImpulseResponse(Length sphere_radius,
54  Length source_distance,
55  Angle theta,
56  Time sound_speed,
57  mcl::Real threshold,
58  Int num_samples,
59  Time sampling_frequency,
60  bool minimum_phase = false);
61 
63  static Angle GetTheta(const mcl::Point& point,
64  const Angle& ears_angle,
65  const Ear& ear);
66 
67 
72  Angle ears_angle_;
73 
75  Length sphere_radius_;
76 
77  Time sampling_frequency_;
78 
87  Int impulse_response_length_;
88 
89  Time sound_speed_;
90 
92  mcl::Real alg_threshold_;
93 
94 };
95 
96 } // namespace sal
97 
98 #endif