LCOV - code coverage report
Current view: top level - src/audio/effects - compressor.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 4 4
Test Date: 2026-06-01 11:15:25 Functions: 100.0 % 3 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/effects/effect.h"
       9              : #include "audio/dsp/envelope_follower.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              : 
      22              : private:
      23              :     std::vector<EffectParam> params_;
      24              :     EnvelopeFollower env_;
      25              :     float smoothed_attack_ms_ = 5.0f;    // matches default param
      26              :     float smoothed_release_ms_ = 100.0f; // matches default param
      27              : };
      28              : 
      29              : } // namespace Amplitron
        

Generated by: LCOV version 2.0-1