From c9ef2a5b36d9082b2c2c853934a0332aef6564a6 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 2 Jul 2014 17:18:08 +0200 Subject: Add digital gain to remote control --- src/GainControl.h | 55 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 21 deletions(-) (limited to 'src/GainControl.h') 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 #endif - #include "ModCodec.h" - +#include "RemoteControl.h" #include #include +#include #ifdef __SSE__ # include #endif @@ -42,31 +42,44 @@ typedef std::complex 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__ }; -- cgit v1.2.3