Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1161)

Unified Diff: content/browser/speech/endpointer/energy_endpointer.cc

Issue 6597071: Add a noise indicator to the speech bubble volume indicator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/speech/endpointer/energy_endpointer.cc
diff --git a/content/browser/speech/endpointer/energy_endpointer.cc b/content/browser/speech/endpointer/energy_endpointer.cc
index c806aedd0b5c79eb96b8d349725d9e9e60348593..c7a7ccbeee15d4e7a7fc93bae36825c6c29876cf 100644
--- a/content/browser/speech/endpointer/energy_endpointer.cc
+++ b/content/browser/speech/endpointer/energy_endpointer.cc
@@ -327,12 +327,19 @@ void EnergyEndpointer::ProcessAudioFrame(int64 time_us,
++frame_counter_;
if (rms_out) {
- *rms_out = -120.0;
- if ((noise_level_ > 0.0) && ((rms / noise_level_ ) > 0.000001))
- *rms_out = static_cast<float>(20.0 * log10(rms / noise_level_));
+ *rms_out = -2000.0;
+ if (rms > 1.0e-100)
bulach 2011/03/01 17:39:04 again, it may be nicer to define these magic const
+ *rms_out = 20 * log10(rms);
}
}
+float EnergyEndpointer::GetNoiseLevelDB() const {
+ float levelDB = -2000.0;
+ if (noise_level_ > 1.0e-100)
+ levelDB = 20 * log10(noise_level_);
+ return levelDB;
bulach 2011/03/01 17:39:04 ditto, dB and named constants..
+}
+
void EnergyEndpointer::UpdateLevels(float rms) {
// Update quickly initially. We assume this is noise and that
// speech is 6dB above the noise.

Powered by Google App Engine
This is Rietveld 408576698