Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: remoting/host/audio_volume_filter.h

Issue 2840773004: [Chromoting] Add AudioVolumeApplier to reduce the complexity and the dependency of kChannels (Closed)
Patch Set: Sync latest changes Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/host/audio_silence_detector.cc ('k') | remoting/host/audio_volume_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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]. This should be a normalized scalar
31 // value: sample values can be simply multiplied by the result of this
32 // function to apply volume.
33 virtual float GetAudioLevel() = 0;
34
35 private:
36 AudioSilenceDetector silence_detector_;
37 };
38
39 } // namespace remoting
40
41 #endif // REMOTING_HOST_AUDIO_VOLUME_FILTER_H_
OLDNEW
« no previous file with comments | « remoting/host/audio_silence_detector.cc ('k') | remoting/host/audio_volume_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698