summaryrefslogtreecommitdiffstats
path: root/src/GainControl.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/GainControl.h')
-rw-r--r--src/GainControl.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/src/GainControl.h b/src/GainControl.h
index a8f8233..e8f1be9 100644
--- a/src/GainControl.h
+++ b/src/GainControl.h
@@ -3,7 +3,7 @@
Her Majesty the Queen in Right of Canada (Communications Research
Center Canada)
- Copyright (C) 2014
+ Copyright (C) 2017
Matthias P. Braendli, matthias.braendli@mpb.li
http://opendigitalradio.org
@@ -37,6 +37,7 @@
#include <sys/types.h>
#include <complex>
#include <string>
+#include <mutex>
#ifdef __SSE__
# include <xmmintrin.h>
#endif
@@ -46,40 +47,48 @@ typedef std::complex<float> complexf;
enum class GainMode { GAIN_FIX = 0, GAIN_MAX = 1, GAIN_VAR = 2 };
-class GainControl : public ModCodec, public RemoteControllable
+class GainControl : public PipelinedModCodec, public RemoteControllable
{
public:
GainControl(size_t framesize,
GainMode mode,
float& digGain,
- float normalise);
+ float normalise,
+ float varVariance);
virtual ~GainControl();
GainControl(const GainControl&);
GainControl& operator=(const GainControl&);
- int process(Buffer* const dataIn, Buffer* dataOut);
- const char* name() { return "GainControl"; }
+ const char* name() override { return "GainControl"; }
/* Functions for the remote control */
/* Base function to set parameters. */
virtual void set_parameter(const std::string& parameter,
- const std::string& value);
+ const std::string& value) override;
/* Getting a parameter always returns a string. */
- virtual const std::string get_parameter(const std::string& parameter) const;
+ virtual const std::string get_parameter(
+ const std::string& parameter) const override;
protected:
+ virtual int internal_process(
+ Buffer* const dataIn, Buffer* dataOut) override;
+
size_t m_frameSize;
float& m_digGain;
- float m_normalise;
+ float m_normalise;
+
+ // The following variables are accessed from the RC thread
+ float m_var_variance_rc;
+ GainMode m_gainmode;
+ mutable std::mutex m_mutex;
+
#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);
#else
- 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);