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 #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/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 static const int kAudioSampleRate; | 41 static const int kAudioSampleRate; |
42 static const ChannelLayout kChannelLayout; | 42 static const ChannelLayout kChannelLayout; |
43 static const int kNumBitsPerAudioSample; | 43 static const int kNumBitsPerAudioSample; |
44 static const int kNoSpeechTimeoutMs; | 44 static const int kNoSpeechTimeoutMs; |
45 static const int kEndpointerEstimationTimeMs; | 45 static const int kEndpointerEstimationTimeMs; |
46 | 46 |
47 SpeechRecognizerImpl( | 47 SpeechRecognizerImpl( |
48 content::SpeechRecognitionEventListener* listener, | 48 content::SpeechRecognitionEventListener* listener, |
49 int session_id, | 49 int session_id, |
50 SpeechRecognitionEngine* engine); | 50 SpeechRecognitionEngine* engine); |
51 virtual ~SpeechRecognizerImpl(); | |
52 | 51 |
53 // content::SpeechRecognizer methods. | 52 // content::SpeechRecognizer methods. |
54 virtual void StartRecognition() OVERRIDE; | 53 virtual void StartRecognition() OVERRIDE; |
55 virtual void AbortRecognition() OVERRIDE; | 54 virtual void AbortRecognition() OVERRIDE; |
56 virtual void StopAudioCapture() OVERRIDE; | 55 virtual void StopAudioCapture() OVERRIDE; |
57 virtual bool IsActive() const OVERRIDE; | 56 virtual bool IsActive() const OVERRIDE; |
58 virtual bool IsCapturingAudio() const OVERRIDE; | 57 virtual bool IsCapturingAudio() const OVERRIDE; |
59 const SpeechRecognitionEngine& recognition_engine() const; | 58 const SpeechRecognitionEngine& recognition_engine() const; |
60 | 59 |
| 60 protected: |
| 61 virtual ~SpeechRecognizerImpl(); |
| 62 |
61 private: | 63 private: |
62 friend class SpeechRecognizerImplTest; | 64 friend class SpeechRecognizerImplTest; |
63 | 65 |
64 enum FSMState { | 66 enum FSMState { |
65 STATE_IDLE = 0, | 67 STATE_IDLE = 0, |
66 STATE_STARTING, | 68 STATE_STARTING, |
67 STATE_ESTIMATING_ENVIRONMENT, | 69 STATE_ESTIMATING_ENVIRONMENT, |
68 STATE_WAITING_FOR_SPEECH, | 70 STATE_WAITING_FOR_SPEECH, |
69 STATE_RECOGNIZING, | 71 STATE_RECOGNIZING, |
70 STATE_WAITING_FINAL_RESULT, | 72 STATE_WAITING_FINAL_RESULT, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 float audio_level_; | 157 float audio_level_; |
156 bool is_dispatching_event_; | 158 bool is_dispatching_event_; |
157 FSMState state_; | 159 FSMState state_; |
158 | 160 |
159 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); | 161 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); |
160 }; | 162 }; |
161 | 163 |
162 } // namespace speech | 164 } // namespace speech |
163 | 165 |
164 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 166 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
OLD | NEW |