[DEBUG] wrong std version
This commit is contained in:
parent
9a5490580a
commit
7b5340666f
@ -9,6 +9,7 @@
|
||||
|
||||
#include <etk/memory.h>
|
||||
#include <audio/algo/drain/BiQuadType.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace audio {
|
||||
namespace algo {
|
||||
@ -57,8 +58,8 @@ namespace audio {
|
||||
_qualityFactor = 0.01;
|
||||
}
|
||||
double norm;
|
||||
double V = std11::pow(10.0, std11::abs(_gain) / 20.0);
|
||||
double K = std11::tan(M_PI * _frequencyCut / _sampleRate);
|
||||
double V = std::pow(10.0, std::abs(_gain) / 20.0);
|
||||
double K = std::tan(M_PI * _frequencyCut / _sampleRate);
|
||||
switch (_type) {
|
||||
case biQuadType_none:
|
||||
m_a[0] = 1.0;
|
||||
@ -119,35 +120,35 @@ namespace audio {
|
||||
case biQuadType_lowShelf:
|
||||
if (_gain >= 0) {
|
||||
norm = 1.0 / (1.0 + M_SQRT2 * K + K * K);
|
||||
m_a[0] = (1.0 + std11::sqrt(2.0*V) * K + V * K * K) * norm;
|
||||
m_a[0] = (1.0 + std::sqrt(2.0*V) * K + V * K * K) * norm;
|
||||
m_a[1] = 2.0 * (V * K * K - 1.0) * norm;
|
||||
m_a[2] = (1.0 - std11::sqrt(2.0*V) * K + V * K * K) * norm;
|
||||
m_a[2] = (1.0 - std::sqrt(2.0*V) * K + V * K * K) * norm;
|
||||
m_b[0] = 2.0 * (K * K - 1.0) * norm;
|
||||
m_b[1] = (1.0 - M_SQRT2 * K + K * K) * norm;
|
||||
} else {
|
||||
norm = 1.0 / (1.0 + std11::sqrt(2.0*V) * K + V * K * K);
|
||||
norm = 1.0 / (1.0 + std::sqrt(2.0*V) * K + V * K * K);
|
||||
m_a[0] = (1.0 + M_SQRT2 * K + K * K) * norm;
|
||||
m_a[1] = 2.0 * (K * K - 1.0) * norm;
|
||||
m_a[2] = (1.0 - M_SQRT2 * K + K * K) * norm;
|
||||
m_b[0] = 2.0 * (V * K * K - 1.0) * norm;
|
||||
m_b[1] = (1.0 - std11::sqrt(2.0*V) * K + V * K * K) * norm;
|
||||
m_b[1] = (1.0 - std::sqrt(2.0*V) * K + V * K * K) * norm;
|
||||
}
|
||||
break;
|
||||
case biQuadType_highShelf:
|
||||
if (_gain >= 0) {
|
||||
norm = 1.0 / (1.0 + M_SQRT2 * K + K * K);
|
||||
m_a[0] = (V + std11::sqrt(2.0*V) * K + K * K) * norm;
|
||||
m_a[0] = (V + std::sqrt(2.0*V) * K + K * K) * norm;
|
||||
m_a[1] = 2.0 * (K * K - V) * norm;
|
||||
m_a[2] = (V - std11::sqrt(2.0*V) * K + K * K) * norm;
|
||||
m_a[2] = (V - std::sqrt(2.0*V) * K + K * K) * norm;
|
||||
m_b[0] = 2.0 * (K * K - 1.0) * norm;
|
||||
m_b[1] = (1.0 - M_SQRT2 * K + K * K) * norm;
|
||||
} else {
|
||||
norm = 1.0 / (V + std11::sqrt(2.0*V) * K + K * K);
|
||||
norm = 1.0 / (V + std::sqrt(2.0*V) * K + K * K);
|
||||
m_a[0] = (1.0 + M_SQRT2 * K + K * K) * norm;
|
||||
m_a[1] = 2.0 * (K * K - 1.0) * norm;
|
||||
m_a[2] = (1.0 - M_SQRT2 * K + K * K) * norm;
|
||||
m_b[0] = 2.0 * (K * K - V) * norm;
|
||||
m_b[1] = (V - std11::sqrt(2.0*V) * K + K * K) * norm;
|
||||
m_b[1] = (V - std::sqrt(2.0*V) * K + K * K) * norm;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -255,16 +256,16 @@ namespace audio {
|
||||
w = iii / (len - 1.0) * M_PI;
|
||||
} else {
|
||||
// 0.001 to 1, times pi, log scale
|
||||
w = std11::exp(std11::log(1.0 / 0.001) * iii / (len - 1.0)) * 0.001 * M_PI;
|
||||
w = std::exp(std::log(1.0 / 0.001) * iii / (len - 1.0)) * 0.001 * M_PI;
|
||||
}
|
||||
double freq = iii / (len - 1.0) * _sampleRate / 2.0;
|
||||
double phi = std11::pow(std11::sin(w/2.0), 2.0);
|
||||
double y = std11::log( std11::pow((m_a[0]+m_a[1]+m_a[2]).getDouble(), 2.0)
|
||||
- 4.0*((m_a[0]*m_a[1]).getDouble() + 4.0*(m_a[0]*m_a[2]).getDouble() + (m_a[1]*m_a[2]).getDouble())*phi
|
||||
+ 16.0*(m_a[0]*m_a[2]).getDouble()*phi*phi)
|
||||
- std11::log( std11::pow(1.0+(m_b[0]+m_b[1]).getDouble(), 2.0)
|
||||
- 4.0*((m_b[0]).getDouble() + 4.0*(m_b[1]).getDouble() + (m_b[0]*m_b[1]).getDouble())*phi
|
||||
+ 16.0*m_b[1].getDouble()*phi*phi);
|
||||
double phi = std::pow(std::sin(w/2.0), 2.0);
|
||||
double y = std::log( std::pow((m_a[0]+m_a[1]+m_a[2]).getDouble(), 2.0)
|
||||
- 4.0*((m_a[0]*m_a[1]).getDouble() + 4.0*(m_a[0]*m_a[2]).getDouble() + (m_a[1]*m_a[2]).getDouble())*phi
|
||||
+ 16.0*(m_a[0]*m_a[2]).getDouble()*phi*phi)
|
||||
- std::log( std::pow(1.0+(m_b[0]+m_b[1]).getDouble(), 2.0)
|
||||
- 4.0*((m_b[0]).getDouble() + 4.0*(m_b[1]).getDouble() + (m_b[0]*m_b[1]).getDouble())*phi
|
||||
+ 16.0*m_b[1].getDouble()*phi*phi);
|
||||
y = y * 10.0 / M_LN10;
|
||||
if (y <= -200) {
|
||||
y = -200.0;
|
||||
|
Loading…
Reference in New Issue
Block a user