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