kwave  18.07.70
Normalizer.cpp File Reference
#include "config.h"
#include <math.h>
#include "libkwave/Sample.h"
#include "Normalizer.h"
Include dependency graph for Normalizer.cpp:

Go to the source code of this file.

Functions

static double limiter (const double x, const double lmtr_lvl)
 

Function Documentation

◆ limiter()

static double limiter ( const double  x,
const double  lmtr_lvl 
)
inlinestatic

Definition at line 58 of file Normalizer.cpp.

Referenced by Kwave::Normalizer::input().

59 {
60  double xp;
61 
62  if (x < -lmtr_lvl)
63  xp = tanh((x + lmtr_lvl) / (1-lmtr_lvl)) * (1-lmtr_lvl) - lmtr_lvl;
64  else if (x <= lmtr_lvl)
65  xp = x;
66  else
67  xp = tanh((x - lmtr_lvl) / (1-lmtr_lvl)) * (1-lmtr_lvl) + lmtr_lvl;
68 
69  return xp;
70 }
Here is the caller graph for this function: