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 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 } BufferAttr; 38 39 typedef struct SessionInfoPack { 40 const uint32_t channels; 41 const char *channelLayout; 42 const char *sceneMode; 43 const char *spatializationEnabled; 44 const char *streamUsage; 45 const char *systemVolumeType; 46 } SessionInfoPack; 47 48 int32_t EffectChainManagerProcess(char *sceneType, BufferAttr *bufferAttr); 49 bool EffectChainManagerExist(const char *sceneType, const char *effectMode, const char *spatializationEnabled); 50 int32_t EffectChainManagerCreateCb(const char *sceneType, const char *sessionID); 51 int32_t EffectChainManagerReleaseCb(const char *sceneType, const char *sessionID); 52 int32_t EffectChainManagerMultichannelUpdate(const char *sceneType); 53 uint32_t ConvertChLayoutToPaChMap(const uint64_t channelLayout, pa_channel_map *paMap); 54 int32_t EffectChainManagerAddSessionInfo(const char *sceneType, const char *sessionID, SessionInfoPack pack); 55 int32_t EffectChainManagerInitCb(const char *sceneType); 56 bool EffectChainManagerCheckEffectOffload(); 57 int32_t EffectChainManagerDeleteSessionInfo(const char *sceneType, const char *sessionID); 58 int32_t EffectChainManagerReturnEffectChannelInfo(const char *sceneType, uint32_t *channels, uint64_t *channelLayout); 59 int32_t EffectChainManagerReturnMultiChannelInfo(uint32_t *channels, uint64_t *channelLayout); 60 int32_t EffectChainManagerVolumeUpdate(const char *sessionID); 61 bool EffectChainManagerGetSpatializationEnabled(); 62 void EffectChainManagerFlush(void); 63 void EffectChainManagerEffectUpdate(void); 64 bool EffectChainManagerSceneCheck(const char *sinkSceneType, const char *sceneType); 65 void EffectChainManagerStreamUsageUpdate(); 66 #ifdef __cplusplus 67 } 68 #endif 69 #endif // AUDIO_EFFECT_CHAIN_ADAPTER_H 70