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/source_parameters_manager.h"
18
19#include "base/logging.h"
20
21namespace vraudio {
22
23void SourceParametersManager::Register(SourceId source_id) {
24 DCHECK(parameters_.find(source_id) == parameters_.end());
25 parameters_[source_id] = SourceParameters();
26}
27
28void SourceParametersManager::Unregister(SourceId source_id) {
29 parameters_.erase(x: source_id);
30}
31
32const SourceParameters* SourceParametersManager::GetParameters(
33 SourceId source_id) const {
34 const auto source_parameters_itr = parameters_.find(x: source_id);
35 if (source_parameters_itr == parameters_.end()) {
36 LOG(ERROR) << "Source " << source_id << " not found";
37 return nullptr;
38 }
39 return &source_parameters_itr->second;
40}
41
42SourceParameters* SourceParametersManager::GetMutableParameters(
43 SourceId source_id) {
44 auto source_parameters_itr = parameters_.find(x: source_id);
45 if (source_parameters_itr == parameters_.end()) {
46 LOG(ERROR) << "Source " << source_id << " not found";
47 return nullptr;
48 }
49 return &source_parameters_itr->second;
50}
51
52void SourceParametersManager::ProcessAllParameters(const Process& process) {
53 for (auto& source_parameters_itr : parameters_) {
54 process(&source_parameters_itr.second);
55 }
56}
57
58} // namespace vraudio
59

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