mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 02:42:49 -04:00
SoundInterval already does all of this except for loading the sound itself
This commit is contained in:
parent
3f1800da05
commit
17b8737ae2
@ -1,20 +0,0 @@
|
||||
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()
|
Loading…
x
Reference in New Issue
Block a user