tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

energy_endpointer_params.h (6328B)


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