From bcf50559530cf17e3f089fac25eea908644e882c Mon Sep 17 00:00:00 2001 From: Henry Zeng Date: Thu, 1 Oct 2020 23:21:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=98=E8=AE=B0=E6=B7=BB=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Process/Api/Mod/BGM.py | 53 ------------------------------------------ 1 file changed, 53 deletions(-) delete mode 100644 Process/Api/Mod/BGM.py diff --git a/Process/Api/Mod/BGM.py b/Process/Api/Mod/BGM.py deleted file mode 100644 index d54a887..0000000 --- a/Process/Api/Mod/BGM.py +++ /dev/null @@ -1,53 +0,0 @@ -from Environment import dir_mix,path_read -from PySide2 import QtMultimedia,QtCore -from DataUnCopy import Add,Space - -class BGM(): - def __init__(self): - self.OnlyThis = QtMultimedia.QMediaPlaylist.CurrentItemOnce - self.OnlyThisLoop = QtMultimedia.QMediaPlaylist.CurrentItemInLoop - self.PlayTheList = QtMultimedia.QMediaPlaylist.Sequential - self.PlayTheListLoop = QtMultimedia.QMediaPlaylist.Loop - self.Random = QtMultimedia.QMediaPlaylist.Random - - def Set_List(self,IsSound,Content,Cycle = QtMultimedia.QMediaPlaylist.Loop): - """IsSound : 标注音频是否来自Sound事件组 Content : 标注音频(传入音频位置数据或Sound事件组中别名 Cycle : 是否循环)""" - Music = [] - - for i in Content: - if IsSound: - Music.append(dir_mix(Space["root"], path_read(Space["Script"]["sound"][i]["path"]))) - else: - Music.append(dir_mix(Space["root"], path_read(i))) - if len(Music) >1: - for i in Music: - url = QtCore.QUrl.fromLocalFile(i) - Space['BGMPlaylist'].addMedia(QtMultimedia.QMediaContent(url)) - Space['BGMPlayer'].setPlaylist(Space['BGMPlaylist']) - else: - url = QtCore.QUrl.fromLocalFile(Music[0]) - Space['BGMPlayer'].setMedia(QtMultimedia.QMediaContent(url)) - - Space['BGMPlaylist'].setPlaybackMode(Cycle) - - # Constant Value Description - # QMediaPlaylist::CurrentItemOnce 0 The current item is played only once. - # QMediaPlaylist::CurrentItemInLoop 1 The current item is played repeatedly in a loop. - # QMediaPlaylist::Sequential 2 Playback starts from the current and moves through each successive item until the last is reached and then stops. The next item is a null item when the last one is currently playing. - # QMediaPlaylist::Loop 3 Playback restarts at the first item after the last has finished playing. - # QMediaPlaylist::Random 4 Play items in random order. - - def setCurrentIndex(self,Id): - Space['BGMPlaylist'].setCurrentIndex(Id) - - def setVolume(self,Volume): - Space['BGMPlayer'].setVolume(Volume) - - def play(self): - Space['BGMPlayer'].play() - - def pause(self): - Space['BGMPlayer'].pause() - - def stop(self): - Space['BGMPlayer'].stop()