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_HDI_PARAM_H 17 #define AUDIO_EFFECT_HDI_PARAM_H 18 19 #include <mutex> 20 #include "v1_0/ieffect_model.h" 21 22 const uint32_t SEND_HDI_COMMAND_LEN = 20; 23 24 namespace OHOS { 25 namespace AudioStandard { 26 class AudioEffectHdiParam { 27 public: 28 AudioEffectHdiParam(); 29 ~AudioEffectHdiParam(); 30 void InitHdi(); 31 int32_t UpdateHdiState(int8_t *effectHdiInput); 32 int32_t UpdateHdiState(int8_t *effectHdiInput, DeviceType deviceType); 33 private: 34 static const uint32_t GET_HDI_BUFFER_LEN = 10; 35 void CreateHdiControl(); 36 int8_t input_[SEND_HDI_COMMAND_LEN]; 37 int8_t output_[GET_HDI_BUFFER_LEN]; 38 uint32_t replyLen_; 39 std::string libName_; 40 std::string effectId_; 41 IEffectModel *hdiModel_; 42 std::map<DeviceType, IEffectControl *> DeviceTypeToHdiControlMap_; 43 int32_t SetHdiCommand(IEffectControl *hdiControl, int8_t *effectHdiInput); 44 }; 45 } // namespace AudioStandard 46 } // namespace OHOS 47 #endif // AUDIO_EFFECT_HDI_PARAM_H