发表于:2007-06-13 20:16:00
1楼
我试着写了一些但感觉像是少了些什么,请高手帮小弟瞧一瞧。
#include <cvirte.h>
#include <userint.h>
#include "luyin.h"
#include <ansi_c.h>
#include<windows.h>
#include<mmsystem.h>
static int panelHandle;
int i;
LPWAVEHDR wave[500];
LPWAVEHDR Ptr;
HWAVEIN hWaveIn;
WAVEFORMATEX waveform;
MMRESULT rr ;
main()
{
waveform.wFormatTag=WAVE_FORMAT_PCM;
waveform.nChannels=1;
waveform.nSamplesPerSec=11025;
waveform.nAvgBytesPerSec=11025;
waveform.nBlockAlign=1;
waveform.wBitsPerSample=8;
waveform.cbSize=0;
rr=waveInOpen(&hWaveIn, WAVE_MAPPER, &waveform, 0, 0, CALLBACK_WINDOW);
Ptr=GlobalAlloc (GMEM_FIXED,100* sizeof(WAVEHDR));
waveInPrepareHeader(hWaveIn,Ptr, sizeof(WAVEHDR));
waveInAddBuffer(hWaveIn,Ptr,sizeof(WAVEHDR)) ;
waveInStart (hWaveIn);
waveInStop(hWaveIn);
waveInReset(hWaveIn);
waveInClose(hWaveIn) ;
waveInUnprepareHeader (hWaveIn,Ptr,sizeof(WAVEHDR)) ;
GlobalFree(Ptr);
}