1 /* 2 * Copyright (C) 2025 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 #ifndef SOUNDPOOL_MANAGER_MULTI_H 16 #define SOUNDPOOL_MANAGER_MULTI_H 17 18 #include <unistd.h> 19 #include <vector> 20 #include "media_log.h" 21 #include "soundpool.h" 22 23 namespace OHOS { 24 namespace Media { 25 class SoundPool; 26 27 class SoundPoolManagerMulti { 28 public: 29 SoundPoolManagerMulti(const SoundPoolManagerMulti&) = delete; 30 SoundPoolManagerMulti& operator = (const SoundPoolManagerMulti&) = delete; 31 ~SoundPoolManagerMulti(); 32 33 static SoundPoolManagerMulti& GetInstance(); 34 int32_t GetSoundPoolInstance(std::shared_ptr<SoundPool>& soundPool); 35 int32_t ReleaseInstance(std::shared_ptr<SoundPool> soundPool); 36 37 private: SoundPoolManagerMulti()38 SoundPoolManagerMulti() {} 39 std::mutex mutex_; 40 std::vector<std::shared_ptr<SoundPool>> soundPools_; 41 }; 42 } // namespace Media 43 } // namespace OHOS 44 #endif // SOUNDPOOL_MANAGER_MULTI_H 45