Update torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py
This commit is contained in:
parent
3067dc423c
commit
67529b652f
@ -99,7 +99,16 @@ class AntiSpam():
|
|||||||
|
|
||||||
def OnUpdate(self, clip, old_position, new_position):
|
def OnUpdate(self, clip, old_position, new_position):
|
||||||
Delta = new_position - old_position
|
Delta = new_position - old_position
|
||||||
Clip = self.LastClips[hash(clip)]
|
clip_key = hash(clip)
|
||||||
|
if clip_key not in self.LastClips:
|
||||||
|
if self.Logger.isEnabledFor(logging.DEBUG):
|
||||||
|
self.Logger.debug(
|
||||||
|
"OnUpdate called for unknown clip key %r; %d known keys",
|
||||||
|
clip_key,
|
||||||
|
len(self.LastClips),
|
||||||
|
)
|
||||||
|
return
|
||||||
|
Clip = self.LastClips[clip_key]
|
||||||
|
|
||||||
if not Clip["dominant"]:
|
if not Clip["dominant"]:
|
||||||
return
|
return
|
||||||
@ -171,7 +180,10 @@ class Advertiser():
|
|||||||
|
|
||||||
def OnUpdate(self, clip, old_position, new_position):
|
def OnUpdate(self, clip, old_position, new_position):
|
||||||
Delta = new_position - old_position
|
Delta = new_position - old_position
|
||||||
Clip = self.LastClips[hash(clip)]
|
clip_key = hash(clip)
|
||||||
|
if clip_key not in self.LastClips:
|
||||||
|
return
|
||||||
|
Clip = self.LastClips[clip_key]
|
||||||
|
|
||||||
if not Clip["dominant"]:
|
if not Clip["dominant"]:
|
||||||
return
|
return
|
||||||
@ -319,9 +331,12 @@ class AudioClip():
|
|||||||
|
|
||||||
def OnStop(self):
|
def OnStop(self):
|
||||||
self.Logger.debug(sys._getframe().f_code.co_name + ' ' + self.URI)
|
self.Logger.debug(sys._getframe().f_code.co_name + ' ' + self.URI)
|
||||||
|
if self in self.Master.AudioClips:
|
||||||
self.Master.AudioClips.remove(self)
|
self.Master.AudioClips.remove(self)
|
||||||
|
|
||||||
if self.AudioPlayer.Playing:
|
if self.AudioPlayer.Playing:
|
||||||
|
if self.LastPosition is None:
|
||||||
|
self.LastPosition = self.AudioPlayer.Position
|
||||||
Delta = self.AudioPlayer.Position - self.LastPosition
|
Delta = self.AudioPlayer.Position - self.LastPosition
|
||||||
self.Player.Storage["Audio"]["TimeUsed"] += Delta
|
self.Player.Storage["Audio"]["TimeUsed"] += Delta
|
||||||
self.Player.Storage["Audio"]["LastUseLength"] += Delta
|
self.Player.Storage["Audio"]["LastUseLength"] += Delta
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user