现在出现了一个新问题,现在播放是没有问题了.但是录音的时候我也用的是CALLBACK_THREAD.
waveInOpen(&hWaveIn, WAVE_MAPPER, &waveFormatEx, m_dwAudioInId,0,CALLBACK_THREAD);
BOOL CAudioPlay::StartInThread()
{
hAudioIn=CreateThread(0,0,AudioInThreadProc,this,0,&m_dwAudioInId);
if(!hAudioIn)
{
TRACE("CWaveOut::StartThread: Strat wave in thread fail.\n");
return FALSE;
}
return TRUE;
}
DWORD WINAPI AudioInThreadProc(LPVOID lpParameter)
{
log("AudioInThreadProc start.\n");//输出日志
MSG msg;
while(GetMessage(&msg,0,0,0))
{
log("while start");//输出日志
switch(msg.message )
{
case MM_WIM_OPEN:
TRACE("MM_WIM_OPEN \n");
break;
case MM_WIM_CLOSE:
TRACE("MM_WIM_CLOSE \n");
break;
case MM_WIM_DATA:
WAVEHDR* pWH=(WAVEHDR*)msg.lParam;
waveInUnprepareHeader((HWAVEIN)msg.wParam,pWH,sizeof(WAVEHDR));
log("data");//用来记录日志.
if(pWH->dwBytesRecorded<320)
break;
memcpy(Buffer[In_cur],pWH->lpData,pWH->dwBytesRecorded);
In_cur = ( In_cur +1 ) % MAXINBUFFER;
waveInPrepareHeader((HWAVEIN)msg.wParam,pWH,sizeof(WAVEHDR));
waveInAddBuffer((HWAVEIN)msg.wParam,pWH,sizeof(WAVEHDR));
EnterCriticalSection(&waveInCriticalSection);
In_size++;
LeaveCriticalSection(&waveInCriticalSection);
break;
}
Sleep(1);
}
TRACE("AudioInThreadProc exit.\n");
return msg.wParam;
}
当程序在windows2000 profetinal下运行时没问题,但是在XP下运行时,播放部分没问题.但是录音的线程只有AudioInThreadProc start输出,然后就没有了.怎么回事?有谁可以告诉我?
9 个解决方案
#1
错了,是windows2000 professional
#2
怎么没人回答啊,自己UP
#3
up
#4
waveInOpen调用成功了吗?有没有检查waveInOpen的返回值?
#5
waveInOpen调用成功了啊
#6
getmessage 没有成功吧
#7
那也应该打印AudioInThreadProc exit
或者while start啊
或者while start啊
#8
请高手帮忙啊.或者提供一下你们作录音的时候是怎么做的也行啊.
#9
怎么没人回答啊
#1
错了,是windows2000 professional
#2
怎么没人回答啊,自己UP
#3
up
#4
waveInOpen调用成功了吗?有没有检查waveInOpen的返回值?
#5
waveInOpen调用成功了啊
#6
getmessage 没有成功吧
#7
那也应该打印AudioInThreadProc exit
或者while start啊
或者while start啊
#8
请高手帮忙啊.或者提供一下你们作录音的时候是怎么做的也行啊.
#9
怎么没人回答啊