| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/browser/speech/endpointer/endpointer.h" | 10 #include "content/browser/speech/endpointer/endpointer.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 static const int kAudioSampleRate; | 34 static const int kAudioSampleRate; |
| 35 static const media::ChannelLayout kChannelLayout; | 35 static const media::ChannelLayout kChannelLayout; |
| 36 static const int kNumBitsPerAudioSample; | 36 static const int kNumBitsPerAudioSample; |
| 37 static const int kNoSpeechTimeoutMs; | 37 static const int kNoSpeechTimeoutMs; |
| 38 static const int kEndpointerEstimationTimeMs; | 38 static const int kEndpointerEstimationTimeMs; |
| 39 | 39 |
| 40 static void SetAudioManagerForTesting(media::AudioManager* audio_manager); | 40 static void SetAudioManagerForTesting(media::AudioManager* audio_manager); |
| 41 | 41 |
| 42 SpeechRecognizerImpl(SpeechRecognitionEventListener* listener, | 42 SpeechRecognizerImpl(SpeechRecognitionEventListener* listener, |
| 43 int session_id, | 43 int session_id, |
| 44 bool is_single_shot, | 44 bool continuous, |
| 45 bool provisional_results, |
| 45 SpeechRecognitionEngine* engine); | 46 SpeechRecognitionEngine* engine); |
| 46 | 47 |
| 47 virtual void StartRecognition(const std::string& device_id) OVERRIDE; | 48 virtual void StartRecognition(const std::string& device_id) OVERRIDE; |
| 48 virtual void AbortRecognition() OVERRIDE; | 49 virtual void AbortRecognition() OVERRIDE; |
| 49 virtual void StopAudioCapture() OVERRIDE; | 50 virtual void StopAudioCapture() OVERRIDE; |
| 50 virtual bool IsActive() const OVERRIDE; | 51 virtual bool IsActive() const OVERRIDE; |
| 51 virtual bool IsCapturingAudio() const OVERRIDE; | 52 virtual bool IsCapturingAudio() const OVERRIDE; |
| 52 const SpeechRecognitionEngine& recognition_engine() const; | 53 const SpeechRecognitionEngine& recognition_engine() const; |
| 53 | 54 |
| 54 private: | 55 private: |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const SpeechRecognitionError& error) OVERRIDE; | 140 const SpeechRecognitionError& error) OVERRIDE; |
| 140 | 141 |
| 141 static media::AudioManager* audio_manager_for_tests_; | 142 static media::AudioManager* audio_manager_for_tests_; |
| 142 | 143 |
| 143 scoped_ptr<SpeechRecognitionEngine> recognition_engine_; | 144 scoped_ptr<SpeechRecognitionEngine> recognition_engine_; |
| 144 Endpointer endpointer_; | 145 Endpointer endpointer_; |
| 145 scoped_refptr<media::AudioInputController> audio_controller_; | 146 scoped_refptr<media::AudioInputController> audio_controller_; |
| 146 int num_samples_recorded_; | 147 int num_samples_recorded_; |
| 147 float audio_level_; | 148 float audio_level_; |
| 148 bool is_dispatching_event_; | 149 bool is_dispatching_event_; |
| 149 bool is_single_shot_; | 150 bool provisional_results_; |
| 150 FSMState state_; | 151 FSMState state_; |
| 151 std::string device_id_; | 152 std::string device_id_; |
| 152 | 153 |
| 153 class OnDataConverter; | 154 class OnDataConverter; |
| 154 | 155 |
| 155 // Converts data between native input format and a WebSpeech specific | 156 // Converts data between native input format and a WebSpeech specific |
| 156 // output format. | 157 // output format. |
| 157 scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; | 158 scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; |
| 158 | 159 |
| 159 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); | 160 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); |
| 160 }; | 161 }; |
| 161 | 162 |
| 162 } // namespace content | 163 } // namespace content |
| 163 | 164 |
| 164 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 165 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| OLD | NEW |