跳转至

AudioStopAll

格式

AudioStopAll()

简介

停止播放所有声音。

实例

运行开始时播放声音,按下鼠标左键停止播放所有声音。

import fg
import wx

asset = fg.AssetCreate()
asset.name = 'Main Scene'
asset.state = fg.STATE.VOXMODEL
asset.vmFile = 'mainScene'
asset.icon='icon.png'

fg.AssetRegister(asset)

def onStart(self):
    global sound
    sound=wx.AudioCreate("BGM.mp3",True)
    wx.AudioPlay(sound, True)

def onmouse(self, stamp, button, action, mods):
    global sound
    if button==wx.MOUSE_BUTTON.LEFT and action==wx.ACTION.PRESS:
        wx.AudioStopAll()

fg.AssetSetStartCBFunc(asset, onStart)
fg.AssetSetMouseButtonCBFunc(asset, onmouse)