standardized loading of sound effects

This commit is contained in:
Jason Yeung 2007-06-13 22:45:12 +00:00
parent 872f08f70c
commit 38dfa82743

View File

@ -392,7 +392,9 @@ class Loader(DirectObject):
independently of the other group.""" independently of the other group."""
# showbase-created sfxManager should always be at front of list # showbase-created sfxManager should always be at front of list
return self.loadSound(base.sfxManagerList[0], *args, **kw) if(self.base.sfxManagerList):
return self.loadSound(self.base.sfxManagerList[0], *args, **kw)
return None
def loadMusic(self, *args, **kw): def loadMusic(self, *args, **kw):
"""Loads one or more sound files, specifically designated as a """Loads one or more sound files, specifically designated as a
@ -402,9 +404,11 @@ class Loader(DirectObject):
load the sound file, but this distinction allows the sound load the sound file, but this distinction allows the sound
effects and/or the music files to be adjusted as a group, effects and/or the music files to be adjusted as a group,
independently of the other group.""" independently of the other group."""
if(self.base.musicManager):
return self.loadSound(base.musicManager, *args, **kw) return self.loadSound(self.base.musicManager, *args, **kw)
else:
return None
def loadSound(self, manager, soundPath, positional = False, def loadSound(self, manager, soundPath, positional = False,
callback = None, extraArgs = []): callback = None, extraArgs = []):
@ -457,7 +461,8 @@ class Loader(DirectObject):
def unloadSfx (self, sfx): def unloadSfx (self, sfx):
if (sfx): if (sfx):
base.sfxManagerList[0].uncacheSound (sfx.getName()) if(self.base.sfxManagerList):
self.base.sfxManagerList[0].uncacheSound (sfx.getName())
## def makeNodeNamesUnique(self, nodePath, nodeCount): ## def makeNodeNamesUnique(self, nodePath, nodeCount):
## if nodeCount == 0: ## if nodeCount == 0: