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_ENHANCE_CHAIN_ADAPTER_H 17 #define AUDIO_ENHANCE_CHAIN_ADAPTER_H 18 #ifdef SUPPORT_OLD_ENGINE 19 #include <stdio.h> 20 #include <stdint.h> 21 #include <pulse/pulseaudio.h> 22 #include <pulse/sample.h> 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 struct DeviceAttrAdapter { 29 uint32_t micRate; 30 uint32_t micChannels; 31 uint32_t micFormat; 32 bool needEc; 33 uint32_t ecRate; 34 uint32_t ecChannels; 35 uint32_t ecFormat; 36 bool needMicRef; 37 uint32_t micRefRate; 38 uint32_t micRefChannels; 39 uint32_t micRefFormat; 40 }; 41 42 int32_t EnhanceChainManagerCreateCb(const uint64_t sceneKeyCode, const struct DeviceAttrAdapter *adapter); 43 int32_t EnhanceChainManagerReleaseCb(const uint64_t sceneKeyCode); 44 bool EnhanceChainManagerExist(const uint64_t sceneKeyCode); 45 int32_t EnhanceChainManagerGetAlgoConfig(const uint64_t sceneKeyCode, pa_sample_spec *micSpec, 46 pa_sample_spec *ecSpec, pa_sample_spec *micRefSpec); 47 bool EnhanceChainManagerIsEmptyEnhanceChain(void); 48 int32_t EnhanceChainManagerInitEnhanceBuffer(void); 49 int32_t CopyToEnhanceBufferAdapter(void *data, uint32_t length); 50 int32_t CopyEcdataToEnhanceBufferAdapter(void *data, uint32_t length); 51 int32_t CopyMicRefdataToEnhanceBufferAdapter(void *data, uint32_t length); 52 int32_t CopyFromEnhanceBufferAdapter(void *data, uint32_t length); 53 int32_t EnhanceChainManagerProcess(const uint64_t sceneKeyCode, uint32_t length); 54 int32_t GetSceneTypeCode(const char *sceneType, uint64_t *sceneTypeCode); 55 int32_t EnhanceChainManagerProcessDefault(const uint32_t captureId, uint32_t length); 56 int32_t EnhanceChainManagerSendInitCommand(void); 57 58 #ifdef __cplusplus 59 } 60 #endif 61 #endif // SUPPORT_OLD_ENGINE 62 #endif // AUDIO_ENHANCE_CHAIN_ADAPTER_H 63