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

            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/dsp/biquad.h"
       9              : #include "audio/effects/core/effect.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         3782 :     const char* name() const override { return "Overdrive"; }
      19            6 :     const char* type_id() const override { return "Overdrive"; }
      20          802 :     std::vector<EffectParam>& params() override { return params_; }
      21            3 :     const std::vector<EffectParam>& params() const override { return params_; }
      22              : 
      23              :    private:
      24              :     std::vector<EffectParam> params_;
      25              :     OnePole tone_lp_;
      26              :     OnePole dc_block_;
      27              : 
      28              :     // One-pole smoothed parameter states
      29              :     float smoothed_drive_ = 1.5f;
      30              :     float smoothed_tone_ = 0.7f;
      31              :     float smoothed_level_ = 0.7f;
      32              : };
      33              : 
      34              : }  // namespace Amplitron
        

Generated by: LCOV version 2.0-1