21 #ifndef __ardour_logcurve_h__
22 #define __ardour_logcurve_h__
25 #include <glibmm/threads.h>
31 LogCurve (
float steepness = 0.2, uint32_t len = 0) {
35 b = 1.0f / log(1.0f + (1.0f / S));
39 return S == other.
S && l == other.
l;
42 bool operator!= (
const LogCurve& other)
const {
43 return S != other.
S || l != other.
l;
46 float value (
float frac)
const {
50 float value (uint32_t pos)
const {
51 return (
fast_log(((
float) pos/l) + S) - a) * b;
59 return (a -
fast_log(((
float) pos/l) + S)) * b;
62 void fill (
float *vec, uint32_t veclen,
bool invert)
const {
63 float dx = 1.0f/veclen;
72 for (i = 1, x = 0; i < veclen - 1; x += dx, i++) {
81 for (i = veclen-2, x = 0.0f; i > 0; x += dx, i--) {
88 uint32_t
length()
const {
return l; }
93 b = 1.0f / log(1.0f + (1.0f / S));
97 mutable Glib::Threads::Mutex
lock;
113 return (
fast_log(frac + S) - a) * b;
117 return (
fast_log(((
float) pos/l) + S) - a) * b;
float value(float frac) const
LogCurveIn(float steepness=0.2, uint32_t len=0)
float value(uint32_t pos) const
LogCurveOut(float steepness=0.2, uint32_t len=0)
float invert_value(uint32_t pos) const
void fill(float *vec, uint32_t veclen, bool invert) const
float invert_value(float frac) const
void set_steepness(float steepness)
float value(uint32_t pos) const
LogCurve(float steepness=0.2, uint32_t len=0)
Glib::Threads::Mutex lock
float value(float frac) const
void set_length(uint32_t len)
static float fast_log(const float val)
bool operator==(const ProcessorSelection &a, const ProcessorSelection &b)