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#include "graph/buffered_source_node.h"
18
19#include "base/constants_and_types.h"
20#include "base/logging.h"
21
22namespace vraudio {
23
24BufferedSourceNode::BufferedSourceNode(SourceId source_id, size_t num_channels,
25 size_t frames_per_buffer)
26 : source_id_(source_id),
27 input_audio_buffer_(num_channels, frames_per_buffer),
28 new_buffer_flag_(false) {
29 input_audio_buffer_.Clear();
30}
31
32AudioBuffer* BufferedSourceNode::GetMutableAudioBufferAndSetNewBufferFlag() {
33 new_buffer_flag_ = true;
34 return &input_audio_buffer_;
35}
36
37const AudioBuffer* BufferedSourceNode::AudioProcess() {
38 if (!new_buffer_flag_) {
39 return nullptr;
40 }
41 new_buffer_flag_ = false;
42 input_audio_buffer_.set_source_id(source_id_);
43 return &input_audio_buffer_;
44}
45
46} // namespace vraudio
47

source code of qtmultimedia/src/3rdparty/resonance-audio/resonance_audio/graph/buffered_source_node.cc