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
22#ifdef __cplusplus
23extern "C" {
24#endif /* __cplusplus */
25
26
27#include "LVM_Types.h"
28
29/**********************************************************************************
30   INSTANCE MEMORY TYPE DEFINITION
31***********************************************************************************/
32
33typedef struct
34{
35    LVM_INT32   Alpha;                    /* Time constant. Set by calling application.  Can be changed at any time */
36    LVM_INT32   Target;                   /* Target value.  Set by calling application.  Can be changed at any time */
37    LVM_INT32   Current;                  /* Current value.  Set by the mixer function. */
38    LVM_INT16   CallbackSet;              /* Boolean.  Should be set by calling application each time the target value is updated */
39    LVM_INT16   CallbackParam;            /* Parameter that will be used in the calback function */
40    void        *pCallbackHandle;         /* Pointer to the instance of the callback function */
41    void        *pGeneralPurpose;         /* Pointer for general purpose usage */
42    LVM_Callback pCallBack;               /* Pointer to the callback function */
43} Mix_1St_Cll_t;
44
45typedef struct
46{
47    LVM_INT32   Alpha1;
48    LVM_INT32   Target1;
49    LVM_INT32   Current1;
50    LVM_INT16   CallbackSet1;
51    LVM_INT16   CallbackParam1;
52    void        *pCallbackHandle1;
53    void        *pGeneralPurpose1;
54    LVM_Callback pCallBack1;
55
56    LVM_INT32   Alpha2;                   /* Warning the address of this location is passed as a pointer to Mix_1St_Cll_t in some functions */
57    LVM_INT32   Target2;
58    LVM_INT32   Current2;
59    LVM_INT16   CallbackSet2;
60    LVM_INT16   CallbackParam2;
61    void        *pCallbackHandle2;
62    void        *pGeneralPurpose2;
63    LVM_Callback pCallBack2;
64
65} Mix_2St_Cll_t;
66
67
68/*** General functions ************************************************************/
69
70LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32   tc,
71                                  LVM_UINT16   Fs,
72                                  LVM_UINT16   NumChannels);
73
74
75void MixSoft_1St_D32C31_WRA(    Mix_1St_Cll_t       *pInstance,
76                                const LVM_INT32     *src,
77                                      LVM_INT32     *dst,
78                                      LVM_INT16     n);
79
80void MixSoft_2St_D32C31_SAT(    Mix_2St_Cll_t       *pInstance,
81                                const LVM_INT32     *src1,
82                                const LVM_INT32     *src2,
83                                      LVM_INT32     *dst,
84                                      LVM_INT16     n);
85
86void MixInSoft_D32C31_SAT(      Mix_1St_Cll_t       *pInstance,
87                                const LVM_INT32     *src,
88                                      LVM_INT32     *dst,
89                                      LVM_INT16     n);
90
91/**********************************************************************************
92   FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
93***********************************************************************************/
94
95void Core_MixSoft_1St_D32C31_WRA(   Mix_1St_Cll_t       *pInstance,
96                                    const LVM_INT32     *src,
97                                          LVM_INT32     *dst,
98                                          LVM_INT16     n);
99
100void Core_MixHard_2St_D32C31_SAT(   Mix_2St_Cll_t       *pInstance,
101                                    const LVM_INT32     *src1,
102                                    const LVM_INT32     *src2,
103                                          LVM_INT32     *dst,
104                                          LVM_INT16     n);
105
106void Core_MixInSoft_D32C31_SAT(     Mix_1St_Cll_t       *pInstance,
107                                    const LVM_INT32     *src,
108                                          LVM_INT32     *dst,
109                                          LVM_INT16     n);
110#ifdef __cplusplus
111}
112#endif /* __cplusplus */
113
114
115/**********************************************************************************/
116
117#endif /* __MIXER_H__ */
118
119
120
121
122
123
124
125
126
127
128