Audacity 3.2.0
Functions
anonymous_namespace{CompressorInstance.cpp} Namespace Reference

Functions

DynamicRangeProcessorSettings GetDynamicRangeProcessorSettings (const EffectSettings &settings)
 
auto GetMaxDbIncrease (const float *in, const float *out, size_t blockLen)
 
float GetOutputDb (const CompressorProcessor::FrameStats &stats, const DynamicRangeProcessorSettings &settings)
 

Function Documentation

◆ GetDynamicRangeProcessorSettings()

DynamicRangeProcessorSettings anonymous_namespace{CompressorInstance.cpp}::GetDynamicRangeProcessorSettings ( const EffectSettings settings)

Definition at line 78 of file CompressorInstance.cpp.

79{
80 if (auto pSettings = settings.cast<CompressorSettings>())
81 return *pSettings;
82 return *settings.cast<LimiterSettings>();
83}
static Settings & settings()
Definition: TrackInfo.cpp:51

References settings().

Referenced by CompressorInstance::GetLatency(), CompressorInstance::InstanceInit(), and CompressorInstance::InstanceProcess().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMaxDbIncrease()

auto anonymous_namespace{CompressorInstance.cpp}::GetMaxDbIncrease ( const float *  in,
const float *  out,
size_t  blockLen 
)

Definition at line 85 of file CompressorInstance.cpp.

86{
87 auto leastRatio = 0.f;
88 for (size_t i = 0; i < blockLen; ++i)
89 {
90 const auto absIn = std::abs(in[i]);
91 if (absIn < 1e-6)
92 continue;
93 leastRatio = std::max(std::abs(out[i]) / absIn, leastRatio);
94 }
95 return leastRatio == 0 ? -std::numeric_limits<float>::infinity() :
96 log2ToDb * FastLog2(leastRatio);
97}
constexpr float FastLog2(float x)
Approximates the base-2 logarithm of a float to two decimal places, adapted from https://stackoverflo...
Definition: MathApprox.h:32
static constexpr float log2ToDb
Definition: MathApprox.h:46

References FastLog2(), and log2ToDb.

Here is the call graph for this function:

◆ GetOutputDb()

float anonymous_namespace{CompressorInstance.cpp}::GetOutputDb ( const CompressorProcessor::FrameStats stats,
const DynamicRangeProcessorSettings settings 
)

Definition at line 147 of file CompressorInstance.cpp.

150{
151 return stats.maxInputSampleDb + stats.dbGainOfMaxInputSample +
153}
static float GetMakeupGainDb(const DynamicRangeProcessorSettings &settings)

References CompressorProcessor::FrameStats::dbGainOfMaxInputSample, CompressorProcessor::GetMakeupGainDb(), CompressorProcessor::FrameStats::maxInputSampleDb, and settings().

Referenced by CompressorInstance::RealtimeProcess().

Here is the call graph for this function:
Here is the caller graph for this function: