def destroy(self):
   # destroy this object
   soundManager.get3dManager().detachSound(self.soundEffect)
   self.soundEffect.stop()
   del self.soundEffect
   self.soundEffect = None
   VirtualNodeWrapper.destroy(self)
示例#2
0
 def destroy(self):
     # destroy this object
     soundManager.get3dManager().detachSound(self.soundEffect)
     self.soundEffect.stop()
     del self.soundEffect
     self.soundEffect = None
     VirtualNodeWrapper.destroy(self)
 def setSound(self, soundFilepath):
   # if there is already a model defined, remove it
   if self.soundEffect is not None:
     self.soundEffect.remove()
   
   if soundFilepath is not None:
     filepath = str(Filename.fromOsSpecific(soundFilepath))
     # add the model path to the panda-path
     pandaPath = None
     from pandac.PandaModules import getModelPath
     for searchPath in str(getModelPath()).split():
       if searchPath == filepath:
         pandaPath = searchPath
     if pandaPath is None:
       pandaPath = '/'.join(filepath.split('/')[:-1])
       from pandac.PandaModules import getModelPath
       getModelPath().appendPath(pandaPath)
     
     # the path to the model we handle
     self.soundFilepath = soundFilepath
     self.setFilepath(soundFilepath)
     # load the model
     self.soundEffect = soundManager.get3dManager().loadSfx(soundFilepath)
   
   # if the model loading fails or no path given, use a dummy object
   if self.soundEffect is None:
     print "W: NodePathWrapper.setModel: model could not be loaded, loading dummy"
     self.soundEffect = soundManager.get3dManager().loadSfx(SOUND_NOT_FOUND_SOUND)
   # make the model visible
   soundManager.get3dManager().attachSoundToObject( self.soundEffect, self.getNodepath() )
   
   self.soundEffect.setLoop(True)
   self.soundEffect.play()
   soundManager.get3dManager().setSoundVelocityAuto( self.soundEffect )
示例#4
0
    def setSound(self, soundFilepath):
        # if there is already a model defined, remove it
        if self.soundEffect is not None:
            self.soundEffect.remove()

        if soundFilepath is not None:
            filepath = str(Filename.fromOsSpecific(soundFilepath))
            # add the model path to the panda-path
            pandaPath = None
            from pandac.PandaModules import getModelPath
            for searchPath in str(getModelPath()).split():
                if searchPath == filepath:
                    pandaPath = searchPath
            if pandaPath is None:
                pandaPath = '/'.join(filepath.split('/')[:-1])
                from pandac.PandaModules import getModelPath
                getModelPath().appendPath(pandaPath)

            # the path to the model we handle
            self.soundFilepath = soundFilepath
            self.setFilepath(soundFilepath)
            # load the model
            self.soundEffect = soundManager.get3dManager().loadSfx(
                soundFilepath)

        # if the model loading fails or no path given, use a dummy object
        if self.soundEffect is None:
            print "W: NodePathWrapper.setModel: model could not be loaded, loading dummy"
            self.soundEffect = soundManager.get3dManager().loadSfx(
                SOUND_NOT_FOUND_SOUND)
        # make the model visible
        soundManager.get3dManager().attachSoundToObject(
            self.soundEffect, self.getNodepath())

        self.soundEffect.setLoop(True)
        self.soundEffect.play()
        soundManager.get3dManager().setSoundVelocityAuto(self.soundEffect)
 def getSoundMinDistance(self, *args, **kwargs):
   soundManager.get3dManager().getSoundMinDistance(self.soundEffect, *args, **kwargs)
示例#6
0
 def setSoundMinDistance(self, *args, **kwargs):
     soundManager.get3dManager().setSoundMinDistance(
         self.soundEffect, *args, **kwargs)