| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CHROME_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
| 6 #define CHROME_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 6 #define CHROME_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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 bool StartRecording(); | 87 bool StartRecording(); |
| 88 | 88 |
| 89 // Stops recording audio and starts recognition. | 89 // Stops recording audio and starts recognition. |
| 90 void StopRecording(); | 90 void StopRecording(); |
| 91 | 91 |
| 92 // Stops recording audio and cancels recognition. Any audio recorded so far | 92 // Stops recording audio and cancels recognition. Any audio recorded so far |
| 93 // gets discarded. | 93 // gets discarded. |
| 94 void CancelRecognition(); | 94 void CancelRecognition(); |
| 95 | 95 |
| 96 // AudioInputController::EventHandler methods. | 96 // AudioInputController::EventHandler methods. |
| 97 void OnCreated(media::AudioInputController* controller) { } | 97 virtual void OnCreated(media::AudioInputController* controller) { } |
| 98 void OnRecording(media::AudioInputController* controller) { } | 98 virtual void OnRecording(media::AudioInputController* controller) { } |
| 99 void OnError(media::AudioInputController* controller, int error_code); | 99 virtual void OnError(media::AudioInputController* controller, int error_code); |
| 100 void OnData(media::AudioInputController* controller, const uint8* data, | 100 virtual void OnData(media::AudioInputController* controller, |
| 101 uint32 size); | 101 const uint8* data, |
| 102 uint32 size); |
| 102 | 103 |
| 103 // SpeechRecognitionRequest::Delegate methods. | 104 // SpeechRecognitionRequest::Delegate methods. |
| 104 void SetRecognitionResult(bool error, const SpeechInputResultArray& result); | 105 virtual void SetRecognitionResult(bool error, |
| 106 const SpeechInputResultArray& result); |
| 105 | 107 |
| 106 static const int kAudioSampleRate; | 108 static const int kAudioSampleRate; |
| 107 static const int kAudioPacketIntervalMs; // Duration of each audio packet. | 109 static const int kAudioPacketIntervalMs; // Duration of each audio packet. |
| 108 static const int kNumAudioChannels; | 110 static const int kNumAudioChannels; |
| 109 static const int kNumBitsPerAudioSample; | 111 static const int kNumBitsPerAudioSample; |
| 110 static const int kNoSpeechTimeoutSec; | 112 static const int kNoSpeechTimeoutSec; |
| 111 static const int kEndpointerEstimationTimeMs; | 113 static const int kEndpointerEstimationTimeMs; |
| 112 | 114 |
| 113 private: | 115 private: |
| 114 void ReleaseAudioBuffers(); | 116 void ReleaseAudioBuffers(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 142 | 144 |
| 143 // This typedef is to workaround the issue with certain versions of | 145 // This typedef is to workaround the issue with certain versions of |
| 144 // Visual Studio where it gets confused between multiple Delegate | 146 // Visual Studio where it gets confused between multiple Delegate |
| 145 // classes and gives a C2500 error. (I saw this error on the try bots - | 147 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 146 // the workaround was not needed for my machine). | 148 // the workaround was not needed for my machine). |
| 147 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; | 149 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; |
| 148 | 150 |
| 149 } // namespace speech_input | 151 } // namespace speech_input |
| 150 | 152 |
| 151 #endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 153 #endif // CHROME_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
| OLD | NEW |