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_FILTER_H_ | |
6 #define REMOTING_HOST_AUDIO_VOLUME_FILTER_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 AudioVolumeFilter { | |
16 public: | |
17 // See AudioSilenceDetector for the meaning of |silence_threshold|. | |
18 explicit AudioVolumeFilter(int silence_threshold); | |
19 virtual ~AudioVolumeFilter(); | |
20 | |
21 // Adjusts audio samples in |data|. If the samples are silent before applying | |
22 // the volume level or the GetAudioLevel() returns 0, this function returns | |
23 // false. If |frames| is 0, 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]. | |
Sergey Ulanov
2017/05/23 00:02:14
I think it's important to make it clear that this
Hzj_jie
2017/05/23 02:54:27
Done.
| |
31 virtual float GetAudioLevel() = 0; | |
32 | |
33 private: | |
34 AudioSilenceDetector silence_detector_; | |
35 }; | |
36 | |
37 } // namespace remoting | |
38 | |
39 #endif // REMOTING_HOST_AUDIO_VOLUME_FILTER_H_ | |
OLD | NEW |