Playing a wav file without TMediaPlayer

简介:
As you know ,to play a WAV sound, you can use a TMediaPlayer object. 
This article shows that how can playing a wav file without TMediaplayer. 
-------- 
declared in the mmsystem unit 
........ 
function PlayWav(const FileName: string): Boolean; 
begin 
Result := PlaySound(PChar(FileName), 0, SND_ASYNC); 
end; 

procedure StopWav; 
var 
buffer: array[0..2] of char; 
begin 
buffer[0] := #0; 
PlaySound(Buffer, 0, SND_PURGE); 
end; 

------------------------------- 
//Example: 

procedure TForm1.Button1Click(Sender: TObject); 
begin 
PlayWav('c:\windows\media\start.wav'); 
end; 

procedure TForm1.Button2Click(Sender: TObject); 
begin 
StopWav; 

end; 




    本文转自 OldHawk  博客园博客,原文链接:http://www.cnblogs.com/taobataoma/archive/2007/08/20/862484.html,如需转载请自行联系原作者




相关文章
|
4月前
|
存储
使用lame转wav为mp3
使用lame转wav为mp3
|
人工智能 语音技术 Android开发
format和save_wav
format和save_wav
75 1
|
内存技术
如何将.m4a转.wav文件
如何将.m4a转.wav文件
如何将.m4a转.wav文件
OSError: cannot write mode P as JPEG
OSError: cannot write mode P as JPEG
570 0
OSError: image file is truncated (12 bytes not processed) Premature end of JPEG file
OSError: image file is truncated (12 bytes not processed) Premature end of JPEG file
514 0
|
JavaScript 前端开发
Only POT texture can be compressed to PVRTC format
在图片压缩格式 报这个Warning的时候,意思是该图片必须要采用2的幂次方大小才能使用该格式。 POT: Power of Two. 采取方式是在advanced里边,把Non Power of 2 设置一下。或者原图采用幂次方大小。