1 /* 2 * Copyright (C) 2004-2010 NXP Software 3 * Copyright (C) 2010 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 #ifndef __MIXER_H__ 19 #define __MIXER_H__ 20 21 #include "LVM_Types.h" 22 23 /********************************************************************************** 24 INSTANCE MEMORY TYPE DEFINITION 25 ***********************************************************************************/ 26 27 typedef struct 28 { 29 LVM_FLOAT Alpha; /* Time constant. Set by calling application. \ 30 Can be changed at any time */ 31 LVM_FLOAT Target; /* Target value. Set by calling application. \ 32 Can be changed at any time */ 33 LVM_FLOAT Current; /* Current value. Set by the mixer function. */ 34 LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application \ 35 each time the target value is updated */ 36 LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */ 37 void *pCallbackHandle; /* Pointer to the instance of the callback function */ 38 void *pGeneralPurpose; /* Pointer for general purpose usage */ 39 LVM_Callback pCallBack; /* Pointer to the callback function */ 40 } Mix_1St_Cll_FLOAT_t; 41 typedef struct 42 { 43 LVM_FLOAT Alpha1; 44 LVM_FLOAT Target1; 45 LVM_FLOAT Current1; 46 LVM_INT16 CallbackSet1; 47 LVM_INT16 CallbackParam1; 48 void *pCallbackHandle1; 49 void *pGeneralPurpose1; 50 LVM_Callback pCallBack1; 51 52 LVM_FLOAT Alpha2; /* Warning the address of this location is passed as a \ 53 pointer to Mix_1St_Cll_t in some functions */ 54 LVM_FLOAT Target2; 55 LVM_FLOAT Current2; 56 LVM_INT16 CallbackSet2; 57 LVM_INT16 CallbackParam2; 58 void *pCallbackHandle2; 59 void *pGeneralPurpose2; 60 LVM_Callback pCallBack2; 61 } Mix_2St_Cll_FLOAT_t; 62 63 /*** General functions ************************************************************/ 64 65 LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc, 66 LVM_UINT32 Fs, 67 LVM_UINT16 NumChannels); 68 69 void MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance, 70 const LVM_FLOAT *src, 71 LVM_FLOAT *dst, 72 LVM_INT16 n); 73 74 void MixSoft_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance, 75 const LVM_FLOAT *src1, 76 const LVM_FLOAT *src2, 77 LVM_FLOAT *dst, 78 LVM_INT16 n); 79 80 void MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance, 81 const LVM_FLOAT *src, 82 LVM_FLOAT *dst, 83 LVM_INT16 n); 84 85 /********************************************************************************** 86 FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS) 87 ***********************************************************************************/ 88 void Core_MixSoft_1St_D32C31_WRA( Mix_1St_Cll_FLOAT_t *pInstance, 89 const LVM_FLOAT *src, 90 LVM_FLOAT *dst, 91 LVM_INT16 n); 92 void Core_MixHard_2St_D32C31_SAT( Mix_2St_Cll_FLOAT_t *pInstance, 93 const LVM_FLOAT *src1, 94 const LVM_FLOAT *src2, 95 LVM_FLOAT *dst, 96 LVM_INT16 n); 97 void Core_MixInSoft_D32C31_SAT( Mix_1St_Cll_FLOAT_t *pInstance, 98 const LVM_FLOAT *src, 99 LVM_FLOAT *dst, 100 LVM_INT16 n); 101 102 /**********************************************************************************/ 103 104 #endif /* __MIXER_H__ */ 105