LCOV - code coverage report
Current view: top level - Tools - PanFilter.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 PanFilter.h
       3             :  */
       4             : 
       5             : #ifndef ATK_TOOLS_PANFILTER_H
       6             : #define ATK_TOOLS_PANFILTER_H
       7             : 
       8             : #include <ATK/Core/TypedBaseFilter.h>
       9             : #include <ATK/Tools/config.h>
      10             : 
      11             : namespace ATK
      12             : {
      13             :   /// Creates a stereo signal with a specific pan law
      14             :   template<typename DataType_>
      15             :   class ATK_TOOLS_EXPORT PanFilter final : public TypedBaseFilter<DataType_>
      16             :   {
      17             :   protected:
      18             :     /// Simplify parent calls
      19             :     using Parent = TypedBaseFilter<DataType_>;
      20             :     using typename Parent::DataType;
      21             :     using Parent::converted_inputs;
      22             :     using Parent::outputs;
      23             :     using Parent::nb_input_ports;
      24             :     using Parent::nb_output_ports;
      25             : 
      26             :   public:
      27             :     /// Constructor
      28             :     explicit PanFilter(gsl::index nb_channels = 1);
      29             :     /// Destructor
      30          40 :     ~PanFilter() override = default;
      31             :     
      32             :     /// Available laws
      33             :     enum class PAN_LAWS {
      34             :       /// Sin/cos law, center = 0 dB on each channel
      35             :       SINCOS_0_CENTER,
      36             :       /// Sin/cos law, center = -3 dB on each channel
      37             :       SINCOS_3_CENTER,
      38             :       /// square root law, center = 0 dB on each channel
      39             :       SQUARE_0_CENTER,
      40             :       /// square root law, center = -3 dB on each channel
      41             :       SQUARE_3_CENTER,
      42             :       /// linear taper law, center = -6 dB on each channel
      43             :       LINEAR_TAPER,
      44             :       /// balance law, center = hard left/right = 0 dB on each channel
      45             :       BALANCE,
      46             :     };
      47             :     
      48             :     /// Changes the pan law
      49             :     void set_pan_law(PAN_LAWS law);
      50             :     /// Gets the pan law enum
      51             :     PAN_LAWS get_pan_law() const;
      52             :     /// Sets the pan value
      53             :     void set_pan(double pan);
      54             :     /// Gets the pan value
      55             :     double get_pan() const;
      56             :     
      57             :   protected:
      58             :     void process_impl(gsl::index size) const final;
      59             : 
      60             :   private:
      61             :     PAN_LAWS law = PAN_LAWS::SINCOS_0_CENTER;
      62             :     double pan{0};
      63             :   };
      64             : }
      65             : 
      66             : #endif

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