赞
踩
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
{
static double fAngle ;
short * Point=(short *)pBuffer;
int i ;
for (i=0 ; i < OUT_BUFFER_SIZE / (SAMPLE_BITS*CHANNELS/8) ; i++)
{
fAngle += 2 * PI * Freq / SAMPLE_RATE ;
*Point=(short)0x8000 * sin(fAngle);
Point++;
*Point=(short)0x8000 * sin(fAngle);
Point++;
while (fAngle > 2 * PI)
fAngle -= 2 * PI ;
}
}
void CALLBACK waveOutProc(HWAVEOUT hWaveOut, UINT uMsg,DWORD dwInstance, DWORD dwParam1, DWORD dwParam2)
{
PWAVEHDR pWaveHdr=(PWAVEHDR)dwParam1;
static bool isClose=false;
switch (uMsg)
{
case MM_WOM_DONE:
{
if(!isEnd)
{
FillBuffer (pWaveHdr->lpData, iFreq) ;
waveOutWrite (hWaveOut, pWaveHdr, sizeof (WAVEHDR)) ;
iFreq+=10;
printf("freq=%d\n",iFreq);
}
break;
}
case MM_WOM_OPEN:
case MM_WOM_CLOSE:
break;
}
}
void main()
{
LPSTR pBuffer1 = (LPSTR)malloc (OUT_BUFFER_SIZE) ;
LPSTR pBuffer2 = (LPSTR)malloc (OUT_BUFFER_SIZE) ;
WaveHdr1.lpData=pBuffer1;
WaveHdr2.lpData=pBuffer2;
FillBuffer (pBuffer1, iFreq) ;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。