Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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 // Scale volume with slew rate limiting | |
| 6 | |
| 7 #ifndef CHROMECAST_INTERNAL_CHIRP_WAVES_SLEW_VOLUME_H_ | |
|
kmackay
2016/09/14 20:48:15
Change header guard to reflect new location
jyw
2016/09/15 01:12:15
Done.
| |
| 8 #define CHROMECAST_INTERNAL_CHIRP_WAVES_SLEW_VOLUME_H_ | |
| 9 | |
| 10 #include <stdint.h> | |
| 11 | |
| 12 #include "base/macros.h" | |
|
kmackay
2016/09/14 20:48:15
not actually used? Need DISALLOW_COPY_AND_ASSIGN?
jyw
2016/09/15 01:12:15
Done.
| |
| 13 | |
| 14 namespace chromecast { | |
| 15 namespace media { | |
| 16 | |
| 17 class SlewVolume { | |
| 18 public: | |
| 19 SlewVolume(); | |
| 20 SlewVolume(int max_slew_up_ms, int max_slew_down_ms); | |
| 21 ~SlewVolume() = default; | |
| 22 | |
| 23 void SetSampleRate(int sample_rate); | |
| 24 void SetVolume(double volume_scale); | |
| 25 | |
| 26 // Assumes 1 channel float data. Smoothly calculates | |
| 27 // dest[i] += src[i] * volume_scaling | |
| 28 bool ProcessFMAC(const float* src, int frames, float* dest); | |
| 29 | |
| 30 // Assumes 2 channels. | |
| 31 bool ProcessInterleaved(int32_t* data, int frames); | |
| 32 | |
| 33 private: | |
| 34 double volume_scale_ = .1; | |
|
kmackay
2016/09/14 20:48:15
why 0.1 here? seems like both should be set to 1.0
jyw
2016/09/15 01:12:15
Done.
| |
| 35 double current_volume_ = .1; | |
| 36 int max_slew_time_up_ms_; | |
| 37 int max_slew_time_down_ms_; | |
| 38 double max_slew_up_; | |
| 39 double max_slew_down_; | |
| 40 }; | |
| 41 | |
| 42 } // namespace media | |
| 43 } // namespace chromecast | |
| 44 | |
| 45 #endif // CHROMECAST_INTERNAL_CHIRP_WAVES_SLEW_VOLUME_H_ | |
| OLD | NEW |