content/media/webspeech/recognition/energy_endpointer_params.h

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

michael@0 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
michael@0 2 //
michael@0 3 // Redistribution and use in source and binary forms, with or without
michael@0 4 // modification, are permitted provided that the following conditions are
michael@0 5 // met:
michael@0 6 //
michael@0 7 // * Redistributions of source code must retain the above copyright
michael@0 8 // notice, this list of conditions and the following disclaimer.
michael@0 9 // * Redistributions in binary form must reproduce the above
michael@0 10 // copyright notice, this list of conditions and the following disclaimer
michael@0 11 // in the documentation and/or other materials provided with the
michael@0 12 // distribution.
michael@0 13 // * Neither the name of Google Inc. nor the names of its
michael@0 14 // contributors may be used to endorse or promote products derived from
michael@0 15 // this software without specific prior written permission.
michael@0 16 //
michael@0 17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@0 20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
michael@0 21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@0 22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@0 23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
michael@0 24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
michael@0 25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
michael@0 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
michael@0 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 28
michael@0 29 #ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
michael@0 30 #define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_
michael@0 31
michael@0 32 namespace mozilla {
michael@0 33
michael@0 34 // Input parameters for the EnergyEndpointer class.
michael@0 35 class EnergyEndpointerParams {
michael@0 36 public:
michael@0 37 EnergyEndpointerParams();
michael@0 38
michael@0 39 void SetDefaults();
michael@0 40
michael@0 41 void operator=(const EnergyEndpointerParams& source);
michael@0 42
michael@0 43 // Accessors and mutators
michael@0 44 float frame_period() const { return frame_period_; }
michael@0 45 void set_frame_period(float frame_period) {
michael@0 46 frame_period_ = frame_period;
michael@0 47 }
michael@0 48
michael@0 49 float frame_duration() const { return frame_duration_; }
michael@0 50 void set_frame_duration(float frame_duration) {
michael@0 51 frame_duration_ = frame_duration;
michael@0 52 }
michael@0 53
michael@0 54 float endpoint_margin() const { return endpoint_margin_; }
michael@0 55 void set_endpoint_margin(float endpoint_margin) {
michael@0 56 endpoint_margin_ = endpoint_margin;
michael@0 57 }
michael@0 58
michael@0 59 float onset_window() const { return onset_window_; }
michael@0 60 void set_onset_window(float onset_window) { onset_window_ = onset_window; }
michael@0 61
michael@0 62 float speech_on_window() const { return speech_on_window_; }
michael@0 63 void set_speech_on_window(float speech_on_window) {
michael@0 64 speech_on_window_ = speech_on_window;
michael@0 65 }
michael@0 66
michael@0 67 float offset_window() const { return offset_window_; }
michael@0 68 void set_offset_window(float offset_window) {
michael@0 69 offset_window_ = offset_window;
michael@0 70 }
michael@0 71
michael@0 72 float onset_detect_dur() const { return onset_detect_dur_; }
michael@0 73 void set_onset_detect_dur(float onset_detect_dur) {
michael@0 74 onset_detect_dur_ = onset_detect_dur;
michael@0 75 }
michael@0 76
michael@0 77 float onset_confirm_dur() const { return onset_confirm_dur_; }
michael@0 78 void set_onset_confirm_dur(float onset_confirm_dur) {
michael@0 79 onset_confirm_dur_ = onset_confirm_dur;
michael@0 80 }
michael@0 81
michael@0 82 float on_maintain_dur() const { return on_maintain_dur_; }
michael@0 83 void set_on_maintain_dur(float on_maintain_dur) {
michael@0 84 on_maintain_dur_ = on_maintain_dur;
michael@0 85 }
michael@0 86
michael@0 87 float offset_confirm_dur() const { return offset_confirm_dur_; }
michael@0 88 void set_offset_confirm_dur(float offset_confirm_dur) {
michael@0 89 offset_confirm_dur_ = offset_confirm_dur;
michael@0 90 }
michael@0 91
michael@0 92 float decision_threshold() const { return decision_threshold_; }
michael@0 93 void set_decision_threshold(float decision_threshold) {
michael@0 94 decision_threshold_ = decision_threshold;
michael@0 95 }
michael@0 96
michael@0 97 float min_decision_threshold() const { return min_decision_threshold_; }
michael@0 98 void set_min_decision_threshold(float min_decision_threshold) {
michael@0 99 min_decision_threshold_ = min_decision_threshold;
michael@0 100 }
michael@0 101
michael@0 102 float fast_update_dur() const { return fast_update_dur_; }
michael@0 103 void set_fast_update_dur(float fast_update_dur) {
michael@0 104 fast_update_dur_ = fast_update_dur;
michael@0 105 }
michael@0 106
michael@0 107 float sample_rate() const { return sample_rate_; }
michael@0 108 void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; }
michael@0 109
michael@0 110 float min_fundamental_frequency() const { return min_fundamental_frequency_; }
michael@0 111 void set_min_fundamental_frequency(float min_fundamental_frequency) {
michael@0 112 min_fundamental_frequency_ = min_fundamental_frequency;
michael@0 113 }
michael@0 114
michael@0 115 float max_fundamental_frequency() const { return max_fundamental_frequency_; }
michael@0 116 void set_max_fundamental_frequency(float max_fundamental_frequency) {
michael@0 117 max_fundamental_frequency_ = max_fundamental_frequency;
michael@0 118 }
michael@0 119
michael@0 120 float contamination_rejection_period() const {
michael@0 121 return contamination_rejection_period_;
michael@0 122 }
michael@0 123 void set_contamination_rejection_period(
michael@0 124 float contamination_rejection_period) {
michael@0 125 contamination_rejection_period_ = contamination_rejection_period;
michael@0 126 }
michael@0 127
michael@0 128 private:
michael@0 129 float frame_period_; // Frame period
michael@0 130 float frame_duration_; // Window size
michael@0 131 float onset_window_; // Interval scanned for onset activity
michael@0 132 float speech_on_window_; // Inverval scanned for ongoing speech
michael@0 133 float offset_window_; // Interval scanned for offset evidence
michael@0 134 float offset_confirm_dur_; // Silence duration required to confirm offset
michael@0 135 float decision_threshold_; // Initial rms detection threshold
michael@0 136 float min_decision_threshold_; // Minimum rms detection threshold
michael@0 137 float fast_update_dur_; // Period for initial estimation of levels.
michael@0 138 float sample_rate_; // Expected sample rate.
michael@0 139
michael@0 140 // Time to add on either side of endpoint threshold crossings
michael@0 141 float endpoint_margin_;
michael@0 142 // Total dur within onset_window required to enter ONSET state
michael@0 143 float onset_detect_dur_;
michael@0 144 // Total on time within onset_window required to enter SPEECH_ON state
michael@0 145 float onset_confirm_dur_;
michael@0 146 // Minimum dur in SPEECH_ON state required to maintain ON state
michael@0 147 float on_maintain_dur_;
michael@0 148 // Minimum fundamental frequency for autocorrelation.
michael@0 149 float min_fundamental_frequency_;
michael@0 150 // Maximum fundamental frequency for autocorrelation.
michael@0 151 float max_fundamental_frequency_;
michael@0 152 // Period after start of user input that above threshold values are ignored.
michael@0 153 // This is to reject audio feedback contamination.
michael@0 154 float contamination_rejection_period_;
michael@0 155 };
michael@0 156
michael@0 157 } // namespace mozilla
michael@0 158
michael@0 159 #endif // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_

mercurial