Wayverb
calibration.h
1 #pragma once
2 
3 #include <cmath>
4 #include <iostream>
5 
9 
10 namespace wayverb {
11 namespace waveguide {
12 
15 inline double distance_for_unit_intensity() {
16  // Intensity for distance is given by 1 / (4 * pi * distance * distance)
17  using std::sqrt;
18  return sqrt(1.0 / (4 * M_PI));
19 }
20 
21 inline double distance_for_unit_pressure(double acoustic_impedance) {
22  using std::sqrt;
23  return sqrt(acoustic_impedance / (4 * M_PI));
24 }
25 
26 template <typename T, typename U>
27 inline auto rectilinear_calibration_factor(T grid_spacing,
28  U acoustic_impedance) {
29  return distance_for_unit_pressure(acoustic_impedance) /
30  (0.3405 * grid_spacing);
31 }
32 
33 } // namespace waveguide
34 } // namespace wayverb
Definition: capsule_base.h:9