summaryrefslogtreecommitdiffstats
path: root/src/GainControl.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-07-02 17:18:08 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-07-02 17:18:08 +0200
commitc9ef2a5b36d9082b2c2c853934a0332aef6564a6 (patch)
tree28561b9aa7092e76450bf31af878ce75e63465f8 /src/GainControl.h
parentf8719227d8cb9a228adae3472b7e754aa204d9de (diff)
downloaddabmod-c9ef2a5b36d9082b2c2c853934a0332aef6564a6.tar.gz
dabmod-c9ef2a5b36d9082b2c2c853934a0332aef6564a6.tar.bz2
dabmod-c9ef2a5b36d9082b2c2c853934a0332aef6564a6.zip
Add digital gain to remote control
Diffstat (limited to 'src/GainControl.h')
-rw-r--r--src/GainControl.h55
1 files changed, 34 insertions, 21 deletions
diff --git a/src/GainControl.h b/src/GainControl.h
index 4cf4ae1..65b94da 100644
--- a/src/GainControl.h
+++ b/src/GainControl.h
@@ -27,12 +27,12 @@
# include <config.h>
#endif
-
#include "ModCodec.h"
-
+#include "RemoteControl.h"
#include <sys/types.h>
#include <complex>
+#include <string>
#ifdef __SSE__
# include <xmmintrin.h>
#endif
@@ -42,31 +42,44 @@ typedef std::complex<float> complexf;
enum GainMode { GAIN_FIX, GAIN_MAX, GAIN_VAR };
-class GainControl : public ModCodec
+class GainControl : public ModCodec, public RemoteControllable
{
-public:
- GainControl(size_t frameSize, GainMode mode = GAIN_VAR, float factor = 1.0f);
- virtual ~GainControl();
- GainControl(const GainControl&);
- GainControl& operator=(const GainControl&);
+ public:
+ GainControl(size_t framesize,
+ GainMode mode = GAIN_VAR,
+ float digGain = 1.0f,
+ float normalise = 1.0f);
+
+ virtual ~GainControl();
+ GainControl(const GainControl&);
+ GainControl& operator=(const GainControl&);
+
+
+ int process(Buffer* const dataIn, Buffer* dataOut);
+ const char* name() { return "GainControl"; }
+ /* Functions for the remote control */
+ /* Base function to set parameters. */
+ virtual void set_parameter(const std::string& parameter,
+ const std::string& value);
- int process(Buffer* const dataIn, Buffer* dataOut);
- const char* name() { return "GainControl"; }
+ /* Getting a parameter always returns a string. */
+ virtual const std::string get_parameter(const std::string& parameter) const;
-protected:
- size_t d_frameSize;
- float d_factor;
+ protected:
+ size_t d_frameSize;
+ float d_digGain;
+ float d_normalise;
#ifdef __SSE__
- __m128 (*computeGain)(const __m128* in, size_t sizeIn);
- __m128 static computeGainFix(const __m128* in, size_t sizeIn);
- __m128 static computeGainMax(const __m128* in, size_t sizeIn);
- __m128 static computeGainVar(const __m128* in, size_t sizeIn);
+ __m128 (*computeGain)(const __m128* in, size_t sizeIn);
+ __m128 static computeGainFix(const __m128* in, size_t sizeIn);
+ __m128 static computeGainMax(const __m128* in, size_t sizeIn);
+ __m128 static computeGainVar(const __m128* in, size_t sizeIn);
#else // !__SSE__
- float (*computeGain)(const complexf* in, size_t sizeIn);
- float static computeGainFix(const complexf* in, size_t sizeIn);
- float static computeGainMax(const complexf* in, size_t sizeIn);
- float static computeGainVar(const complexf* in, size_t sizeIn);
+ float (*computeGain)(const complexf* in, size_t sizeIn);
+ float static computeGainFix(const complexf* in, size_t sizeIn);
+ float static computeGainMax(const complexf* in, size_t sizeIn);
+ float static computeGainVar(const complexf* in, size_t sizeIn);
#endif // __SSE__
};