[audio_core] Move comment relating to DbToScale
9684223aa([audio] Renderer gain ramping) moved the arithmatic that this
comment was relevant to, but left the comment behind.
Test: No functional change.
Change-Id: I5ce9eb3a8ddb526f39fa1fbdbe333e0b90769116
diff --git a/bin/media/audio_core/mixer/gain.cc b/bin/media/audio_core/mixer/gain.cc
index d8e0714..4eb460b 100644
--- a/bin/media/audio_core/mixer/gain.cc
+++ b/bin/media/audio_core/mixer/gain.cc
@@ -163,9 +163,7 @@
} else if (effective_gain_db >= kMaxGainDb) {
combined_gain_scale_ = kMaxScale;
} else {
- // Else, we do need to compute the combined gain-scale. Note: multiply-by-
- // .05 equals divide-by-20 -- and is faster on non-optimized builds. Note:
- // 0.05 must be double (not float), for the precision we require.
+ // Else, we do need to compute the combined gain-scale.
combined_gain_scale_ = DbToScale(effective_gain_db);
}
}
diff --git a/bin/media/audio_core/mixer/gain.h b/bin/media/audio_core/mixer/gain.h
index 3d48a2b..a19ac5a 100644
--- a/bin/media/audio_core/mixer/gain.h
+++ b/bin/media/audio_core/mixer/gain.h
@@ -45,6 +45,9 @@
// Amplitude scale factors are expressed as 32-bit IEEE-754 floating point.
using AScale = float;
+ // Note: multiply-by-.05 equals divide-by-20 -- and is faster on non-optimized
+ // builds. Note: 0.05 must be double (not float), for the precision we
+ // require.
static AScale DbToScale(float gain_db) { return pow(10.0f, gain_db * 0.05); }
static float ScaleToDb(AScale scale) { return std::log10(scale) * 20.0f; }
// Higher-precision (but slower) version currently used only by fidelity tests