Chromium Code Reviews| Index: chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h |
| diff --git a/chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h b/chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2419b4c7c054b645d66f48a0d6853f511666f236 |
| --- /dev/null |
| +++ b/chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h |
| @@ -0,0 +1,44 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_ |
| +#define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_ |
| + |
| +#include <memory> |
| +#include <vector> |
|
kmackay
2017/06/30 17:59:38
<memory> and <vector> not used.
#include <string>
bshaya
2017/07/06 21:04:45
Done.
|
| + |
| +#include "base/macros.h" |
| +#include "chromecast/media/cma/backend/alsa/slew_volume.h" |
| +#include "chromecast/media/cma/backend/alsa/volume_map.h" |
| +#include "chromecast/public/media/audio_post_processor_shlib.h" |
| + |
| +namespace chromecast { |
| +namespace media { |
| + |
| +// Provides a simple gain, avoiding overflow. |
| +class SaturatedGain : public AudioPostProcessor { |
| + public: |
| + SaturatedGain(const std::string& config, int channels); |
| + ~SaturatedGain() override; |
| + |
| + // AudioPostProcessor implementation: |
| + bool SetSampleRate(int sample_rate) override; |
| + int ProcessFrames(float* data, int frames, float volume) override; |
| + int GetRingingTimeInFrames() override; |
| + |
| + private: |
| + int channels_; |
| + int sample_rate_; |
| + float last_volume_; |
| + VolumeMap volume_map_; |
| + SlewVolume slew_volume_; |
| + float gain_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SaturatedGain); |
| +}; |
| + |
| +} // namespace media |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_ |