blob: a41a13f516f8d4b76b107179643f3bfbd1017e86 [file] [log] [blame]
Alex Loikoe36e8bb2018-02-16 11:54:07 +01001/*
2 * Copyright (c) 2018 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 MODULES_AUDIO_PROCESSING_AGC2_FIXED_GAIN_CONTROLLER_H_
12#define MODULES_AUDIO_PROCESSING_AGC2_FIXED_GAIN_CONTROLLER_H_
13
Alex Loikoa05ee822018-02-20 15:58:36 +010014#include "modules/audio_processing/agc2/gain_curve_applier.h"
Alex Loikoe36e8bb2018-02-16 11:54:07 +010015#include "modules/audio_processing/include/audio_frame_view.h"
16
17namespace webrtc {
18class ApmDataDumper;
19
20class FixedGainController {
21 public:
22 explicit FixedGainController(ApmDataDumper* apm_data_dumper);
Alex Loiko03ad9b82018-08-13 17:40:43 +020023 FixedGainController(ApmDataDumper* apm_data_dumper,
24 std::string histogram_name_prefix);
Alex Loikoe36e8bb2018-02-16 11:54:07 +010025
26 void Process(AudioFrameView<float> signal);
27
Alex Loikoa05ee822018-02-20 15:58:36 +010028 // Rate and gain may be changed at any time (but not concurrently
29 // with any other method call).
Alex Loikoe36e8bb2018-02-16 11:54:07 +010030 void SetGain(float gain_to_apply_db);
31 void SetSampleRate(size_t sample_rate_hz);
Alex Loikoe36e8bb2018-02-16 11:54:07 +010032
33 private:
34 float gain_to_apply_ = 1.f;
Alex Loikoa05ee822018-02-20 15:58:36 +010035 ApmDataDumper* apm_data_dumper_ = nullptr;
36 GainCurveApplier gain_curve_applier_;
Alex Loikoe36e8bb2018-02-16 11:54:07 +010037};
38
39} // namespace webrtc
40
41#endif // MODULES_AUDIO_PROCESSING_AGC2_FIXED_GAIN_CONTROLLER_H_