1
0
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:
Steve Daulton
2015-07-24 21:59:34 +01:00
parent da060228eb
commit df8ddde874
16 changed files with 58 additions and 58 deletions

View File

@@ -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);
}