LCOV - code coverage report
Current view: top level - src/audio/effects/dynamics - compressor.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 80.0 % 5 4
Test Date: 2026-06-07 15:51:50 Functions: 75.0 % 4 3

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : // Dynamic range compressor for smoothing guitar input levels.
       4              : // An envelope follower estimates level e[n]; above threshold T, gain follows
       5              : // g_db = T + (level_db - T)/ratio - level_db, with attack/release smoothing
       6              : // applied before multiplying y[n] = x[n] * 10^(g_db/20).
       7              : 
       8              : #include "audio/dsp/envelope_follower.h"
       9              : #include "audio/effects/core/effect.h"
      10              : 
      11              : namespace Amplitron {
      12              : 
      13            3 : class Compressor : public Effect {
      14              :    public:
      15              :     Compressor();
      16              :     void process(float* buffer, int num_samples) override;
      17              :     void reset() override;
      18          116 :     const char* name() const override { return "Compressor"; }
      19            3 :     const char* type_id() const override { return "Compressor"; }
      20          116 :     std::vector<EffectParam>& params() override { return params_; }
      21            0 :     const std::vector<EffectParam>& params() const override { return params_; }
      22              : 
      23              :    private:
      24              :     std::vector<EffectParam> params_;
      25              :     EnvelopeFollower env_;
      26              :     float smoothed_attack_ms_ = 5.0f;     // matches default param
      27              :     float smoothed_release_ms_ = 100.0f;  // matches default param
      28              : };
      29              : 
      30              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1