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 REMOTING_HOST_AUDIO_VOLUME_APPLIER_H_ | |
6 #define REMOTING_HOST_AUDIO_VOLUME_APPLIER_H_ | |
7 | |
8 #include "remoting/host/audio_silence_detector.h" | |
9 | |
10 namespace remoting { | |
11 | |
12 // A component to modify input audio sample to apply the audio level. This class | |
13 // is used on platforms which returns non-adjusted audio samples, e.g. Windows. | |
14 // This class supports frames with 16 bits per sample only. | |
15 class AudioVolumeApplier { | |
Sergey Ulanov
2017/04/26 19:57:35
AudioVolumeFilter?
Sergey Ulanov
2017/04/26 19:57:36
What's the plan to integrate this class with downm
Hzj_jie
2017/04/28 03:53:34
Done.
Hzj_jie
2017/04/28 03:53:34
IMO, downmixer should be placed out of AudioCaptur
| |
16 public: | |
17 // See AudioSilenceDetector for the meaning of |silence_threshold|. | |
18 explicit AudioVolumeApplier(int silence_threshold); | |
19 virtual ~AudioVolumeApplier(); | |
20 | |
21 // Adjusts audio samples in |data|. If the samples are silent before or after | |
22 // applying the volume level, this function returns false. If |frames| is 0, | |
23 // this function also returns false. | |
24 bool Apply(int16_t* data, size_t frames); | |
25 | |
26 // Updates the sampling rate and channels. | |
27 void Initialize(int sampling_rate, int channels); | |
28 | |
29 protected: | |
30 // Returns the volume level in [0, 1]. | |
31 virtual float GetAudioLevel() = 0; | |
32 | |
33 private: | |
34 bool ApplyVolumeLevel(int16_t* data, size_t frames); | |
35 | |
36 AudioSilenceDetector silence_detector_before_; | |
37 AudioSilenceDetector silence_detector_after_; | |
38 }; | |
39 | |
40 } // namespace remoting | |
41 | |
42 #endif // REMOTING_HOST_AUDIO_VOLUME_APPLIER_H_ | |
OLD | NEW |