1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef AUDIO_EFFECT_VOLUME_H
17 #define AUDIO_EFFECT_VOLUME_H
18 
19 #include <cstdint>
20 #include <map>
21 #include <mutex>
22 
23 namespace OHOS {
24 namespace AudioStandard {
25 
26 class AudioEffectVolume {
27 public:
28     AudioEffectVolume();
29     ~AudioEffectVolume();
30     static std::shared_ptr<AudioEffectVolume> GetInstance();
31     void SetDspVolume(const float volume);
32     float GetDspVolume();
33     void SetSystemVolume(const int32_t systemVolumeType, const float systemVolume);
34     float GetSystemVolume(const int32_t systemVolumeType);
35     void SetStreamVolume(const std::string sessionID, float systemVolume);
36     float GetStreamVolume(const std::string sessionID);
37     int32_t StreamVolumeDelete(const std::string sessionID);
38 private:
39     float dspVolume_ = 1.0f;
40     std::mutex volumeMutex_;
41     std::map<std::string, float> SceneTypeToVolumeMap_;
42     std::map<std::string, float> SessionIDToVolumeMap_;
43     std::map<int32_t, float> SystemVolumeMap_;
44 };
45 }  // namespace AudioStandard
46 }  // namespace OHOS
47 #endif // AUDIO_EFFECT_ROTATION_H