下面是原程式不知你是否能明白:
procedure PlayRecordedCall; //已錄音放音
var
WAVEOUTCAPS: TWAVEOUTCAPS;
hWaveOut1 : HWAVEOUT;
WAVEFORMATEX : TWAVEFORMATEX;
WAVEHDR : TWAVEHDR;
Buffer: PChar;
begin
begin
GetMem(Buffer, Sizeof(WAVEHDR));
WAVEHDR.dwBytesRecorded := BytesRecorded; //BytesRecorded: Global variable
WAVEHDR.dwBufferLength := BytesRecorded;
WAVEHDR.dwFlags := 0;
WAVEHDR.dwLoops := 0;
WaveOutGetDevCaps( 0, @WAVEOUTCAPS, Sizeof( WAVEOUTCAPS) );
WaveOutOpen( @hWaveOut1, 0, @WAVEFORMATEX, 0, 0, CALLBACK_NULL );
WaveOutPrepareHeader( hWaveOut1, @WAVEHDR, Sizeof(WAVEHDR));
waveOutWrite( hWaveOut1, @WAVEHDR, Sizeof(WAVEHDR)); //放音
WaveOutUnPrepareHeader( hWaveOut1, @WAVEHDR, Sizeof(WAVEHDR)); //free data blocks
WaveOutClose(hWaveOut1);
FreeMem(Buffer);
end;