OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (c) 2012 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_TOOLS_AGC_FAKE_AGC_H_ | |
12 #define WEBRTC_TOOLS_AGC_FAKE_AGC_H_ | |
13 | |
14 #include "webrtc/modules/audio_processing/agc/agc.h" | |
15 | |
16 namespace webrtc { | |
17 | |
18 class FakeAgc : public Agc { | |
19 public: | |
20 FakeAgc() | |
21 : counter_(0), | |
22 volume_(kMaxVolume / 2) { | |
23 } | |
24 | |
25 virtual int Process(const AudioFrame& audio_frame) { | |
26 const int kUpdateIntervalFrames = 10; | |
27 const int kMaxVolume = 255; | |
28 if (counter_ % kUpdateIntervalFrames == 0) { | |
29 volume_ = (++volume_) % kMaxVolume; | |
30 } | |
31 counter_++; | |
32 return 0; | |
33 } | |
34 | |
35 virtual int FakeAgc::MicVolume() { | |
36 return volume_; | |
37 } | |
38 | |
39 private: | |
40 int counter_; | |
41 int volume_; | |
42 }; | |
43 | |
44 } // namespace webrtc | |
45 | |
46 #endif // WEBRTC_TOOLS_AGC_FAKE_AGC_H_ | |
OLD | NEW |