Browse Source

Add missing libarary import and add a function to cleanup properly

Abhishek Nath 15 years ago
parent
commit
135b484657
1 changed files with 12 additions and 1 deletions
  1. 12 1
      direct/src/showbase/Audio3DManager.py

+ 12 - 1
direct/src/showbase/Audio3DManager.py

@@ -2,7 +2,7 @@
 
 __all__ = ['Audio3DManager']
 
-from pandac.PandaModules import VBase3
+from pandac.PandaModules import Vec3, VBase3
 from direct.task import Task
 #
 class Audio3DManager:
@@ -272,3 +272,14 @@ class Audio3DManager:
         else:
             self.audio_manager.audio3dSetListenerAttributes(0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1)
         return Task.cont
+        
+    def disable(self):
+        """
+        Detaches any existing sounds and removes the update task
+        """
+        taskMgr.remove("Audio3DManager-updateTask")
+        self.detachListener()
+        for object in self.sound_dict.keys():
+            for sound in self.sound_dict[object]:
+                self.detachSound(sound)
+