📄 dtmf.h
字号:
#define FRAME_SIZE 160
#define MAX_LOOPS 160 //max count for DFT loops
#define THR_SIG 2000 // 2800 //threshold for tone (-23dB) :YDN-065
#define THR_PAU 600 // 400 //threshold for pause energy
#define THR_TWI1 (800*32768/10000) //threshold for twist (-10dB) : <<YDN-065(-6dB)>>
#define THR_TWI2 (800*32768/10000) //threshold for twist (-10dB) : <<YDN-065(-6dB)>>
#define THR_ROWREL (5000*32768/10000) //threshold for row's relative peak ratio
#define THR_COLREL (5000*32768/10000) //threshold for col's relative peak ratio
//#define THR_ROW2nd (200*32768/10000) //threshold for row's 2nd harmonic ratio
//#define THR_COL2nd (200*32768/10000) //threshold for col's 2nd harmonic ratio
#define PAUSE_TIME 1
#define GAIN_THR 0x0060*FRAME_SIZE //gain control threshold
#define GAINBUF_LEN (32)
#define TAPS_LEN (8*2)
#define ENERGY_LEN (8)
#define DTMF_NUMBERS (16)
#define ALAW
//#define DEBUG
#ifndef bool
#define bool int
#endif
#ifndef true
#define true 1
#endif
#ifndef false
#define false 0
#endif
typedef struct
{
int goertzelCnt;
unsigned short digitLast;
int pauseCnt;
// short *pOldSample;
// short gainBuf[GAINBUF_LEN];
short taps[TAPS_LEN];
short energy[ENERGY_LEN];
} DTMFDet_t;
bool dtmfDet(short *linearCode, unsigned short* pNum);
static inline short MUL_S16_S16(short x, short y);
static short DIV_S16_S16(short x, short y);
static void init(DTMFDet_t *pTab);
static void gaincrtl(short *pSample);
static void goertzel(short x, DTMFDet_t *pTab);
static void getEnergy(DTMFDet_t *pTab);
static void maxSearch(short *rowMax, short *colMax, short *rowMax2, short *colMax2, unsigned short *row, unsigned short *col, DTMFDet_t *pTab);
static bool strengthCheck(short rowMax, short colMax, DTMFDet_t *pTab);
static bool twistCheck(short rowMax, short colMax);
static bool relCheck(short rowMax, short colMax, short rowMax2, short colMax2);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -