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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/test/analog_volume_mapper.h
diff --git a/webrtc/modules/audio_processing/test/analog_volume_mapper.h b/webrtc/modules/audio_processing/test/analog_volume_mapper.h
new file mode 100644
index 0000000000000000000000000000000000000000..738205f506279af0bd89751cab5f0a52430376be
--- /dev/null
+++ b/webrtc/modules/audio_processing/test/analog_volume_mapper.h
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_ANALOG_VOLUME_MAPPER_H_
+#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_ANALOG_VOLUME_MAPPER_H_
+
+#include "webrtc/base/checks.h"
+
+namespace webrtc {
+
+// Class for simulating an analog gain controller controlled by
+// webrtc::GainControl. The class wraps a mapping from the current
+// level to a floating point scaling factor abstracting
+// non-linearities in the gain curve of real analog microphones. The
+// intended mode of operation is to use get_scaling_factor() to apply
+// a gain factor to a signal.
+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
+ public:
+ virtual ~AnalogLevelMapper() = default;
+
+ // As the analog level limits in webrtc::GainControl, |level| must
+ // 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
+ void set_analog_level(int level) {
+ RTC_DCHECK_LE(level_, 65535);
+ RTC_DCHECK_LE(0, level_);
+ level_ = level;
+ }
+
+ virtual int analog_level() const { return level_; }
+
+ virtual float get_scaling_factor() const = 0;
+
+ private:
+ int level_ = 0;
+};
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_ANALOG_VOLUME_MAPPER_H_

Powered by Google App Engine
This is Rietveld 408576698