blob: f90871744514a8204c714f57f44be5eb6fa0626f [file] [log] [blame]
peahca4cac72016-06-29 22:26:121/*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_PEAK_LEVEL_ESTIMATOR_H_
12#define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_PEAK_LEVEL_ESTIMATOR_H_
13
14#include "webrtc/base/constructormagic.h"
peahc19f3122016-10-07 21:54:1015#include "webrtc/modules/audio_processing/level_controller/level_controller_constants.h"
peahca4cac72016-06-29 22:26:1216#include "webrtc/modules/audio_processing/level_controller/signal_classifier.h"
17
18namespace webrtc {
19
20class PeakLevelEstimator {
21 public:
peahc19f3122016-10-07 21:54:1022 explicit PeakLevelEstimator(float initial_peak_level_dbfs);
peahca4cac72016-06-29 22:26:1223 ~PeakLevelEstimator();
peahc19f3122016-10-07 21:54:1024 void Initialize(float initial_peak_level_dbfs);
peahca4cac72016-06-29 22:26:1225 float Analyze(SignalClassifier::SignalType signal_type,
26 float frame_peak_level);
peahca4cac72016-06-29 22:26:1227 private:
28 float peak_level_;
29 int hold_counter_;
peahb59ff892016-06-30 16:19:3230 bool initialization_phase_;
peahca4cac72016-06-29 22:26:1231
peahc19f3122016-10-07 21:54:1032 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PeakLevelEstimator);
peahca4cac72016-06-29 22:26:1233};
34
35} // namespace webrtc
36
37#endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_PEAK_LEVEL_ESTIMATOR_H_