Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_ | |
| 6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "chromecast/public/media/audio_post_processor_shlib.h" | |
| 13 | |
| 14 namespace chromecast { | |
| 15 namespace media { | |
| 16 | |
| 17 class SlewVolume; | |
| 18 | |
| 19 // Provides a flat reduction in output volume if the input volume is above a | |
| 20 // given threshold. | |
| 21 // Used to protect speakers at high output levels | |
| 22 // while providing dyanmic range at low output level. | |
| 23 // The configuration string for this plugin is: | |
| 24 // {"onset_volume": |VOLUME_TO_CLAMP|, "clamp_multiplier": |CLAMP_MULTIPLIER|} | |
| 25 // Input volumes > |VOLUME_TO_CLAMP| will be attenuated by |CLAMP_MULTIPLIER|. | |
| 26 class Governor : public AudioPostProcessor { | |
| 27 public: | |
| 28 Governor(const std::string& config, int channels); | |
| 29 ~Governor() override; | |
| 30 | |
|
bcf
2017/05/04 03:45:06
// AudioPostProcessor implementation:
Add overrid
bshaya
2017/05/04 18:15:41
Done.
| |
| 31 bool SetSampleRate(int sample_rate) override; | |
| 32 int ProcessFrames(const std::vector<float*>& data, | |
| 33 int frames, | |
| 34 float volume) override; | |
| 35 int GetRingingTimeInFrames() override; | |
| 36 | |
| 37 void SetSlewTimeMsForTest(int slew_time_ms); | |
| 38 | |
| 39 private: | |
| 40 float GetGovernorMultiplier(); | |
| 41 | |
| 42 int channels_; | |
| 43 int sample_rate_; | |
| 44 float volume_; | |
| 45 double onset_volume_; | |
| 46 double clamp_multiplier_; | |
| 47 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.
| |
| 48 DISALLOW_COPY_AND_ASSIGN(Governor); | |
| 49 }; | |
| 50 | |
| 51 } // namespace media | |
| 52 } // namespace chromecast | |
| 53 | |
| 54 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_GOVERNOR_SHLIB_H_ | |
| OLD | NEW |