var Form1: TForm1; ms: TMemoryStream; : procedure PlayWaveStream(Stream: TMemoryStream); begin if Stream = nil then sndPlaySound(nil, SND_ASYNC) //stop sound else sndPlaySound(Stream.Memory, (SND_ASYNC or SND_MEMORY)); end; procedure TForm1.Button1Click(Sender: TObject); begin ms.LoadFromFile('c:\Eddie\winner.wav'); ms.Position := 0; PlayWaveStream(ms); end; procedure TForm1.FormCreate(Sender: TObject); begin ms := TMemoryStream.Create; end; procedure TForm1.FormDestroy(Sender: TObject); begin ms.Free; end;
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter