Save errno for logging before potentially overwriting it.
[chromium-blink-merge.git] / content / browser / speech / endpointer / energy_endpointer_params.h
blob436adce8dc3c627b27a9682a7dfb71d981a13dd3
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.
5 #ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
6 #define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
8 #include "base/basictypes.h"
9 #include "content/common/content_export.h"
11 namespace content {
13 // Input parameters for the EnergyEndpointer class.
14 class CONTENT_EXPORT EnergyEndpointerParams {
15 public:
16 EnergyEndpointerParams();
18 void SetDefaults();
20 void operator=(const EnergyEndpointerParams& source);
22 // Accessors and mutators
23 float frame_period() const { return frame_period_; }
24 void set_frame_period(float frame_period) {
25 frame_period_ = frame_period;
28 float frame_duration() const { return frame_duration_; }
29 void set_frame_duration(float frame_duration) {
30 frame_duration_ = frame_duration;
33 float endpoint_margin() const { return endpoint_margin_; }
34 void set_endpoint_margin(float endpoint_margin) {
35 endpoint_margin_ = endpoint_margin;
38 float onset_window() const { return onset_window_; }
39 void set_onset_window(float onset_window) { onset_window_ = onset_window; }
41 float speech_on_window() const { return speech_on_window_; }
42 void set_speech_on_window(float speech_on_window) {
43 speech_on_window_ = speech_on_window;
46 float offset_window() const { return offset_window_; }
47 void set_offset_window(float offset_window) {
48 offset_window_ = offset_window;
51 float onset_detect_dur() const { return onset_detect_dur_; }
52 void set_onset_detect_dur(float onset_detect_dur) {
53 onset_detect_dur_ = onset_detect_dur;
56 float onset_confirm_dur() const { return onset_confirm_dur_; }
57 void set_onset_confirm_dur(float onset_confirm_dur) {
58 onset_confirm_dur_ = onset_confirm_dur;
61 float on_maintain_dur() const { return on_maintain_dur_; }
62 void set_on_maintain_dur(float on_maintain_dur) {
63 on_maintain_dur_ = on_maintain_dur;
66 float offset_confirm_dur() const { return offset_confirm_dur_; }
67 void set_offset_confirm_dur(float offset_confirm_dur) {
68 offset_confirm_dur_ = offset_confirm_dur;
71 float decision_threshold() const { return decision_threshold_; }
72 void set_decision_threshold(float decision_threshold) {
73 decision_threshold_ = decision_threshold;
76 float min_decision_threshold() const { return min_decision_threshold_; }
77 void set_min_decision_threshold(float min_decision_threshold) {
78 min_decision_threshold_ = min_decision_threshold;
81 float fast_update_dur() const { return fast_update_dur_; }
82 void set_fast_update_dur(float fast_update_dur) {
83 fast_update_dur_ = fast_update_dur;
86 float sample_rate() const { return sample_rate_; }
87 void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; }
89 float min_fundamental_frequency() const { return min_fundamental_frequency_; }
90 void set_min_fundamental_frequency(float min_fundamental_frequency) {
91 min_fundamental_frequency_ = min_fundamental_frequency;
94 float max_fundamental_frequency() const { return max_fundamental_frequency_; }
95 void set_max_fundamental_frequency(float max_fundamental_frequency) {
96 max_fundamental_frequency_ = max_fundamental_frequency;
99 float contamination_rejection_period() const {
100 return contamination_rejection_period_;
102 void set_contamination_rejection_period(
103 float contamination_rejection_period) {
104 contamination_rejection_period_ = contamination_rejection_period;
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.
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_;
136 } // namespace content
138 #endif // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_