1 | /* |
2 | Copyright 2018 Google Inc. All Rights Reserved. |
3 | |
4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | you may not use this file except in compliance with the License. |
6 | You may obtain a copy of the License at |
7 | |
8 | http://www.apache.org/licenses/LICENSE-2.0 |
9 | |
10 | Unless required by applicable law or agreed to in writing, software |
11 | distributed under the License is distributed on an "AS-IS" BASIS, |
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | See the License for the specific language governing permissions and |
14 | limitations under the License. |
15 | */ |
16 | |
17 | #ifndef RESONANCE_AUDIO_GRAPH_MIXER_NODE_H_ |
18 | #define RESONANCE_AUDIO_GRAPH_MIXER_NODE_H_ |
19 | |
20 | #include "base/audio_buffer.h" |
21 | #include "dsp/mixer.h" |
22 | #include "graph/system_settings.h" |
23 | #include "node/processing_node.h" |
24 | |
25 | namespace vraudio { |
26 | |
27 | // Accepts multiple input buffers and outputs a downmix to a single output |
28 | // buffer. All input buffers must have the same number of channels and the same |
29 | // number of frames per buffer. |
30 | class MixerNode : public ProcessingNode { |
31 | public: |
32 | MixerNode(const SystemSettings& system_settings, size_t num_channels); |
33 | |
34 | // Returns the current output buffer of the mixer. |
35 | // |
36 | // @return Output audio buffer. |
37 | const AudioBuffer* GetOutputBuffer() const; |
38 | |
39 | // Node implementation. |
40 | bool CleanUp() final; |
41 | |
42 | protected: |
43 | // Implements ProcessingNode. |
44 | const AudioBuffer* AudioProcess(const NodeInput& input) override; |
45 | |
46 | private: |
47 | const size_t num_channels_; |
48 | |
49 | Mixer mixer_; |
50 | }; |
51 | |
52 | } // namespace vraudio |
53 | |
54 | #endif // RESONANCE_AUDIO_GRAPH_MIXER_NODE_H_ |
55 | |