Using the Cwavefile class in the DirectX SDK, you can read and write wave files, create a new wave file, and write header and audio data to a file:
Cwavefile *g_pwavefile; WaveFormatEx Wfxinput; ZeroMemory (&wfxinput,sizeof (wfxinput)); Wfxinput.wformattag = WAVE_FORMAT_PCM; Wfxinput.nsamplespersec = 48000; Wfxinput.wbitspersample = 32; Wfxinput.nchannels = 2; Wfxinput.nblockalign = Wfxinput.nchannels * (WFXINPUT.WBITSPERSAMPLE/8); wfxinput.navgbytespersec = wfxinput.nblockalign * WFXINPUT.NSAMPLESPERSEC; G_pwavefile = new Cwavefile; if (FAILED (G_pwavefile->open (L "C:\\users\\administrator\\desktop\\test.wav", &wfxinput,wavefile_write))) { g_pwavefile->close ();} UINT wsize=0; if (FAILED (G_pwavefile->write (Len, Paudiodata, &wsize)) assert (NULL); G_pwavefile->close ();// Do not close the file header does not write to the file
AC qq:1245178753
This address: http://blog.csdn.net/u011417605/article/details/51334003
Write audio data to wave file