OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 float noise_volume) = 0; | 75 float noise_volume) = 0; |
76 | 76 |
77 protected: | 77 protected: |
78 virtual ~Delegate() {} | 78 virtual ~Delegate() {} |
79 }; | 79 }; |
80 | 80 |
81 SpeechRecognizer(Delegate* delegate, | 81 SpeechRecognizer(Delegate* delegate, |
82 int caller_id, | 82 int caller_id, |
83 const std::string& language, | 83 const std::string& language, |
84 const std::string& grammar, | 84 const std::string& grammar, |
85 int profanity_filter, | |
Satish
2011/07/21 08:15:03
missed changing this to 'bool censor_results'
gshires
2011/07/21 18:53:12
Done.
| |
85 const std::string& hardware_info, | 86 const std::string& hardware_info, |
86 const std::string& origin_url); | 87 const std::string& origin_url); |
87 virtual ~SpeechRecognizer(); | 88 virtual ~SpeechRecognizer(); |
88 | 89 |
89 // Starts audio recording and does recognition after recording ends. The same | 90 // Starts audio recording and does recognition after recording ends. The same |
90 // SpeechRecognizer instance can be used multiple times for speech recognition | 91 // SpeechRecognizer instance can be used multiple times for speech recognition |
91 // though each recognition request can be made only after the previous one | 92 // though each recognition request can be made only after the previous one |
92 // completes (i.e. after receiving Delegate::DidCompleteRecognition). | 93 // completes (i.e. after receiving Delegate::DidCompleteRecognition). |
93 bool StartRecording(); | 94 bool StartRecording(); |
94 | 95 |
(...skipping 29 matching lines...) Expand all Loading... | |
124 | 125 |
125 void HandleOnError(int error_code); // Handles OnError in the IO thread. | 126 void HandleOnError(int error_code); // Handles OnError in the IO thread. |
126 | 127 |
127 // Handles OnData in the IO thread. Takes ownership of |data|. | 128 // Handles OnData in the IO thread. Takes ownership of |data|. |
128 void HandleOnData(std::string* data); | 129 void HandleOnData(std::string* data); |
129 | 130 |
130 Delegate* delegate_; | 131 Delegate* delegate_; |
131 int caller_id_; | 132 int caller_id_; |
132 std::string language_; | 133 std::string language_; |
133 std::string grammar_; | 134 std::string grammar_; |
135 int profanity_filter_; | |
Satish
2011/07/21 08:15:03
ditto
gshires
2011/07/21 18:53:12
Done.
| |
134 std::string hardware_info_; | 136 std::string hardware_info_; |
135 std::string origin_url_; | 137 std::string origin_url_; |
136 | 138 |
137 scoped_ptr<SpeechRecognitionRequest> request_; | 139 scoped_ptr<SpeechRecognitionRequest> request_; |
138 scoped_refptr<media::AudioInputController> audio_controller_; | 140 scoped_refptr<media::AudioInputController> audio_controller_; |
139 AudioEncoder::Codec codec_; | 141 AudioEncoder::Codec codec_; |
140 scoped_ptr<AudioEncoder> encoder_; | 142 scoped_ptr<AudioEncoder> encoder_; |
141 Endpointer endpointer_; | 143 Endpointer endpointer_; |
142 int num_samples_recorded_; | 144 int num_samples_recorded_; |
143 float audio_level_; | 145 float audio_level_; |
144 | 146 |
145 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); | 147 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); |
146 }; | 148 }; |
147 | 149 |
148 // This typedef is to workaround the issue with certain versions of | 150 // This typedef is to workaround the issue with certain versions of |
149 // Visual Studio where it gets confused between multiple Delegate | 151 // Visual Studio where it gets confused between multiple Delegate |
150 // classes and gives a C2500 error. (I saw this error on the try bots - | 152 // classes and gives a C2500 error. (I saw this error on the try bots - |
151 // the workaround was not needed for my machine). | 153 // the workaround was not needed for my machine). |
152 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; | 154 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; |
153 | 155 |
154 } // namespace speech_input | 156 } // namespace speech_input |
155 | 157 |
156 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 158 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
OLD | NEW |