Audacity 3.2.0
Functions
Gain.h File Reference
#include <type_traits>
#include <cmath>
#include <limits>
Include dependency graph for Gain.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<typename Type >
Type ExpGain (Type gain) noexcept
 

Function Documentation

◆ ExpGain()

template<typename Type >
Type ExpGain ( Type  gain)
noexcept

Definition at line 19 of file Gain.h.

20{
21 static_assert(std::is_floating_point_v<Type>);
22
23 constexpr Type a(1e-3);
24 constexpr Type b(6.908);
25
26 if (gain < std::numeric_limits<Type>::epsilon())
27 return {};
28
29 const Type expGain = a * std::exp(b * gain);
30
31 if (expGain > Type(1))
32 return Type(1);
33
34 return expGain;
35}

Referenced by AudioIoCallback::FillOutputBuffers().

Here is the caller graph for this function: