📄 echo.h
字号:
/* Copyright 1997, ESS Technology, Inc. *//* SCCSID @(#)echo.h 4.16 06/01/04 */ /* * $Log$ *//* * This code is based on sccs get SCCS at 04-16-97 */ #ifndef __ECHO_H__#define __ECHO_H__#define MIC_USE_MACRO#ifndef _COMMON_H_#include "common.h"#endif#ifdef ECHO/************************************************************************ * Exported variables. * ************************************************************************//* * Variables to control vocal assist time. * * This is how vocal assist works: * - We have a counter (echo_hit) that keep track of the MIC status. * - We look at 8.7ms of MIC data. Through some magically formula, we decide * whether someone is singing. * - If we decide that nobody is singing for 8.7ms, we decrement echo_hit. * If we decide that someone is singing during that 8.7ms of data, we * increment echo_hit by 8. * - echo_hit is bounded: -128 <= echo_hit <= 128. * - If (echo_hit > VOC_onthrd) then we'll enable echo. * if (echo_hit < VOC_offthrd) then we'll disable echo. * * Here is how to adjust the amount of time to turn on/off echo: * * - Delay to turn on echo (music only) = (VOC_onthrd - -128)/8 * 8.7ms. * Delay to turn off echo (music+vocal)= (128 - VOC_offthrd) * 8.7ms. * * - Keep in mind that people don't sing continuously, so you probably * don't want to turn off echo too quickly. */GBLDEF (int VOC_onthrd, 50); /* 194ms to turn on echo */GBLDEF (int VOC_offthrd, 10); /* 1.02s to turn off echo */GBLDEF (int MIC_onthrd, 0); /* 34.8ms to out of silent state*/GBLDEF (int MIC_offthrd, 0); /* 34.8ms to into silent state *//****************************************************************************** Exported functions. ******************************************************************************/extern void ECHO_init(void);#ifdef MIC_USE_MACRO#define MIC_clear_buffer(reset_detect) do { \ dram_clear(MIC_start, MIC_end-MIC_start); \ if(reset_detect)MIC_dc_detect_interval = DETECT_INTERVAL; \} while (0)#define MIX_clear_buffer() dram_clear(MIX_start, MIX_end-MIX_start)#define DAE_clear_buffer() dram_clear(DAE_start, DAE_end-DAE_start)#elseextern void MIC_clear_buffer(int);extern void DAE_clear_buffer(void);#endifextern void RVB_init(void);extern void MIC_init(void);extern void MIC_start_take_in(void);extern void MIC_stop_take_in(void);extern void ECHO_main(int);extern void ECHO_mixing(void);extern void MIX_init(void);extern int MIX_out_ready(void);extern void MIX_take_out(void);/****************************************************************************** Exported variables. ******************************************************************************/GBLDEF (int ECHO_rdptr, MIC_start);GBLDEF (int ECHO_wrptr, MIC_start);GBLDEF_0 (int ECHO_cnt, 0); /* Number of times TSK_echo is called */GBLDEF_0 (int ECHO_last_cnt, 0);GBLDEF (int MIC_rdptr, MIC_start);GBLDEF (int MIC_wrptr, MIC_start);GBLDEF_0 (int MIC_filling, 0);GBLDEF (int MIX_rdptr, MIX_start);GBLDEF (int MIX_wrptr, MIX_start);#ifdef DAE_SPATIALGBLDEF (int DAE_wrptr, DAE_start);GBLDEF (int DAE_rdptr, DAE_start);#endif#ifdef REVERBGBLDEF (int RBUF_wrptr, RBUF_start);GBLDEF (int RBUF_size, RBUF_SIZE);GBLDEF (int RBUF_end, RBUF_END);GBLDEF (int RBUF_delay, RBUF_END);#endifGBLDEF_0 (int MIX_out, 0);GBLDEF (int vcx_echo_max_level, 5); /* Can be customized to between 5 and 15 */GBLDEF (int vcx_echo, -1); /* -1 : MIC off i.e. MIC port is disable */ /* 0 : MIC on i.e. analog bypass */ /* >0 : ECHO on */GBLDEF (int ECHO_volume, 16); /* 1 ~ 32 mean 1/16 ~ 32/16 */#ifdef ECHO_ANALOG_BYPASSGBLDEF(int ECHO_analog_bypass, 1); /* Analog bypass from MIC to DAC*/#elseGBLDEF_0 (int ECHO_analog_bypass, 0); /* Digital bypass */#endif#ifdef VCDLCGBLDEF (int ECHO_delay, 13*ECHO_AF); /* ECHO delay buffer length */#elseGBLDEF (int ECHO_delay, 28*ECHO_AF); /* ECHO delay buffer length */ /* (should be less than 30*ECHO_AF) */ /*-----------------------------------*/ /* delay time: ECHO_delay*2 */ /* ------------ (s) */ /* 11025 */ /*-----------------------------------*/#endifGBLDEF_0 (int pcm_not_ready, 0);GBLDEF_0 (int vcx_mic_on, 0);GBLDEF_0 (int MIC_is_turned_on, 0); /* Is MIC on? */GBLDEF (int MIC_dma_reject, 10); /* The counter of DMA rejected */ /* at the beginning of mic on */GBLDEF (int MAX_DMA_REJECT, 10); /* The number of DMA rejected */ /* at the beginning of mic on */ /*------------------------------*/GBLDEF (int DETECT_INTERVAL, 512); /* Treat it as silent in this */ /* interval, the silent time */ /* DETECT_INTERVAL * 48 */ /* is: --------------------- (s)*/ /* 11025 */ /*------------------------------*/#ifdef DSC_SW_DETECT_CENTERGBLDEF_0 (int MIC_got_sample, 0); /* 0: not sample yet * * 1: got sample * * 2: getting sample */#endif#ifdef KARASCGBLDEF_0 (int KSC_mode, 0); /* 0: Kara score defined */ /* 1: Kara score triggered */#elseGBLDEF (int KSC_mode, -1);#endif#ifdef NO_MIXGBLDEF (int MIC_mix, 0);#elseGBLDEF (int MIC_mix, 1);#endifGBLDEF_0 (int KSC_sc, 0); /* The score of karaoke sing */GBLDEF_0 (int KSC_num_frames, 0); /* Total num of frames */GBLDEF_0 (int KSC_sc_frames, 0); /* singing frames */GBLDEF_0 (int KSC_skip_frames, 0);#define RVB_MODE_ON 0x1 /* Reverb mode on */#define RVB_MODE_SUPPRESS 0x2 /* RVB suppress..for game, jpeg */GBLDEF_0 (int RVB_on, 0); /* 0: Reverb mode off */GBLDEF(int mic_sensitivity, 2); /* MIC sensitivity */GBLDEF(int mic_dc_thresh, 0); /* MIC dc threshold value */GBLDEF(int MIC_dc_detect_interval, 40);#define MIC_service() ECHO_main(0);/***************************************************************************** Debugging *****************************************************************************/#ifdef DBG_mixvoid mix_trace(int);#endif#endif /* ECHO */#endif /* __ECHO_H__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -