1/*
2Copyright 2018 Google Inc. All Rights Reserved.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS-IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#ifndef RESONANCE_AUDIO_GRAPH_GAIN_NODE_H_
18#define RESONANCE_AUDIO_GRAPH_GAIN_NODE_H_
19
20#include <memory>
21#include <vector>
22
23#include "base/audio_buffer.h"
24#include "base/constants_and_types.h"
25#include "base/source_parameters.h"
26#include "dsp/gain_processor.h"
27#include "graph/system_settings.h"
28#include "node/processing_node.h"
29
30namespace vraudio {
31
32// Node that calculates and applies a gain value to each channel of an input
33// buffer based upon the given |GainCalculator|.
34class GainNode : public ProcessingNode {
35 public:
36 // Constructs |GainNode| with given gain attenuation method.
37 //
38 // @param source_id Output buffer source id.
39 // @param num_channels Number of channels in the input buffer.
40 // @param attenuation_type Gain attenuation type to be used.
41 // @param system_settings Global system settings.
42 GainNode(SourceId source_id, size_t num_channels,
43 const AttenuationType& attenuation_type,
44 const SystemSettings& system_settings);
45
46 protected:
47 // Implements ProcessingNode.
48 const AudioBuffer* AudioProcess(const NodeInput& input) override;
49
50 private:
51 // Number of channels of the audio buffer.
52 const size_t num_channels_;
53
54 // Gain attenuation type.
55 const AttenuationType attenuation_type_;
56
57 // Gain processors per each channel.
58 std::vector<GainProcessor> gain_processors_;
59
60 // Global system settings.
61 const SystemSettings& system_settings_;
62
63 // Output buffer.
64 AudioBuffer output_buffer_;
65};
66
67} // namespace vraudio
68
69#endif // RESONANCE_AUDIO_GRAPH_GAIN_NODE_H_
70

source code of qtmultimedia/src/3rdparty/resonance-audio/resonance_audio/graph/gain_node.h