alicent 发表于 2008-6-23 22:52

设置背景音乐命令 set bell to 的用法探讨

set bell to 的用法举例:
set bell to "d:\冲动的惩罚.wav",1
??chr(7)
set bell to

请问各位高手:设置背音乐响后如何把它停止或关掉?
谢谢!

baichuan 发表于 2008-6-24 07:49

唱完就停止了!

set bell to 也行!

要不,把音箱关了?

午丁 发表于 2008-6-24 22:39

偶是用《_multimedia.vcx》库的《_soundplayer》类作为播放器,其控制方式如下:

SET  classlib  TO .\ffc\_multimedia.vcx
_screen.AddObject("tpiam","_soundplayer")   && 加载播放器对象


1、暂停、重播:
IF 控制变量1=1
控制变量1=0
thisform.Boyinq1.command1.Caption="重放"
thisform.Boyinq1.command1.toolTipText="接着播放刚才暂停的音频"
_screen.tpiam.PauseSound( )    && 暂停
ELSE
IF 控制变量2=1
控制变量1=1
_screen.tpiam.PlaySound( )  && 重放
thisform.Boyinq1.command1.Caption="暂停"
thisform.Boyinq1.command1.toolTipText="暂时停止播放音频"
ENDIF
ENDIF
2、播放器关闭文件并释放内存
_screen.tpiam.CloseSound()  && 关闭文件
控制变量2=0
thisform.Boyinq1.command1.visible=.F.    && 没有加载文件暂停键不能暂停不能重播所有隐藏。

3、查找、打开文件
mcax=GETFILE("wav,mp3,avi","选择文件","选定")  && 查找文件
IF FILE(mcax)=.T.
控制变量2=1
_screen.tpiam.cFileName=mcax     &&  加载文件
_screen.tpiam.OpenSound( )  &&  播放文件
控制变量1=1
thisform.Boyinq1.command1.Caption="暂停"
thisform.Boyinq1.command1.visible=.T.      && “暂停、重播键”可见
thisform.Boyinq1.command1.toolTipText="暂时停止播放音频"
ENDIF

[[it] 本帖最后由 午丁 于 2008-6-24 22:43 编辑 [/it]]

午丁 发表于 2008-6-24 22:40

但是有个问题要请教大家

如何判断(测试)音频(视频)文件的时间长度?

liyinyi278 发表于 2008-6-25 09:58

为什么我用set bell to 在表单中设置一首音乐,没什么反映呢。

liyinyi278 发表于 2008-6-25 10:01

呵呵,原来后面要加?chr(7).

liyinyi278 发表于 2008-6-27 12:26

[quote][bo][un]baichuan[/un] 在 2008-6-24 07:49 的发言:[/bo]

唱完就停止了!

set bell to 也行!

要不,把音箱关了? [/quote]

set bell to 好象没用啊,停不了。

烤野猪 发表于 2008-6-27 18:18

呵呵,顶一下[tk02] [tk02]

页: [1]

编程论坛