1788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org/* 2788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 3788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * 4788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * Use of this source code is governed by a BSD-style license 5788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * that can be found in the LICENSE file in the root of the source 6788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * tree. An additional intellectual property rights grant can be found 7788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * in the file PATENTS. All contributing project authors may 8788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org * be found in the AUTHORS file in the root of the source tree. 9788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org */ 10788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 11a33f05e8d7f293b5984b3cd7695eadefd16dcabakjellander@webrtc.org#ifndef WEBRTC_TOOLS_AGC_FAKE_AGC_H_ 12a33f05e8d7f293b5984b3cd7695eadefd16dcabakjellander@webrtc.org#define WEBRTC_TOOLS_AGC_FAKE_AGC_H_ 13788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 14788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org#include "webrtc/modules/audio_processing/agc/agc.h" 15788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 16788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.orgnamespace webrtc { 17788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 18788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.orgclass FakeAgc : public Agc { 19788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org public: 20788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org FakeAgc() 21788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org : counter_(0), 22788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org volume_(kMaxVolume / 2) { 23788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org } 24788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 25788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org virtual int Process(const AudioFrame& audio_frame) { 26788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org const int kUpdateIntervalFrames = 10; 27788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org const int kMaxVolume = 255; 28788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org if (counter_ % kUpdateIntervalFrames == 0) { 29788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org volume_ = (++volume_) % kMaxVolume; 30788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org } 31788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org counter_++; 32788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org return 0; 33788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org } 34788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 35788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org virtual int FakeAgc::MicVolume() { 36788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org return volume_; 37788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org } 38788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 39788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org private: 40788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org int counter_; 41788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org int volume_; 42788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org}; 43788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 44788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org} // namespace webrtc 45788acd17adf6b3d605b5ea66cf394eb81fc086a9pbos@webrtc.org 46a33f05e8d7f293b5984b3cd7695eadefd16dcabakjellander@webrtc.org#endif // WEBRTC_TOOLS_AGC_FAKE_AGC_H_ 47