michael@0: // Copyright (c) 2013 The Chromium Authors. All rights reserved. michael@0: // michael@0: // Redistribution and use in source and binary forms, with or without michael@0: // modification, are permitted provided that the following conditions are michael@0: // met: michael@0: // michael@0: // * Redistributions of source code must retain the above copyright michael@0: // notice, this list of conditions and the following disclaimer. michael@0: // * Redistributions in binary form must reproduce the above michael@0: // copyright notice, this list of conditions and the following disclaimer michael@0: // in the documentation and/or other materials provided with the michael@0: // distribution. michael@0: // * Neither the name of Google Inc. nor the names of its michael@0: // contributors may be used to endorse or promote products derived from michael@0: // this software without specific prior written permission. michael@0: // michael@0: // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS michael@0: // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT michael@0: // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR michael@0: // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT michael@0: // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, michael@0: // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT michael@0: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, michael@0: // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY michael@0: // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT michael@0: // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE michael@0: // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. michael@0: michael@0: #ifndef CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ michael@0: #define CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_ michael@0: michael@0: namespace mozilla { michael@0: michael@0: // Input parameters for the EnergyEndpointer class. michael@0: class EnergyEndpointerParams { michael@0: public: michael@0: EnergyEndpointerParams(); michael@0: michael@0: void SetDefaults(); michael@0: michael@0: void operator=(const EnergyEndpointerParams& source); michael@0: michael@0: // Accessors and mutators michael@0: float frame_period() const { return frame_period_; } michael@0: void set_frame_period(float frame_period) { michael@0: frame_period_ = frame_period; michael@0: } michael@0: michael@0: float frame_duration() const { return frame_duration_; } michael@0: void set_frame_duration(float frame_duration) { michael@0: frame_duration_ = frame_duration; michael@0: } michael@0: michael@0: float endpoint_margin() const { return endpoint_margin_; } michael@0: void set_endpoint_margin(float endpoint_margin) { michael@0: endpoint_margin_ = endpoint_margin; michael@0: } michael@0: michael@0: float onset_window() const { return onset_window_; } michael@0: void set_onset_window(float onset_window) { onset_window_ = onset_window; } michael@0: michael@0: float speech_on_window() const { return speech_on_window_; } michael@0: void set_speech_on_window(float speech_on_window) { michael@0: speech_on_window_ = speech_on_window; michael@0: } michael@0: michael@0: float offset_window() const { return offset_window_; } michael@0: void set_offset_window(float offset_window) { michael@0: offset_window_ = offset_window; michael@0: } michael@0: michael@0: float onset_detect_dur() const { return onset_detect_dur_; } michael@0: void set_onset_detect_dur(float onset_detect_dur) { michael@0: onset_detect_dur_ = onset_detect_dur; michael@0: } michael@0: michael@0: float onset_confirm_dur() const { return onset_confirm_dur_; } michael@0: void set_onset_confirm_dur(float onset_confirm_dur) { michael@0: onset_confirm_dur_ = onset_confirm_dur; michael@0: } michael@0: michael@0: float on_maintain_dur() const { return on_maintain_dur_; } michael@0: void set_on_maintain_dur(float on_maintain_dur) { michael@0: on_maintain_dur_ = on_maintain_dur; michael@0: } michael@0: michael@0: float offset_confirm_dur() const { return offset_confirm_dur_; } michael@0: void set_offset_confirm_dur(float offset_confirm_dur) { michael@0: offset_confirm_dur_ = offset_confirm_dur; michael@0: } michael@0: michael@0: float decision_threshold() const { return decision_threshold_; } michael@0: void set_decision_threshold(float decision_threshold) { michael@0: decision_threshold_ = decision_threshold; michael@0: } michael@0: michael@0: float min_decision_threshold() const { return min_decision_threshold_; } michael@0: void set_min_decision_threshold(float min_decision_threshold) { michael@0: min_decision_threshold_ = min_decision_threshold; michael@0: } michael@0: michael@0: float fast_update_dur() const { return fast_update_dur_; } michael@0: void set_fast_update_dur(float fast_update_dur) { michael@0: fast_update_dur_ = fast_update_dur; michael@0: } michael@0: michael@0: float sample_rate() const { return sample_rate_; } michael@0: void set_sample_rate(float sample_rate) { sample_rate_ = sample_rate; } michael@0: michael@0: float min_fundamental_frequency() const { return min_fundamental_frequency_; } michael@0: void set_min_fundamental_frequency(float min_fundamental_frequency) { michael@0: min_fundamental_frequency_ = min_fundamental_frequency; michael@0: } michael@0: michael@0: float max_fundamental_frequency() const { return max_fundamental_frequency_; } michael@0: void set_max_fundamental_frequency(float max_fundamental_frequency) { michael@0: max_fundamental_frequency_ = max_fundamental_frequency; michael@0: } michael@0: michael@0: float contamination_rejection_period() const { michael@0: return contamination_rejection_period_; michael@0: } michael@0: void set_contamination_rejection_period( michael@0: float contamination_rejection_period) { michael@0: contamination_rejection_period_ = contamination_rejection_period; michael@0: } michael@0: michael@0: private: michael@0: float frame_period_; // Frame period michael@0: float frame_duration_; // Window size michael@0: float onset_window_; // Interval scanned for onset activity michael@0: float speech_on_window_; // Inverval scanned for ongoing speech michael@0: float offset_window_; // Interval scanned for offset evidence michael@0: float offset_confirm_dur_; // Silence duration required to confirm offset michael@0: float decision_threshold_; // Initial rms detection threshold michael@0: float min_decision_threshold_; // Minimum rms detection threshold michael@0: float fast_update_dur_; // Period for initial estimation of levels. michael@0: float sample_rate_; // Expected sample rate. michael@0: michael@0: // Time to add on either side of endpoint threshold crossings michael@0: float endpoint_margin_; michael@0: // Total dur within onset_window required to enter ONSET state michael@0: float onset_detect_dur_; michael@0: // Total on time within onset_window required to enter SPEECH_ON state michael@0: float onset_confirm_dur_; michael@0: // Minimum dur in SPEECH_ON state required to maintain ON state michael@0: float on_maintain_dur_; michael@0: // Minimum fundamental frequency for autocorrelation. michael@0: float min_fundamental_frequency_; michael@0: // Maximum fundamental frequency for autocorrelation. michael@0: float max_fundamental_frequency_; michael@0: // Period after start of user input that above threshold values are ignored. michael@0: // This is to reject audio feedback contamination. michael@0: float contamination_rejection_period_; michael@0: }; michael@0: michael@0: } // namespace mozilla michael@0: michael@0: #endif // CONTENT_BROWSER_SPEECH_ENDPOINTER_ENERGY_ENDPOINTER_PARAMS_H_