aec.h
上传用户:gelin96
上传日期:2017-01-08
资源大小:20993k
文件大小:7k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * AEC.h
- *
- * Project:
- * --------
- * Maui META APP
- *
- * Description:
- * ------------
- * Acoustic Echo Cancellation (AEC) calibration in loud speaker mode header
- *
- * Author:
- * -------
- * Andy Ueng (mtk00490)
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * $Revision$
- * $Modtime$
- * $Log$
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- //---------------------------------------------------------------------------
- #ifndef _AEC_H_
- #define _AEC_H_
- #ifndef _AEC_COMMON_H_
- #include "aec_common.h"
- #endif
- #ifndef META_DLL_H
- #include "meta.h"
- #endif
- #ifndef _METAAPP_COMMON_H_
- #include "metaapp_common.h"
- #endif
- #ifndef _SP_COEF_H_
- #include "sp_coef.h"
- #endif
- #ifndef _VOLUME_SETTING_H_
- #include "volume_setting.h"
- #endif
- #ifndef _MAN_HANDLE_H_
- #include "man_handle.h"
- #endif
- #define AEC_BUF_SIZE_2K 2000
- #define AEC_BUF_SIZE_8K 8000
- #define AEC_PLAY_FREQ_NUM 8
- //---------------------------------------------------------------------------
- typedef enum
- {
- AEC_SPEAKER_DAC_SPEECH = 0,
- AEC_SPEAKER_DAC_AUDIO
- }E_AEC_SPEAKER_DAC_TYPE;
- typedef enum
- {
- AEC_MIC_DEVICE_PASSIVE = 0,
- AEC_MIC_DEVICE_ACTIVE
- }E_AEC_MIC_DEVICE_TYPE;
- typedef struct
- {
- E_AEC_TYPE_T e_aec_type;
- E_AUDIO_FIR_VER_T e_audio_param_type;
- bool b_fir_runtime_support;
- bool b_cust_vol_runtime_support;
- bool b_debug;
- bool b_cust_vol_16;
- bool b_drc_support;
- bool b_2k_buffer;
- E_AEC_SPEAKER_DAC_TYPE e_speaker_dac_type;
- E_AEC_MIC_DEVICE_TYPE e_mic_device_type;
- int i_spkgain;
- int i_micgain;
- AnsiString as_audcoeff_default_h;
- AnsiString as_output_speech_fir;
- AnsiString as_volume_gain_file;
- }S_AEC_LS_T;
- typedef struct
- {
- short s_fir_coeffs[45];
- }S_AEC_FIR_T;
- typedef struct
- {
- unsigned short us_common_fir_coeffs[12];
- }S_AEC_COMM_FIR_T;
- //---------------------------------------------------------------------------
- class CAECLS
- {
- private:
- // common
- CMETAHANDLE m_META_HANDLE_Obj;
- E_METAAPP_RESULT_T m_eConfirmState;
- S_AEC_LS_T m_sAEC;
- E_AEC_STEP_T m_eStep;
- calresult m_sResultFir;
- speresult m_sResultSEFir;
- //bool m_bDRCSupport;
- //bool m_bAec2kSupport;
- // FIR
- CSPCOEF m_cSP_COEF_Obj;
- S_FIR_COEFF_T m_sFirCoeff;
- char* m_cpBuf;
- S_AEC_FIR_T m_sAECFir;
- S_AEC_SE_FIR_T m_sAECSeFir;
- // volume setting
- CVOLSET m_cVOL_SET_Obj;
- CustAcousticVol_T m_sCustVol;
- CustAcousticVol16lvl_T m_sCustVolEx;
- int m_iMicGain;
- int m_iSpkGain;
- unsigned short m_usUpDigiGain;
- unsigned short m_usDnDigiGain;
- unsigned short m_usKTGain[3];
- spkgain m_sSpkGain;
- micgain m_sMicGain;
- protected:
- void Confirm(E_METAAPP_RESULT_T confirm_state);
- public:
- void (*ConfirmCallback)(void);
- CAECLS(void);
- ~CAECLS();
- void AllocateDynMemory(void);
- void ReleaseDynMemory(void);
- void REQ_Stop(void);
- void REQ_Finish(void);
- void REQ_TimeOut(void );
- void Req_Start(S_AEC_LS_T s_aec);
- void REQ_Audio_Tone_Loop_Back_Rec(void);
- // NVRAM
- void REQ_Read_FIR_From_NVRAM(void);
- void CNF_ReadFirFromNVRAM(void);
- void REQ_Write_FIR_To_NVRAM(void);
- void CNF_WriteFirToNVRAM(void);
- void REQ_Read_Volume_Setting_From_NVRAM(void);
- void CNF_ReadVolSettingFromNVRAM(void);
- void REQ_Write_Volume_Setting_To_NVRAM(void);
- void CNF_WriteVolSettingToNVRAM(void);
- // runtime setting
- bool REQ_Set_LoudSpk_FIR_Coeffs(short* p_output_coeff);
- bool REQ_Set_LoudSpk_Speech_Enhacement_FIR_Coeffs(unsigned short *p_coeff);
- bool REQ_Set_Speech_Common_And_Mode_FIR_Coeffs(unsigned short *p_comm_coeff, unsigned short *p_mode_coeff);
- // file
- bool REQ_Read_From_File(char *filename, E_AUDIO_FIR_VER_T audio_param_type);
- bool REQ_Write_To_Audcoeff_Default(char *filename, E_AUDIO_FIR_VER_T audio_param_type);
- bool REQ_Write_Record_To_File(char *filename);
- // query
- bool Query_AEC_Support(void);
- bool Query_DRC_Support_Start(void);
- bool Query_DRC_Support(void);
- bool Query_Aec2kSupport_Start(void);
- // global information
- E_METAAPP_RESULT_T Get_ConfirmState(void);
- int Get_MicGain(void);
- int Get_SpkGain(void);
- E_AEC_RESULT_T Get_Result(void);
- };
- /*---------------------------------------------------------------------------*/
- #endif