LCOV - code coverage report
Current view: top level - Dynamic - GainMaxCompressorFilter.h (source / functions) Hit Total Coverage
Test: coverage.info.cleaned Lines: 1 1 100.0 %
Date: 2021-02-18 20:07:22 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /**
       2             :  * \file GainMaxCompressorFilter.h
       3             :  */
       4             : 
       5             : #ifndef ATK_DYNAMIC_GAINMAXCOMPRESSORFILTER_H
       6             : #define ATK_DYNAMIC_GAINMAXCOMPRESSORFILTER_H
       7             : 
       8             : #include <ATK/Dynamic/GainFilter.h>
       9             : #include <ATK/Dynamic/config.h>
      10             : 
      11             : namespace ATK
      12             : {
      13             :   /// Gain "compressor". Computes a new amplitude/volume gain based on threshold, slope and the power of the input signal
      14             :   template<typename DataType_>
      15             :   class ATK_DYNAMIC_EXPORT GainMaxCompressorFilter : public ParentGainFilter<DataType_>
      16             :   {
      17             :   public:
      18             :     using Parent = ParentGainFilter<DataType_>;
      19             :     using Parent::ratio;
      20             :     using Parent::start_recomputeLUT;
      21             :     using typename Parent::DataType;
      22             :     /*!
      23             :      * @brief Constructor
      24             :      * @param nb_channels is the number of input and output channels
      25             :      * @param LUTsize is the total LUT size used by the filter
      26             :      * @param LUTprecision is the number of elements used to compute values < 1
      27             :      */
      28             :     GainMaxCompressorFilter(gsl::index nb_channels = 1, size_t LUTsize = 128*1024, size_t LUTprecision = 64);
      29             :     /// Destructor
      30          10 :     ~GainMaxCompressorFilter() override = default;
      31             : 
      32             :     /// Sets the softness of the knee of the filter (positive value)
      33             :     void set_softness(DataType_ softness);
      34             :     /// Retrieves the softness afctor
      35             :     DataType_ get_softness() const;
      36             : 
      37             :     /// Sets the maximum reduction factor of the filter (limit reduction to this factor instead of infinite)
      38             :     void set_max_reduction(DataType_ max_reduction);
      39             :     /// Sets the maximum reduction in dB
      40             :     void set_max_reduction_db(DataType_ max_reduction);
      41             :     /// Gets the maximum reduction factor
      42             :     DataType_ get_max_reduction() const;
      43             : 
      44             :   protected:
      45             :     DataType_ computeGain(DataType_ value) const;
      46             :   private:
      47             :     DataType_ softness{0.0001};
      48             :     DataType_ max_reduction{0.01};
      49             :   };
      50             : }
      51             : 
      52             : #endif

Generated by: LCOV version TK-3.3.0-4-gdba42eea