Chromium Code Reviews| Index: chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h |
| diff --git a/chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h b/chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..29ebaccc846fcf93e7c0381b007c8e51e1dc1531 |
| --- /dev/null |
| +++ b/chromecast/media/cma/backend/alsa/post_processors/governor_shlib.h |
| @@ -0,0 +1,54 @@ |
| +// 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_GOVERNOR_SHLIB_H_ |
| +#define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_ |
| + |
| +#include <memory> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "chromecast/public/media/audio_post_processor_shlib.h" |
| + |
| +namespace chromecast { |
| +namespace media { |
| + |
| +class SlewVolume; |
| + |
| +// Provides a flat reduction in output volume if the input volume is above a |
| +// given threshold. |
| +// Used to protect speakers at high output levels |
| +// while providing dyanmic range at low output level. |
| +// The configuration string for this plugin is: |
| +// {"onset_volume": |VOLUME_TO_CLAMP|, "clamp_multiplier": |CLAMP_MULTIPLIER|} |
| +// Input volumes > |VOLUME_TO_CLAMP| will be attenuated by |CLAMP_MULTIPLIER|. |
| +class Governor : public AudioPostProcessor { |
| + public: |
| + Governor(const std::string& config, int channels); |
| + ~Governor() override; |
| + |
|
bcf
2017/05/04 03:45:06
// AudioPostProcessor implementation:
Add overrid
bshaya
2017/05/04 18:15:41
Done.
|
| + bool SetSampleRate(int sample_rate) override; |
| + int ProcessFrames(const std::vector<float*>& data, |
| + int frames, |
| + float volume) override; |
| + int GetRingingTimeInFrames() override; |
| + |
| + void SetSlewTimeMsForTest(int slew_time_ms); |
| + |
| + private: |
| + float GetGovernorMultiplier(); |
| + |
| + int channels_; |
| + int sample_rate_; |
| + float volume_; |
| + double onset_volume_; |
| + double clamp_multiplier_; |
| + std::unique_ptr<SlewVolume> slew_volume_; |
|
bcf
2017/05/04 03:45:06
ptr necessary? Can we just have SlewVolume inside?
bshaya
2017/05/04 18:15:41
Done.
|
| + DISALLOW_COPY_AND_ASSIGN(Governor); |
| +}; |
| + |
| +} // namespace media |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_ |