OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Scale volume with slew rate limiting | 5 // Scale volume with slew rate limiting |
6 | 6 |
7 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_SLEW_VOLUME_H_ | 7 #ifndef CHROMECAST_MEDIA_CMA_BACKEND_ALSA_SLEW_VOLUME_H_ |
8 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_SLEW_VOLUME_H_ | 8 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_SLEW_VOLUME_H_ |
9 | 9 |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // Assumes 1 channel float data that is 16-byte aligned. Smoothly calculates | 31 // Assumes 1 channel float data that is 16-byte aligned. Smoothly calculates |
32 // dest[i] += src[i] * volume_scaling | 32 // dest[i] += src[i] * volume_scaling |
33 // ProcessFMAC will be called once for each channel of audio present and | 33 // ProcessFMAC will be called once for each channel of audio present and |
34 // |repeat_transition| will be true for channels 2 through n. | 34 // |repeat_transition| will be true for channels 2 through n. |
35 void ProcessFMAC(bool repeat_transition, | 35 void ProcessFMAC(bool repeat_transition, |
36 const float* src, | 36 const float* src, |
37 int frames, | 37 int frames, |
38 float* dest); | 38 float* dest); |
39 | 39 |
| 40 // Processes a single channel of float data |
| 41 // dest[i] = src[i] * volume_scaling. |
| 42 // ProcessFMUL will be called once for each channel of audio present. |
| 43 // |repeat_transition| should be true for channels 2 through n. |
40 // Assumes 2 channels. | 44 // Assumes 2 channels. |
| 45 void ProcessFMUL(bool repeat_transition, |
| 46 const float* src, |
| 47 int frames, |
| 48 float* dest); |
| 49 |
41 bool ProcessInterleaved(int32_t* data, int frames); | 50 bool ProcessInterleaved(int32_t* data, int frames); |
42 | 51 |
43 private: | 52 private: |
44 double sample_rate_; | 53 double sample_rate_; |
45 double volume_scale_ = 1.0; | 54 double volume_scale_ = 1.0; |
46 double current_volume_ = 1.0; | 55 double current_volume_ = 1.0; |
47 double last_starting_volume_ = 1.0; | 56 double last_starting_volume_ = 1.0; |
48 double max_slew_time_ms_; | 57 double max_slew_time_ms_; |
49 double max_slew_per_sample_; | 58 double max_slew_per_sample_; |
50 bool interrupted_ = true; | 59 bool interrupted_ = true; |
51 | 60 |
52 DISALLOW_COPY_AND_ASSIGN(SlewVolume); | 61 DISALLOW_COPY_AND_ASSIGN(SlewVolume); |
53 }; | 62 }; |
54 | 63 |
55 } // namespace media | 64 } // namespace media |
56 } // namespace chromecast | 65 } // namespace chromecast |
57 | 66 |
58 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_SLEW_VOLUME_H_ | 67 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_SLEW_VOLUME_H_ |
OLD | NEW |