1 /* 2 * Copyright (c) 2023 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_CHAIN_ADAPTER_H 17 #define AUDIO_EFFECT_CHAIN_ADAPTER_H 18 #ifdef SUPPORT_OLD_ENGINE 19 #include <stdio.h> 20 #include <stdint.h> 21 #include <pulse/pulseaudio.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 typedef struct BufferAttr { 28 float *bufIn; 29 float *bufOut; 30 int samplingRate; 31 int numChanIn; 32 int numChanOut; 33 int frameLen; 34 float *tempBufIn; 35 float *tempBufOut; 36 bool bufOutUsed; 37 uint64_t outChanLayout; 38 } BufferAttr; 39 40 typedef struct SessionInfoPack { 41 const uint32_t channels; 42 const char *channelLayout; 43 const char *sceneMode; 44 const char *spatializationEnabled; 45 const char *streamUsage; 46 const char *systemVolumeType; 47 } SessionInfoPack; 48 49 int32_t EffectChainManagerProcess(char *sceneType, BufferAttr *bufferAttr); 50 bool EffectChainManagerExist(const char *sceneType, const char *effectMode); 51 int32_t EffectChainManagerCreateCb(const char *sceneType, const char *sessionID); 52 int32_t EffectChainManagerReleaseCb(const char *sceneType, const char *sessionID); 53 int32_t EffectChainManagerMultichannelUpdate(const char *sceneType); 54 uint32_t ConvertChLayoutToPaChMap(const uint64_t channelLayout, pa_channel_map *paMap); 55 int32_t EffectChainManagerAddSessionInfo(const char *sceneType, const char *sessionID, SessionInfoPack pack); 56 int32_t EffectChainManagerInitCb(const char *sceneType); 57 bool EffectChainManagerCheckEffectOffload(); 58 int32_t EffectChainManagerDeleteSessionInfo(const char *sceneType, const char *sessionID); 59 int32_t EffectChainManagerReturnEffectChannelInfo(const char *sceneType, uint32_t *channels, uint64_t *channelLayout); 60 int32_t EffectChainManagerReturnMultiChannelInfo(uint32_t *channels, uint64_t *channelLayout); 61 int32_t EffectChainManagerVolumeUpdate(const char *sessionID); 62 void EffectChainManagerEffectUpdate(void); 63 bool EffectChainManagerSceneCheck(const char *sinkSceneType, const char *sceneType); 64 uint32_t EffectChainManagerGetSceneCount(const char *sceneType); 65 void EffectChainManagerStreamUsageUpdate(); 66 int32_t EffectChainManagerQueryHdiSupportedChannelLayout(uint32_t *channels, uint64_t *channelLayout); 67 #ifdef __cplusplus 68 } 69 #endif 70 #endif // SUPPORT_OLD_ENGINE 71 #endif // AUDIO_EFFECT_CHAIN_ADAPTER_H 72