diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 18:38:36 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-01 18:38:36 +0000 |
commit | 3b283d6e8c6285efde6a1a34273a3bdb9061bd44 (patch) | |
tree | 9c221cc4d11dacf4f20e9c05287fde698d6721c6 /chrome/browser/speech/speech_input_bubble.h | |
parent | 229fa74de71e0771f734cc788063515da62f30b4 (diff) | |
download | chromium_src-3b283d6e8c6285efde6a1a34273a3bdb9061bd44.zip chromium_src-3b283d6e8c6285efde6a1a34273a3bdb9061bd44.tar.gz chromium_src-3b283d6e8c6285efde6a1a34273a3bdb9061bd44.tar.bz2 |
Add a noise indicator to the speech bubble volume indicator.
The noise indicator is drawn as a light blue area at the beginning and if there
was clipping that is denoted with a red area at the end of the meter. The noise
level comes from the endpointer -> SpeechRecognizer -> SpeechInputBubbleController -> SpeechInputBubble
hence a bunch of volume setting methods are updated with the new parameter.
I have also added a new utility method to SpeechInputManager to invoke the platform
provided microphone settings UI, this will be used in the next CL which contains
windows, mac and linux specific UI changes.
BUG=69886
TEST=manual, invoke speech input and check the bubble volume indicator to see background noise and clipping.
Review URL: http://codereview.chromium.org/6597071
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76395 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/speech/speech_input_bubble.h')
-rw-r--r-- | chrome/browser/speech/speech_input_bubble.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/chrome/browser/speech/speech_input_bubble.h b/chrome/browser/speech/speech_input_bubble.h index dd5d21b..65e0cf4 100644 --- a/chrome/browser/speech/speech_input_bubble.h +++ b/chrome/browser/speech/speech_input_bubble.h @@ -13,9 +13,11 @@ #include "base/task.h" namespace gfx { +class Canvas; class Rect; } class SkBitmap; +class SkCanvas; class TabContents; // SpeechInputBubble displays a popup info bubble during speech recognition, @@ -96,8 +98,8 @@ class SpeechInputBubble { // |Delegate::InfoBubbleFocusChanged| as well. virtual void Hide() = 0; - // Updates the current captured audio volume displayed on screen. - virtual void SetInputVolume(float volume) = 0; + // Updates and draws the current captured audio volume displayed on screen. + virtual void SetInputVolume(float volume, float noise_volume) = 0; // Returns the TabContents for which this bubble gets displayed. virtual TabContents* tab_contents() = 0; @@ -129,7 +131,7 @@ class SpeechInputBubbleBase : public SpeechInputBubble { virtual void SetRecordingMode(); virtual void SetRecognizingMode(); virtual void SetMessage(const string16& text); - virtual void SetInputVolume(float volume); + virtual void SetInputVolume(float volume, float noise_volume); virtual TabContents* tab_contents(); protected: @@ -152,6 +154,10 @@ class SpeechInputBubbleBase : public SpeechInputBubble { private: void DoRecognizingAnimationStep(); + void DrawVolumeOverlay(SkCanvas* canvas, + const SkBitmap& bitmap, + float volume); + // Task factory used for animation timer. ScopedRunnableMethodFactory<SpeechInputBubbleBase> task_factory_; int animation_step_; // Current index/step of the animation. @@ -167,6 +173,7 @@ class SpeechInputBubbleBase : public SpeechInputBubble { TabContents* tab_contents_; static SkBitmap* mic_full_; // Mic image with full volume. + static SkBitmap* mic_noise_; // Mic image with full noise volume. static SkBitmap* mic_empty_; // Mic image with zero volume. static SkBitmap* mic_mask_; // Gradient mask used by the volume indicator. static SkBitmap* spinner_; // Spinner image for the progress animation. |