OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/speech/speech_recognizer.h" | 5 #include "content/browser/speech/speech_recognizer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
11 #include "content/browser/speech/audio_buffer.h" | 11 #include "content/browser/speech/audio_buffer.h" |
12 #include "content/browser/speech/google_one_shot_remote_engine.h" | 12 #include "content/browser/speech/google_one_shot_remote_engine.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "content/public/browser/speech_recognition_event_listener.h" | 14 #include "content/public/browser/speech_recognition_event_listener.h" |
15 #include "content/public/common/speech_recognition_error.h" | 15 #include "content/public/common/speech_recognition_error.h" |
16 #include "content/public/common/speech_recognition_grammar.h" | 16 #include "content/public/common/speech_recognition_grammar.h" |
17 #include "content/public/common/speech_recognition_result.h" | 17 #include "content/public/common/speech_recognition_result.h" |
18 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
19 | 19 |
20 using content::BrowserMainLoop; | 20 using content::BrowserMainLoop; |
21 using content::BrowserThread; | 21 using content::BrowserThread; |
22 using content::SpeechRecognitionError; | 22 using content::SpeechRecognitionError; |
23 using content::SpeechRecognitionEventListener; | 23 using content::SpeechRecognitionEventListener; |
24 using content::SpeechRecognitionGrammar; | 24 using content::SpeechRecognitionGrammar; |
25 using content::SpeechRecognitionResult; | 25 using content::SpeechRecognitionResult; |
26 using media::AudioInputController; | 26 using media::AudioInputController; |
27 using media::AudioManager; | 27 using media::AudioManager; |
28 using media::AudioParameters; | 28 using media::AudioParameters; |
| 29 using media::ChannelLayout; |
| 30 using media::CHANNEL_LAYOUT_MONO; |
29 | 31 |
30 namespace { | 32 namespace { |
31 | 33 |
32 // The following constants are related to the volume level indicator shown in | 34 // The following constants are related to the volume level indicator shown in |
33 // the UI for recorded audio. | 35 // the UI for recorded audio. |
34 // Multiplier used when new volume is greater than previous level. | 36 // Multiplier used when new volume is greater than previous level. |
35 const float kUpSmoothingFactor = 1.0f; | 37 const float kUpSmoothingFactor = 1.0f; |
36 // Multiplier used when new volume is lesser than previous level. | 38 // Multiplier used when new volume is lesser than previous level. |
37 const float kDownSmoothingFactor = 0.7f; | 39 const float kDownSmoothingFactor = 0.7f; |
38 // RMS dB value of a maximum (unclipped) sine wave for int16 samples. | 40 // RMS dB value of a maximum (unclipped) sine wave for int16 samples. |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 : event(event_value), | 660 : event(event_value), |
659 audio_error_code(0), | 661 audio_error_code(0), |
660 audio_data(NULL), | 662 audio_data(NULL), |
661 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { | 663 engine_error(content::SPEECH_RECOGNITION_ERROR_NONE) { |
662 } | 664 } |
663 | 665 |
664 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { | 666 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { |
665 } | 667 } |
666 | 668 |
667 } // namespace speech | 669 } // namespace speech |
OLD | NEW |