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

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: Move cast_audio.json filepath string to a separate file 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 <memory>
9 #include <vector>
kmackay 2017/06/30 17:59:38 <memory> and <vector> not used. #include <string>
bshaya 2017/07/06 21:04:45 Done.
10
11 #include "base/macros.h"
12 #include "chromecast/media/cma/backend/alsa/slew_volume.h"
13 #include "chromecast/media/cma/backend/alsa/volume_map.h"
14 #include "chromecast/public/media/audio_post_processor_shlib.h"
15
16 namespace chromecast {
17 namespace media {
18
19 // Provides a simple gain, avoiding overflow.
20 class SaturatedGain : public AudioPostProcessor {
21 public:
22 SaturatedGain(const std::string& config, int channels);
23 ~SaturatedGain() override;
24
25 // AudioPostProcessor implementation:
26 bool SetSampleRate(int sample_rate) override;
27 int ProcessFrames(float* data, int frames, float volume) override;
28 int GetRingingTimeInFrames() override;
29
30 private:
31 int channels_;
32 int sample_rate_;
33 float last_volume_;
34 VolumeMap volume_map_;
35 SlewVolume slew_volume_;
36 float gain_;
37
38 DISALLOW_COPY_AND_ASSIGN(SaturatedGain);
39 };
40
41 } // namespace media
42 } // namespace chromecast
43
44 #endif // CHROMECAST_MEDIA_CMA_BACKEND_ALSA_POST_PROCESSORS_SATURATED_GAIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698