一个读取PCM文件的例子 TPCMWaveFormat = record wf: TWaveFormat;
wBitsPerSample: Word;
end;
WaveFormat:=new(PPCMwaveFormat);
with WaveFormat^.wf do
begin
WFormatTag := WAVE_FORMAT_PCM;
{PCM format - the only option!} NChannels:=1;
{mono} NSamplesPerSec:=11000;
{11kHz sampling} NAvgBytesPerSec:=11000;
{we aim to use 8 bit sound so only 11k per second} NBlockAlign:=1;
{only one byte in each sample} waveformat^.wBitsPerSample:=8;
{8 bits in each sample} end;
i:=waveOutOpen(nil,0,PWaveFormat(WaveFormat),0,0,WAVE_FORMAT_QUERY);
if i<>0 then
application.messagebox('Error', 'Play format not supported', mb_OK);
i:=waveInOpen(nil,0,PWaveFormat(WaveFormat),0,0,WAVE_FORMAT_QUERY);
if i<>0 then
application.messagebox('Error', 'Record format not supported', mb_OK);