mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-18 04:36:30 +01:00
NO-OP: clang format
This commit is contained in:
parent
edc19e2b7d
commit
2b0e6ec476
1 changed files with 98 additions and 73 deletions
|
|
@ -18,12 +18,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdlib.h>
|
|
||||||
#include <cmath>
|
|
||||||
#include <boost/math/special_functions/fpclassify.hpp>
|
#include <boost/math/special_functions/fpclassify.hpp>
|
||||||
|
#include <cmath>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "ardour/dB.h"
|
|
||||||
#include "ardour/buffer.h"
|
#include "ardour/buffer.h"
|
||||||
|
#include "ardour/dB.h"
|
||||||
#include "ardour/dsp_filter.h"
|
#include "ardour/dsp_filter.h"
|
||||||
#include "ardour/runtime_functions.h"
|
#include "ardour/runtime_functions.h"
|
||||||
|
|
||||||
|
|
@ -41,21 +41,24 @@
|
||||||
using namespace ARDOUR::DSP;
|
using namespace ARDOUR::DSP;
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR::DSP::memset (float *data, const float val, const uint32_t n_samples) {
|
ARDOUR::DSP::memset (float* data, const float val, const uint32_t n_samples)
|
||||||
|
{
|
||||||
for (uint32_t i = 0; i < n_samples; ++i) {
|
for (uint32_t i = 0; i < n_samples; ++i) {
|
||||||
data[i] = val;
|
data[i] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR::DSP::mmult (float *data, float *mult, const uint32_t n_samples) {
|
ARDOUR::DSP::mmult (float* data, float* mult, const uint32_t n_samples)
|
||||||
|
{
|
||||||
for (uint32_t i = 0; i < n_samples; ++i) {
|
for (uint32_t i = 0; i < n_samples; ++i) {
|
||||||
data[i] *= mult[i];
|
data[i] *= mult[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
ARDOUR::DSP::log_meter (float power) {
|
ARDOUR::DSP::log_meter (float power)
|
||||||
|
{
|
||||||
// compare to libs/ardour/log_meter.h
|
// compare to libs/ardour/log_meter.h
|
||||||
static const float lower_db = -192.f;
|
static const float lower_db = -192.f;
|
||||||
static const float upper_db = 0.f;
|
static const float upper_db = 0.f;
|
||||||
|
|
@ -64,13 +67,17 @@ ARDOUR::DSP::log_meter (float power) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
ARDOUR::DSP::log_meter_coeff (float coeff) {
|
ARDOUR::DSP::log_meter_coeff (float coeff)
|
||||||
if (coeff <= 0) return 0;
|
{
|
||||||
|
if (coeff <= 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return log_meter (fast_coefficient_to_dB (coeff));
|
return log_meter (fast_coefficient_to_dB (coeff));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ARDOUR::DSP::peaks (const float *data, float &min, float &max, uint32_t n_samples) {
|
ARDOUR::DSP::peaks (const float* data, float& min, float& max, uint32_t n_samples)
|
||||||
|
{
|
||||||
ARDOUR::find_peaks (data, n_samples, &min, &max);
|
ARDOUR::find_peaks (data, n_samples, &min, &max);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -126,8 +133,11 @@ LowPass::proc (float *data, const uint32_t n_samples)
|
||||||
z = data[i];
|
z = data[i];
|
||||||
}
|
}
|
||||||
_z = z;
|
_z = z;
|
||||||
if (!isfinite_local (_z)) { _z = 0; }
|
if (!isfinite_local (_z)) {
|
||||||
else if (!boost::math::isnormal (_z)) { _z = 0; }
|
_z = 0;
|
||||||
|
} else if (!boost::math::isnormal (_z)) {
|
||||||
|
_z = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -180,10 +190,16 @@ Biquad::run (float *data, const uint32_t n_samples)
|
||||||
data[i] = z;
|
data[i] = z;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isfinite_local (_z1)) { _z1 = 0; }
|
if (!isfinite_local (_z1)) {
|
||||||
else if (!boost::math::isnormal (_z1)) { _z1 = 0; }
|
_z1 = 0;
|
||||||
if (!isfinite_local (_z2)) { _z2 = 0; }
|
} else if (!boost::math::isnormal (_z1)) {
|
||||||
else if (!boost::math::isnormal (_z2)) { _z2 = 0; }
|
_z1 = 0;
|
||||||
|
}
|
||||||
|
if (!isfinite_local (_z2)) {
|
||||||
|
_z2 = 0;
|
||||||
|
} else if (!boost::math::isnormal (_z2)) {
|
||||||
|
_z2 = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -238,9 +254,15 @@ Biquad::calc_vicanek (const double W0, double& A0, double& A1, double& A2, doubl
|
||||||
void
|
void
|
||||||
Biquad::compute (Type type, double freq, double Q, double gain)
|
Biquad::compute (Type type, double freq, double Q, double gain)
|
||||||
{
|
{
|
||||||
if (Q <= .001) { Q = 0.001; }
|
if (Q <= .001) {
|
||||||
if (freq <= 1.) { freq = 1.; }
|
Q = 0.001;
|
||||||
if (freq >= 0.4998 * _rate) { freq = 0.4998 * _rate; }
|
}
|
||||||
|
if (freq <= 1.) {
|
||||||
|
freq = 1.;
|
||||||
|
}
|
||||||
|
if (freq >= 0.4998 * _rate) {
|
||||||
|
freq = 0.4998 * _rate;
|
||||||
|
}
|
||||||
|
|
||||||
/* Compute biquad filter settings.
|
/* Compute biquad filter settings.
|
||||||
* Based on 'Cookbook formulae for audio EQ biquad filter coefficents'
|
* Based on 'Cookbook formulae for audio EQ biquad filter coefficents'
|
||||||
|
|
@ -434,11 +456,12 @@ Biquad::dB_at_freq (float freq) const
|
||||||
|
|
||||||
#define SQUARE(x) ((x) * (x))
|
#define SQUARE(x) ((x) * (x))
|
||||||
float rv = 20.f * log10f (sqrtf ((SQUARE (a) + SQUARE (b)) * (SQUARE (c) + SQUARE (d))) / (SQUARE (c) + SQUARE (d)));
|
float rv = 20.f * log10f (sqrtf ((SQUARE (a) + SQUARE (b)) * (SQUARE (c) + SQUARE (d))) / (SQUARE (c) + SQUARE (d)));
|
||||||
if (!isfinite_local (rv)) { rv = 0; }
|
if (!isfinite_local (rv)) {
|
||||||
|
rv = 0;
|
||||||
|
}
|
||||||
return std::min (120.f, std::max (-120.f, rv));
|
return std::min (120.f, std::max (-120.f, rv));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Glib::Threads::Mutex FFTSpectrum::fft_planner_lock;
|
Glib::Threads::Mutex FFTSpectrum::fft_planner_lock;
|
||||||
|
|
||||||
FFTSpectrum::FFTSpectrum (uint32_t window_size, double rate)
|
FFTSpectrum::FFTSpectrum (uint32_t window_size, double rate)
|
||||||
|
|
@ -528,7 +551,8 @@ FFTSpectrum::execute ()
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
float
|
||||||
FFTSpectrum::power_at_bin (const uint32_t b, const float norm) const {
|
FFTSpectrum::power_at_bin (const uint32_t b, const float norm) const
|
||||||
|
{
|
||||||
assert (b < _fft_data_size);
|
assert (b < _fft_data_size);
|
||||||
const float a = _fft_power[b] * norm;
|
const float a = _fft_power[b] * norm;
|
||||||
return a > 1e-12 ? 10.0 * fast_log10 (a) : -INFINITY;
|
return a > 1e-12 ? 10.0 * fast_log10 (a) : -INFINITY;
|
||||||
|
|
@ -542,7 +566,8 @@ Generator::Generator ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Generator::set_type (Generator::Type t) {
|
Generator::set_type (Generator::Type t)
|
||||||
|
{
|
||||||
_type = t;
|
_type = t;
|
||||||
_b0 = _b1 = _b2 = _b3 = _b4 = _b5 = _b6 = 0;
|
_b0 = _b1 = _b2 = _b3 = _b4 = _b5 = _b6 = 0;
|
||||||
_pass = false;
|
_pass = false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue