Friday, November 23, 2007

CWaveFile Usage

void MyFunc()
{
CWaveFile* g_pWaveFile = NULL;


g_pWaveFile = new CWaveFile;
HRESULT hr = S_OK;
hr = g_pWaveFile->Open(strFileName, &wfxCaptureWaveFormat, WAVEFILE_WRITE ) ;
if(FAILED(hr)
{
OutputDebugString("Error in writing WaveFileHeader");
return;
}

DWORD dwCaptureLength;
UINT dwDataWrote;
VOID* pbCaptureData = NULL;


// Write the data into the wav file
if( FAILED( hr = g_pWaveFile->Write( dwCaptureLength,
(BYTE*)pbCaptureData,
&dwDataWrote ) ) )

return DXTRACE_ERR_MSGBOX( TEXT("Write data to wavFile"), hr );


SAFE_DELETE(g_pWaveFile);

}

Labels: ,

0 Comments:

Post a Comment

<< Home