瀏覽代碼

reset midi before playing new song

cxgeorge 23 年之前
父節點
當前提交
bc1b8e9e2a
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      direct/src/showbase/ShowBase.py

+ 3 - 1
direct/src/showbase/ShowBase.py

@@ -512,6 +512,7 @@ class ShowBase:
         self.musicManagerIsValid=self.musicManager!=None \
         self.musicManagerIsValid=self.musicManager!=None \
                 and self.musicManager.isValid()
                 and self.musicManager.isValid()
         if self.musicManagerIsValid:
         if self.musicManagerIsValid:
+            self.musicManager.setMutuallyExclusive(1)  # ensure only 1 midi song is playing at a time
             self.musicManager.setActive(self.musicActive)
             self.musicManager.setActive(self.musicActive)
 
 
     # enableMusic/enableSoundEffects are meant to be called in response to a user request
     # enableMusic/enableSoundEffects are meant to be called in response to a user request
@@ -914,13 +915,14 @@ class ShowBase:
     def screenshot(self, namePrefix='screenshot'):
     def screenshot(self, namePrefix='screenshot'):
         # Get the current date and time to uniquify the image (down to the second)
         # Get the current date and time to uniquify the image (down to the second)
         date = time.ctime(time.time())
         date = time.ctime(time.time())
-        # Get the current frame count to uniqify it even more
+        # Get the current frame count to uniquify it even more
         frameCount = globalClock.getFrameCount()
         frameCount = globalClock.getFrameCount()
         # Replace spaces with dashes because unix does not like spaces in the filename
         # Replace spaces with dashes because unix does not like spaces in the filename
         date = date.replace(' ', '-')
         date = date.replace(' ', '-')
         date = date.replace(':', '-')
         date = date.replace(':', '-')
         imageName = ('%s-%s-%d.%s' % (namePrefix, date, frameCount, self.screenshotExtension))
         imageName = ('%s-%s-%d.%s' % (namePrefix, date, frameCount, self.screenshotExtension))
         self.notify.info("Taking screenshot: " + imageName)
         self.notify.info("Taking screenshot: " + imageName)
+
         takeSnapshot(self.win, imageName)
         takeSnapshot(self.win, imageName)
         # Announce to anybody that a screenshot has been taken
         # Announce to anybody that a screenshot has been taken
         messenger.send('screenshot')
         messenger.send('screenshot')