From e098bdf85b9769874a5c2ac6ec6c599a96b8cb38 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Sat, 13 Dec 2003 03:46:28 +0000 Subject: [PATCH] enabled, volume, random start t --- direct/src/level/AmbientSound.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/direct/src/level/AmbientSound.py b/direct/src/level/AmbientSound.py index 8f6f1d1136..d94110dc5e 100755 --- a/direct/src/level/AmbientSound.py +++ b/direct/src/level/AmbientSound.py @@ -1,5 +1,6 @@ from IntervalGlobal import * import BasicEntities +import random class AmbientSound(BasicEntities.NodePathEntity): def __init__(self, level, entId): @@ -11,13 +12,17 @@ class AmbientSound(BasicEntities.NodePathEntity): BasicEntities.NodePathEntity.destroy(self) def initSound(self): + if not self.enabled: + return if self.soundPath == '': return self.sound = base.loadSfx(self.soundPath) if self.sound is None: return - self.soundIval = SoundInterval(self.sound, node=self) + self.soundIval = SoundInterval(self.sound, node=self, + volume=self.volume) self.soundIval.loop() + self.soundIval.setT(random.random() * self.sound.length()) def destroySound(self): if hasattr(self, 'soundIval'):