• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 class AudioEffectVolume {
26 public:
27     AudioEffectVolume();
28     ~AudioEffectVolume();
29     static std::shared_ptr<AudioEffectVolume> GetInstance();
30     void SetDspVolume(const float volume);
31     float GetDspVolume();
32     void SetSystemVolume(const int32_t systemVolumeType, const float systemVolume);
33     float GetSystemVolume(const int32_t systemVolumeType);
34     void SetStreamVolume(const std::string sessionID, float systemVolume);
35     float GetStreamVolume(const std::string sessionID);
36     int32_t StreamVolumeDelete(const std::string sessionID);
37 private:
38     float dspVolume_ = 1.0f;
39     std::mutex volumeMutex_;
40     std::map<std::string, float> SceneTypeToVolumeMap_;
41     std::map<std::string, float> SessionIDToVolumeMap_;
42     std::map<int32_t, float> SystemVolumeMap_;
43 };
44 }  // namespace AudioStandard
45 }  // namespace OHOS
46 #endif // AUDIO_EFFECT_ROTATION_H