| 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 // The EnergyEndpointer class finds likely speech onset and offset points. | 5 // The EnergyEndpointer class finds likely speech onset and offset points. |
| 6 // | 6 // |
| 7 // The implementation described here is about the simplest possible. | 7 // The implementation described here is about the simplest possible. |
| 8 // It is based on timings of threshold crossings for overall signal | 8 // It is based on timings of threshold crossings for overall signal |
| 9 // RMS. It is suitable for light weight applications. | 9 // RMS. It is suitable for light weight applications. |
| 10 // | 10 // |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void SetUserInputMode(); | 77 void SetUserInputMode(); |
| 78 | 78 |
| 79 // Computes the next input frame and modifies EnergyEndpointer status as | 79 // Computes the next input frame and modifies EnergyEndpointer status as |
| 80 // appropriate based on the computation. | 80 // appropriate based on the computation. |
| 81 void ProcessAudioFrame(int64 time_us, const int16* samples, int num_samples); | 81 void ProcessAudioFrame(int64 time_us, const int16* samples, int num_samples); |
| 82 | 82 |
| 83 // Returns the current state of the EnergyEndpointer and the time | 83 // Returns the current state of the EnergyEndpointer and the time |
| 84 // corresponding to the most recently computed frame. | 84 // corresponding to the most recently computed frame. |
| 85 EpStatus Status(int64* status_time_us) const; | 85 EpStatus Status(int64* status_time_us) const; |
| 86 | 86 |
| 87 bool estimating_environment() const { |
| 88 return estimating_environment_; |
| 89 } |
| 90 |
| 87 private: | 91 private: |
| 88 class HistoryRing; | 92 class HistoryRing; |
| 89 | 93 |
| 90 // Resets the endpointer internal state. If reset_threshold is true, the | 94 // Resets the endpointer internal state. If reset_threshold is true, the |
| 91 // state will be reset completely, including adaptive thresholds and the | 95 // state will be reset completely, including adaptive thresholds and the |
| 92 // removal of all history information. | 96 // removal of all history information. |
| 93 void Restart(bool reset_threshold); | 97 void Restart(bool reset_threshold); |
| 94 | 98 |
| 95 // Update internal speech and noise levels. | 99 // Update internal speech and noise levels. |
| 96 void UpdateLevels(float rms); | 100 void UpdateLevels(float rms); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 // Time when mode switched from environment estimation to user input. This | 139 // Time when mode switched from environment estimation to user input. This |
| 136 // is used to time forced rejection of audio feedback contamination. | 140 // is used to time forced rejection of audio feedback contamination. |
| 137 int64 user_input_start_time_us_; | 141 int64 user_input_start_time_us_; |
| 138 | 142 |
| 139 DISALLOW_COPY_AND_ASSIGN(EnergyEndpointer); | 143 DISALLOW_COPY_AND_ASSIGN(EnergyEndpointer); |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 } // namespace speech_input | 146 } // namespace speech_input |
| 143 | 147 |
| 144 #endif // CHROME_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_H_ | 148 #endif // CHROME_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_H_ |
| OLD | NEW |