用 TMediaPlayer组件,在System组里.
procedure TForm1.Button1Click(Sender: TObject)
begin
MediaPlayer1.FileName:='d:\xx.mp3'
MediaPlayer1.Play
end
不明白你为什么要二进制读取声音文件,行镇VB可以直接调用API播放声音文件,不需要你二进制来读取声音文件的。Private
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Sub PlayWavFile(strFileName As String, PlayCount As Long, JianGe As Long)
'strFileName 要播放的文件名(带路径)
'playCount 播放的档虚粗次数
'JianGe 多次播放时,每次的时间间隔
If Len(Dir(strFileName)) = 0 Then Exit Sub
If PlayCount = 0 Then Exit Sub
If JianGe <1000 Then JianGe = 1000
DoEvents
sndPlaySound strFileName, 16 + 1
Sleep JianGe
Call PlayWavFile(strFileName, PlayCount - 1, JianGe)
End Sub
Private Sub Form_Click()
PlayWavFile "C:\誉好aaa.wav", 1, 1000 '参数:播放文件,播放次数,播放间隔
End Sub
打开flash文档以后,点击左上角的“文件”,选择“派枣蚂导入”—“导入到舞台”,出现一个对话尘埋框,选择你要导入的声音文件,然后点击“打开”。这时,你一定要选择一个关键岩神帧或者空白关键帧,然后打开属性面板,在面板的右栏上方有个“声音”,你再点击声音右边的下拉箭头,选择你要的声音文件即可。另外,需要提醒你一点的是,声音文件默认以事件的形式插入关键帧或者空白关键帧。好了,就说到这吧,按照我说的一定没有问题的。OK!!欢迎分享,转载请注明来源:内存溢出
评论列表(0条)