aboutsummaryrefslogtreecommitdiff
path: root/servers/audio/effects/eq.h
diff options
context:
space:
mode:
Diffstat (limited to 'servers/audio/effects/eq.h')
-rw-r--r--servers/audio/effects/eq.h43
1 files changed, 14 insertions, 29 deletions
diff --git a/servers/audio/effects/eq.h b/servers/audio/effects/eq.h
index 1a568ee21..a6d471cc4 100644
--- a/servers/audio/effects/eq.h
+++ b/servers/audio/effects/eq.h
@@ -32,18 +32,15 @@
#ifndef EQ_FILTER_H
#define EQ_FILTER_H
-
#include "typedefs.h"
#include "vector.h"
-
/**
@author Juan Linietsky
*/
class EQ {
public:
-
enum Preset {
PRESET_6_BANDS,
@@ -53,21 +50,18 @@ public:
PRESET_31_BANDS
};
-
-
class BandProcess {
- friend class EQ;
- float c1,c2,c3;
+ friend class EQ;
+ float c1, c2, c3;
struct History {
- float a1,a2,a3;
- float b1,b2,b3;
+ float a1, a2, a3;
+ float b1, b2, b3;
} history;
public:
-
- inline void process_one(float & p_data);
+ inline void process_one(float &p_data);
BandProcess();
};
@@ -76,7 +70,7 @@ private:
struct Band {
float freq;
- float c1,c2,c3;
+ float c1, c2, c3;
};
Vector<Band> band;
@@ -86,41 +80,32 @@ private:
void recalculate_band_coefficients();
public:
-
-
void set_mix_rate(float p_mix_rate);
int get_band_count() const;
void set_preset_band_mode(Preset p_preset);
- void set_bands(const Vector<float>& p_bands);
+ void set_bands(const Vector<float> &p_bands);
BandProcess get_band_processor(int p_band) const;
float get_band_frequency(int p_band);
EQ();
~EQ();
-
};
-
/* Inline Function */
-inline void EQ::BandProcess::process_one(float & p_data) {
+inline void EQ::BandProcess::process_one(float &p_data) {
+ history.a1 = p_data;
- history.a1=p_data;
-
- history.b1= c1 * ( history.a1 - history.a3 )
- + c3 * history.b2
- - c2 * history.b3;
+ history.b1 = c1 * (history.a1 - history.a3) + c3 * history.b2 - c2 * history.b3;
p_data = history.b1;
- history.a3=history.a2;
- history.a2=history.a1;
- history.b3=history.b2;
- history.b2=history.b1;
-
+ history.a3 = history.a2;
+ history.a2 = history.a1;
+ history.b3 = history.b2;
+ history.b2 = history.b1;
}
-
#endif