?? tshooklib.cpp
字號:
#include <windows.h>#include <mmsystem.h>#include <speex_preprocess.h>#pragma data_seg("SHARED")struct SpeexPreprocessState *pp = NULL;int nframes = 0;int framesperblock = 0;int framesize = 0;#pragma data_seg()extern "C" {__declspec(dllexport) LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode == HC_ACTION) { MSG *msg = (MSG *) lParam; if (msg->message == MM_WIM_DATA) { WAVEHDR *hdr = (WAVEHDR *) msg->lParam; if ((hdr->dwBufferLength == hdr->dwBytesRecorded) && hdr->lpData) { if (pp == NULL) { int iarg; float farg; framesize = hdr->dwBufferLength / 2; while (framesize >= 512) framesize = framesize / 2; pp = speex_preprocess_state_init(framesize, 22050); framesperblock = hdr->dwBufferLength / (2 * framesize); iarg = 1; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_DENOISE, &iarg); iarg = 1; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_AGC, &iarg); farg=8000; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &farg); iarg = 1; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_VAD, &iarg); iarg = 1; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_DEREVERB, &iarg);/* farg=.4; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_DEREVERB_DECAY, &farg); farg=.3; speex_preprocess_ctl(pp, SPEEX_PREPROCESS_SET_DEREVERB_LEVEL, &farg);*/ } int is_speech=0; for(int n=0;n<framesperblock;n++) if (speex_preprocess(pp, (short *) (hdr->lpData + n*framesize*2), NULL)) is_speech = 1; if (! is_speech) for (int i=0; (i < hdr->dwBufferLength) && (i < hdr->dwBytesRecorded); i++) hdr->lpData[i] = 0; return 0; } } } return CallNextHookEx(NULL, nCode, wParam, lParam);}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -