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

Side by Side Diff: chromecast/media/cma/backend/alsa/post_processors/saturated_gain.h

Issue 2958393002: Add a simple, safe gain PostProcessor. (Closed)
Patch Set: Combine cma/backend/alsa tests into a single target Created 3 years, 5 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
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 CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_
6 #define CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "chromecast/media/cma/backend/alsa/slew_volume.h"
12 #include "chromecast/media/cma/backend/alsa/volume_map.h"
13 #include "chromecast/public/media/audio_post_processor_shlib.h"
14
15 namespace chromecast {
16 namespace media {
17
18 // Provides a simple gain, avoiding overflow.
19 class SaturatedGain : public AudioPostProcessor {
20 public:
21 SaturatedGain(const std::string& config, int channels);
22 ~SaturatedGain() override;
23
24 // AudioPostProcessor implementation:
25 bool SetSampleRate(int sample_rate) override;
26 int ProcessFrames(float* data, int frames, float volume) override;
27 int GetRingingTimeInFrames() override;
28
29 private:
30 int channels_;
31 int sample_rate_;
32 float last_volume_;
33 VolumeMap volume_map_;
34 SlewVolume slew_volume_;
35 float gain_;
36
37 DISALLOW_COPY_AND_ASSIGN(SaturatedGain);
38 };
39
40 } // namespace media
41 } // namespace chromecast
42
43 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698