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 LVM_FLOAT Alpha; /* Time constant. Set by calling application. \ 29 Can be changed at any time */ 30 LVM_FLOAT Target; /* Target value. Set by calling application. \ 31 Can be changed at any time */ 32 LVM_FLOAT Current; /* Current value. Set by the mixer function. */ 33 LVM_INT16 CallbackSet; /* Boolean. Should be set by calling application \ 34 each time the target value is updated */ 35 LVM_INT16 CallbackParam; /* Parameter that will be used in the calback function */ 36 void* pCallbackHandle; /* Pointer to the instance of the callback function */ 37 void* pGeneralPurpose; /* Pointer for general purpose usage */ 38 LVM_Callback pCallBack; /* Pointer to the callback function */ 39 } Mix_1St_Cll_FLOAT_t; 40 typedef struct { 41 LVM_FLOAT Alpha1; 42 LVM_FLOAT Target1; 43 LVM_FLOAT Current1; 44 LVM_INT16 CallbackSet1; 45 LVM_INT16 CallbackParam1; 46 void* pCallbackHandle1; 47 void* pGeneralPurpose1; 48 LVM_Callback pCallBack1; 49 50 LVM_FLOAT Alpha2; /* Warning the address of this location is passed as a \ 51 pointer to Mix_1St_Cll_t in some functions */ 52 LVM_FLOAT Target2; 53 LVM_FLOAT Current2; 54 LVM_INT16 CallbackSet2; 55 LVM_INT16 CallbackParam2; 56 void* pCallbackHandle2; 57 void* pGeneralPurpose2; 58 LVM_Callback pCallBack2; 59 } Mix_2St_Cll_FLOAT_t; 60 61 /*** General functions ************************************************************/ 62 63 LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32 tc, LVM_UINT32 Fs, LVM_UINT16 NumChannels); 64 65 void MixSoft_1St_D32C31_WRA(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst, 66 LVM_INT16 n); 67 68 void MixSoft_2St_D32C31_SAT(Mix_2St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src1, 69 const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n); 70 71 void MixInSoft_D32C31_SAT(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst, 72 LVM_INT16 n); 73 74 /********************************************************************************** 75 FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS) 76 ***********************************************************************************/ 77 void Core_MixSoft_1St_D32C31_WRA(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, 78 LVM_FLOAT* dst, LVM_INT16 n); 79 void Core_MixHard_2St_D32C31_SAT(Mix_2St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src1, 80 const LVM_FLOAT* src2, LVM_FLOAT* dst, LVM_INT16 n); 81 void Core_MixInSoft_D32C31_SAT(Mix_1St_Cll_FLOAT_t* pInstance, const LVM_FLOAT* src, LVM_FLOAT* dst, 82 LVM_INT16 n); 83 84 /**********************************************************************************/ 85 86 #endif /* __MIXER_H__ */ 87