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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 bool StartRecording(); | 98 bool StartRecording(); |
99 | 99 |
100 // Stops recording audio and starts recognition. | 100 // Stops recording audio and starts recognition. |
101 void StopRecording(); | 101 void StopRecording(); |
102 | 102 |
103 // Stops recording audio and cancels recognition. Any audio recorded so far | 103 // Stops recording audio and cancels recognition. Any audio recorded so far |
104 // gets discarded. | 104 // gets discarded. |
105 void CancelRecognition(); | 105 void CancelRecognition(); |
106 | 106 |
107 // AudioInputController::EventHandler methods. | 107 // AudioInputController::EventHandler methods. |
108 virtual void OnCreated(media::AudioInputController* controller) { } | 108 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE { } |
109 virtual void OnRecording(media::AudioInputController* controller) { } | 109 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE { } |
110 virtual void OnError(media::AudioInputController* controller, int error_code); | 110 virtual void OnError(media::AudioInputController* controller, |
| 111 int error_code) OVERRIDE; |
111 virtual void OnData(media::AudioInputController* controller, | 112 virtual void OnData(media::AudioInputController* controller, |
112 const uint8* data, | 113 const uint8* data, |
113 uint32 size); | 114 uint32 size) OVERRIDE; |
114 | 115 |
115 // SpeechRecognitionRequest::Delegate methods. | 116 // SpeechRecognitionRequest::Delegate methods. |
116 virtual void SetRecognitionResult(const SpeechInputResult& result); | 117 virtual void SetRecognitionResult(const SpeechInputResult& result) OVERRIDE; |
117 | 118 |
118 static const int kAudioSampleRate; | 119 static const int kAudioSampleRate; |
119 static const int kAudioPacketIntervalMs; // Duration of each audio packet. | 120 static const int kAudioPacketIntervalMs; // Duration of each audio packet. |
120 static const ChannelLayout kChannelLayout; | 121 static const ChannelLayout kChannelLayout; |
121 static const int kNumBitsPerAudioSample; | 122 static const int kNumBitsPerAudioSample; |
122 static const int kNoSpeechTimeoutSec; | 123 static const int kNoSpeechTimeoutSec; |
123 static const int kEndpointerEstimationTimeMs; | 124 static const int kEndpointerEstimationTimeMs; |
124 | 125 |
125 private: | 126 private: |
126 void InformErrorAndCancelRecognition(SpeechInputError error); | 127 void InformErrorAndCancelRecognition(SpeechInputError error); |
(...skipping 26 matching lines...) Expand all Loading... |
153 | 154 |
154 // This typedef is to workaround the issue with certain versions of | 155 // This typedef is to workaround the issue with certain versions of |
155 // Visual Studio where it gets confused between multiple Delegate | 156 // Visual Studio where it gets confused between multiple Delegate |
156 // classes and gives a C2500 error. (I saw this error on the try bots - | 157 // classes and gives a C2500 error. (I saw this error on the try bots - |
157 // the workaround was not needed for my machine). | 158 // the workaround was not needed for my machine). |
158 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; | 159 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; |
159 | 160 |
160 } // namespace speech_input | 161 } // namespace speech_input |
161 | 162 |
162 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 163 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
OLD | NEW |