关于录音. (0分)

  • 主题发起人 主题发起人 wukw
  • 开始时间 开始时间
W

wukw

Unregistered / Unconfirmed
GUEST, unregistred user!
这里录音没有问题,但是如何得到波形??痛苦啊!!!
BOOL CWaveAudio::Record (void)
{
Close ();
MCI_OPEN_PARMS OpenParms;
OpenParms.lpstrDeviceType = "waveaudio";
OpenParms.lpstrElementName = "";
if (mciSendCommand (NULL, MCI_OPEN, MCI_OPEN_ELEMENT | MCI_OPEN_TYPE | MCI_WAIT, (DWORD)(LPVOID) &OpenParms))
return FALSE;
m_wDeviceID = OpenParms.wDeviceID;
DWORD dwReturn;
char buffer[128];
if (dwReturn = mciSendCommand( m_wDeviceID, MCI_SET, MCI_WAIT |
MCI_WAVE_SET_FORMATTAG |
MCI_WAVE_SET_BITSPERSAMPLE |
MCI_WAVE_SET_CHANNELS |
MCI_WAVE_SET_SAMPLESPERSEC |
MCI_WAVE_SET_AVGBYTESPERSEC |
MCI_WAVE_SET_BLOCKALIGN,
(DWORD)(LPVOID)&m_SetParms))
{
mciGetErrorString(dwReturn, buffer, sizeof(buffer));
MessageBox( NULL, buffer, "MCI_SET",
MB_ICONEXCLAMATION | MB_OK);
}
// start record
MCI_RECORD_PARMS RecordParms;
if (mciSendCommand (m_wDeviceID, MCI_RECORD, NULL, (DWORD)(LPVOID) &RecordParms))
return FALSE;
m_bRecording = TRUE;
m_bOpened = TRUE;
return TRUE;
}
BOOL CWaveAudio::Save (CString Filename)
{
if (!m_bRecording)
return FALSE;
Stop ();
MCI_SAVE_PARMS SaveParms;
SaveParms.lpfilename = (LPCSTR) Filename;
if (mciSendCommand (m_wDeviceID, MCI_SAVE, MCI_SAVE_FILE | MCI_WAIT, (DWORD)(LPVOID) &SaveParms))
return FALSE;
m_bRecording = FALSE;
Load (Filename);
return TRUE;
}
 

Similar threads

I
回复
0
查看
632
import
I
I
回复
0
查看
615
import
I
I
回复
0
查看
602
import
I
I
回复
0
查看
514
import
I
后退
顶部