LCOV - code coverage report
Current view: top level - src/audio/effects - overdrive.h (source / functions) Coverage Total Hit
Test: merged.info Lines: 100.0 % 4 4
Test Date: 2026-06-03 09:13:19 Functions: 100.0 % 3 3

            Line data    Source code
       1              : #pragma once
       2              : 
       3              : // Soft-clipping overdrive effect for tube-style saturation.
       4              : // The transfer curve uses smooth saturation such as y=tanh(drive*x[n]) or an
       5              : // equivalent soft clip, preserving small-signal dynamics while compressing
       6              : // peaks before tone filtering and output level scaling.
       7              : 
       8              : #include "audio/effects/effect.h"
       9              : #include "audio/dsp/biquad.h"
      10              : 
      11              : namespace Amplitron {
      12              : 
      13            5 : class Overdrive : public Effect {
      14              : public:
      15              :     Overdrive();
      16              :     void process(float* buffer, int num_samples) override;
      17              :     void reset() override;
      18         4022 :     const char* name() const override { return "Overdrive"; }
      19            9 :     const char* type_id() const override { return "Overdrive"; }
      20          922 :     std::vector<EffectParam>& params() override { return params_; }
      21              : 
      22              : private:
      23              :     std::vector<EffectParam> params_;
      24              :     OnePole tone_lp_;
      25              :     OnePole dc_block_;
      26              : 
      27              :     // One-pole smoothed parameter states
      28              :     float smoothed_drive_ = 1.5f;
      29              :     float smoothed_tone_ = 0.7f;
      30              :     float smoothed_level_ = 0.7f;
      31              : };
      32              : 
      33              : } // namespace Amplitron
        

Generated by: LCOV version 2.0-1