by PatD » March 16th, 2007, 4:48 pm
Here's the code :
WAVEFORMATEX sWaveFormat;
TWaveStorage *pWave=NULL;
sWaveFormat.wFormatTag=WAVE_FORMAT_PCM;
sWaveFormat.nChannels=1;
sWaveFormat.nSamplesPerSec=8000;
sWaveFormat.nAvgBytesPerSec=8000;
sWaveFormat.nBlockAlign=8;
sWaveFormat.wBitsPerSample=8;
sWaveFormat.cbSize=sizeof(WAVEFORMATEX);
pWave->Wave->BeginRewrite(&sWaveFormat);
pWave->Wave->Write(pBfr, dwGot);
if (!pWave->Wave->EndRewrite())
Msg(919, "EndRewrite");
if (!pWave->Wave->ConvertToPCM(Mono8Bit8000Hz))
Msg(919, "ConvertToPCM");
pWave->Wave->Seek(0, soFromBeginning);
pWave->Wave->SaveToFile(pszRecordFile);
In WaveStorage.pas, the code is :
function TWave.BeginRewrite(pWaveFormat: PWaveFormatEx): Boolean;
begin
Result := False;
if fIO <> 0 then
begin
fDirty := True;
fIO := CreateStreamWaveAudio(Self, pWaveFormat, fCkRIFF, fCkData);
Result := (fIO <> 0);
end;
end;
I don't see where fIO may be initialized.