• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __LVC_MIXER_H__
19 #define __LVC_MIXER_H__
20 
21 #include "LVM_Types.h"
22 
23 /**********************************************************************************
24    INSTANCE MEMORY TYPE DEFINITION
25 ***********************************************************************************/
26 
27 /* LVMixer3_st structure stores Instance parameters for one audio stream */
28 typedef struct {
29     LVM_FLOAT PrivateParams[3]; /* Private Instance params for \
30                                    Audio Stream shift parameter */
31     LVM_INT16 CallbackSet;      /* Boolean.  Should be set by calling application \
32                                    each time the target value is updated */
33     LVM_INT16 CallbackParam;    /* Parameter that will be used in the calback function */
34     void* pCallbackHandle;      /* Pointer to the instance of the callback function */
35     void* pGeneralPurpose;      /* Pointer for general purpose usage */
36     LVM_Callback pCallBack;     /* Pointer to the callback function */
37 } LVMixer3_FLOAT_st;
38 typedef struct {
39     LVMixer3_FLOAT_st MixerStream[1]; /* Instance Params for one Audio Stream */
40 } LVMixer3_1St_FLOAT_st;
41 typedef struct {
42     LVMixer3_FLOAT_st MixerStream[2]; /* Instance Params for two Audio Streams */
43 } LVMixer3_2St_FLOAT_st;
44 /**********************************************************************************
45    FUNCTION PROTOTYPES (HIGH LEVEL FUNCTIONS)
46 ***********************************************************************************/
47 
48 /* Function names should be unique within first 16 characters  */
49 #define LVMixer3_MixSoft_1St_D16C31_SAT LVMixer3_1St_D16C31_SAT_MixSoft
50 #define LVMixer3_MixInSoft_D16C31_SAT LVMixer3_D16C31_SAT_MixInSoft
51 #define LVMixer3_MixSoft_2St_D16C31_SAT LVMixer3_2St_D16C31_SAT_MixSoft
52 #define LVMixer3_MixSoft_3St_D16C31_SAT LVMixer3_3St_D16C31_SAT_MixSoft
53 
54 /*** General functions ************************************************************/
55 
56 /**********************************************************************************/
57 /* This time constant calculation function assumes the mixer will be called with  */
58 /* large block sizes. When the block size is small, especially if less than 4,    */
59 /* then the calculation will give an incorrect value for alpha, see the mixer     */
60 /* documentation for further details.                                             */
61 /* ********************************************************************************/
62 void LVC_Mixer_SetTarget(LVMixer3_FLOAT_st* pStream, LVM_FLOAT TargetGain);
63 LVM_FLOAT LVC_Mixer_GetTarget(LVMixer3_FLOAT_st* pStream);
64 
65 LVM_FLOAT LVC_Mixer_GetCurrent(LVMixer3_FLOAT_st* pStream);
66 
67 void LVC_Mixer_Init(LVMixer3_FLOAT_st* pStream, LVM_FLOAT TargetGain, LVM_FLOAT CurrentGain);
68 
69 void LVC_Mixer_SetTimeConstant(LVMixer3_FLOAT_st* pStream, LVM_INT32 Tc_millisec, LVM_Fs_en Fs,
70                                LVM_INT16 NumChannels);
71 
72 void LVC_Mixer_VarSlope_SetTimeConstant(LVMixer3_FLOAT_st* pStream, LVM_INT32 Tc_millisec,
73                                         LVM_Fs_en Fs, LVM_INT16 NumChannels);
74 
75 /*** 16 bit functions *************************************************************/
76 
77 void LVC_MixSoft_1St_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
78                                 LVM_FLOAT* dst, LVM_INT16 n);
79 void LVC_MixSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
80                                LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
81 
82 void LVC_MixInSoft_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
83                               LVM_FLOAT* dst, LVM_INT16 n);
84 void LVC_MixInSoft_Mc_D16C31_SAT(LVMixer3_1St_FLOAT_st* pInstance, const LVM_FLOAT* src,
85                                  LVM_FLOAT* dst, LVM_INT16 NrFrames, LVM_INT16 NrChannels);
86 
87 void LVC_MixSoft_2St_D16C31_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src1,
88                                 const LVM_FLOAT* src2,
89                                 LVM_FLOAT* dst, /* dst cannot be equal to src2 */
90                                 LVM_INT16 n);
91 void LVC_MixSoft_2Mc_D16C31_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src1,
92                                 const LVM_FLOAT* src2,
93                                 LVM_FLOAT* dst, /* dst cannot be equal to src2 */
94                                 LVM_INT16 NrFrames, LVM_INT16 NrChannels);
95 /**********************************************************************************/
96 /* For applying different gains to Left and right chennals                        */
97 /* MixerStream[0] applies to Left channel                                         */
98 /* MixerStream[1] applies to Right channel                                        */
99 /* Gain values should not be more that 1.0                                        */
100 /**********************************************************************************/
101 void LVC_MixSoft_1St_MC_float_SAT(LVMixer3_2St_FLOAT_st* pInstance, const LVM_FLOAT* src,
102                                   LVM_FLOAT* dst, /* dst can be equal to src */
103                                   LVM_INT16 NrFrames, LVM_INT32 NrChannels, LVM_INT32 ChMask);
104 
105 /**********************************************************************************/
106 
107 #endif  //#ifndef __LVC_MIXER_H__
108