Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: webrtc/modules/audio_processing/test/analog_volume_mapper.h

Issue 2837553002: First try on a fake analog volume control interface for use in audioproc_f. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 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_TEST_ANALOG_VOLUME_MAPPER_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_ANALOG_VOLUME_MAPPER_H_
13
14 #include "webrtc/base/checks.h"
15
16 namespace webrtc {
17
18 // Class for simulating an analog gain controller controlled by
19 // webrtc::GainControl. The class wraps a mapping from the current
20 // level to a floating point scaling factor abstracting
21 // non-linearities in the gain curve of real analog microphones. The
22 // intended mode of operation is to use get_scaling_factor() to apply
23 // a gain factor to a signal.
24 class AnalogLevelMapper {
AleBzk 2017/04/21 10:35:49 I thought about the class name and personally I'm
peah-webrtc 2017/04/21 12:04:39 I definitely think that this CL should include the
peah-webrtc 2017/04/21 12:04:39 An alternative to an interface would be to have a
aleloi 2017/04/24 11:34:45 Can I make a dependent CL for that after https://c
aleloi 2017/04/24 11:34:45 That makes sense. I've changed into const enum to
25 public:
26 virtual ~AnalogLevelMapper() = default;
27
28 // As the analog level limits in webrtc::GainControl, |level| must
29 // be within [0, 65535].
peah-webrtc 2017/04/21 12:04:39 Is the maximum level really that high, I thought i
aleloi 2017/04/24 11:34:45 In the documentation to set_analog_level_limits it
30 void set_analog_level(int level) {
31 RTC_DCHECK_LE(level_, 65535);
32 RTC_DCHECK_LE(0, level_);
33 level_ = level;
34 }
35
36 virtual int analog_level() const { return level_; }
37
38 virtual float get_scaling_factor() const = 0;
39
40 private:
41 int level_ = 0;
42 };
43 } // namespace webrtc
44
45 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_ANALOG_VOLUME_MAPPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698