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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ 6 #define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ 7 8 #include "base/basictypes.h" 9 #include "content/common/content_export.h" 10 11 namespace content { 12 13 // Input parameters for the EnergyEndpointer class. 14 class CONTENT_EXPORT EnergyEndpointerParams { 15 public: 16 EnergyEndpointerParams(); 17 18 void SetDefaults(); 19 20 void operator=(const EnergyEndpointerParams& source); 21 22 // Accessors and mutators frame_period()23 float frame_period() const { return frame_period_; } set_frame_period(float frame_period)24 void set_frame_period(float frame_period) { 25 frame_period_ = frame_period; 26 } 27 frame_duration()28 float frame_duration() const { return frame_duration_; } set_frame_duration(float frame_duration)29 void set_frame_duration(float frame_duration) { 30 frame_duration_ = frame_duration; 31 } 32 endpoint_margin()33 float endpoint_margin() const { return endpoint_margin_; } set_endpoint_margin(float endpoint_margin)34 void set_endpoint_margin(float endpoint_margin) { 35 endpoint_margin_ = endpoint_margin; 36 } 37 onset_window()38 float onset_window() const { return onset_window_; } set_onset_window(float onset_window)39 void set_onset_window(float onset_window) { onset_window_ = onset_window; } 40 speech_on_window()41 float speech_on_window() const { return speech_on_window_; } set_speech_on_window(float speech_on_window)42 void set_speech_on_window(float speech_on_window) { 43 speech_on_window_ = speech_on_window; 44 } 45 offset_window()46 float offset_window() const { return offset_window_; } set_offset_window(float offset_window)47 void set_offset_window(float offset_window) { 48 offset_window_ = offset_window; 49 } 50 onset_detect_dur()51 float onset_detect_dur() const { return onset_detect_dur_; } set_onset_detect_dur(float onset_detect_dur)52 void set_onset_detect_dur(float onset_detect_dur) { 53 onset_detect_dur_ = onset_detect_dur; 54 } 55 onset_confirm_dur()56 float onset_confirm_dur() const { return onset_confirm_dur_; } set_onset_confirm_dur(float onset_confirm_dur)57 void set_onset_confirm_dur(float onset_confirm_dur) { 58 onset_confirm_dur_ = onset_confirm_dur; 59 } 60 on_maintain_dur()61 float on_maintain_dur() const { return on_maintain_dur_; } set_on_maintain_dur(float on_maintain_dur)62 void set_on_maintain_dur(float on_maintain_dur) { 63 on_maintain_dur_ = on_maintain_dur; 64 } 65 offset_confirm_dur()66 float offset_confirm_dur() const { return offset_confirm_dur_; } set_offset_confirm_dur(float offset_confirm_dur)67 void set_offset_confirm_dur(float offset_confirm_dur) { 68 offset_confirm_dur_ = offset_confirm_dur; 69 } 70 decision_threshold()71 float decision_threshold() const { return decision_threshold_; } set_decision_threshold(float decision_threshold)72 void set_decision_threshold(float decision_threshold) { 73 decision_threshold_ = decision_threshold; 74 } 75 min_decision_threshold()76 float min_decision_threshold() const { return min_decision_threshold_; } set_min_decision_threshold(float min_decision_threshold)77 void set_min_decision_threshold(float min_decision_threshold) { 78 min_decision_threshold_ = min_decision_threshold; 79 } 80 fast_update_dur()81 float fast_update_dur() const { return fast_update_dur_; } set_fast_update_dur(float fast_update_dur)82 void set_fast_update_dur(float fast_update_dur) { 83 fast_update_dur_ = fast_update_dur; 84 } 85 sample_rate()86 float sample_rate() const { return sample_rate_; } set_sample_rate(float sample_rate)87 void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; } 88 min_fundamental_frequency()89 float min_fundamental_frequency() const { return min_fundamental_frequency_; } set_min_fundamental_frequency(float min_fundamental_frequency)90 void set_min_fundamental_frequency(float min_fundamental_frequency) { 91 min_fundamental_frequency_ = min_fundamental_frequency; 92 } 93 max_fundamental_frequency()94 float max_fundamental_frequency() const { return max_fundamental_frequency_; } set_max_fundamental_frequency(float max_fundamental_frequency)95 void set_max_fundamental_frequency(float max_fundamental_frequency) { 96 max_fundamental_frequency_ = max_fundamental_frequency; 97 } 98 contamination_rejection_period()99 float contamination_rejection_period() const { 100 return contamination_rejection_period_; 101 } set_contamination_rejection_period(float contamination_rejection_period)102 void set_contamination_rejection_period( 103 float contamination_rejection_period) { 104 contamination_rejection_period_ = contamination_rejection_period; 105 } 106 107 private: 108 float frame_period_; // Frame period 109 float frame_duration_; // Window size 110 float onset_window_; // Interval scanned for onset activity 111 float speech_on_window_; // Inverval scanned for ongoing speech 112 float offset_window_; // Interval scanned for offset evidence 113 float offset_confirm_dur_; // Silence duration required to confirm offset 114 float decision_threshold_; // Initial rms detection threshold 115 float min_decision_threshold_; // Minimum rms detection threshold 116 float fast_update_dur_; // Period for initial estimation of levels. 117 float sample_rate_; // Expected sample rate. 118 119 // Time to add on either side of endpoint threshold crossings 120 float endpoint_margin_; 121 // Total dur within onset_window required to enter ONSET state 122 float onset_detect_dur_; 123 // Total on time within onset_window required to enter SPEECH_ON state 124 float onset_confirm_dur_; 125 // Minimum dur in SPEECH_ON state required to maintain ON state 126 float on_maintain_dur_; 127 // Minimum fundamental frequency for autocorrelation. 128 float min_fundamental_frequency_; 129 // Maximum fundamental frequency for autocorrelation. 130 float max_fundamental_frequency_; 131 // Period after start of user input that above threshold values are ignored. 132 // This is to reject audio feedback contamination. 133 float contamination_rejection_period_; 134 }; 135 136 } // namespace content 137 138 #endif // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ 139