mirror of
https://github.com/cookiengineer/audacity
synced 2026-03-11 08:56:03 +01:00
Added dB - linear amplitude conversion macros.
This commit is contained in:
@@ -864,7 +864,7 @@ static float ToDB(float v, float range)
|
||||
{
|
||||
double db;
|
||||
if (v > 0)
|
||||
db = 20 * log10(fabs(v));
|
||||
db = LINEAR_TO_DB(fabs(v));
|
||||
else
|
||||
db = -999;
|
||||
return ClipZeroToOne((db + range) / range);
|
||||
@@ -995,7 +995,7 @@ void Meter::OnMeterUpdate(wxTimerEvent & WXUNUSED(event))
|
||||
}
|
||||
else {
|
||||
double decayAmount = mDecayRate * deltaT;
|
||||
double decayFactor = pow(10.0, -decayAmount/20);
|
||||
double decayFactor = DB_TO_LINEAR(-decayAmount);
|
||||
mBar[j].peak = floatMax(msg.peak[j],
|
||||
mBar[j].peak * decayFactor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user