first rev

This commit is contained in:
Darren Ranalli 2006-12-14 01:52:40 +00:00
parent 12e38ec7a7
commit 8a44e44a35
1 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,20 @@
from direct.interval.IntervalGlobal import *
from pandac.PandaModules import NodePath
import random
class PositionalSound:
def __init__(self, soundPath, node, volume=None):
if volume is None:
volume = 1.
self._sound = base.loadSfx(soundPath)
self._ival = SoundInterval(self._sound, node=node, volume=volume)
self.start()
def destroy(self):
self._ival.pause()
del self._ival
del self._sound
def start(self):
self._ival.loop()
self._ival.setT(random.random() * self._sound.length())
def stop(self):
self._ival.stop()