add lock to soundlib volume utility
This commit is contained in:
parent
4cf3328339
commit
624574df3d
|
@ -2,7 +2,7 @@
|
|||
Implements all sound functionality
|
||||
'''
|
||||
import logging, os, hashlib, queue, time, psutil
|
||||
from threading import Event
|
||||
from threading import Event, RLock
|
||||
from exceptionThreading import ExceptionThread, async
|
||||
from pygame import mixer
|
||||
from subprocess import call
|
||||
|
@ -114,6 +114,7 @@ class SoundLib:
|
|||
|
||||
self._ttsQueue = queue.Queue()
|
||||
self._stopper = Event()
|
||||
self._lock = RLock()
|
||||
|
||||
def start(self):
|
||||
self._startMonitor()
|
||||
|
@ -137,6 +138,7 @@ class SoundLib:
|
|||
|
||||
@async(daemon=False)
|
||||
def _fader(self, lowerVolume, totalDuration, fadeDuration=0.2, stepSize=5):
|
||||
with self._lock:
|
||||
alarm = self.soundEffects['triggered']
|
||||
alarmVolume = alarm.volume
|
||||
alarmVolumeDelta = alarmVolume - lowerVolume
|
||||
|
@ -168,6 +170,7 @@ class SoundLib:
|
|||
|
||||
# will not change sounds that have preset volume
|
||||
def _applyVolumesToSounds(self, volume):
|
||||
with self._lock:
|
||||
self.volume = volume
|
||||
v = volume/100
|
||||
s = self.soundEffects
|
||||
|
|
Loading…
Reference in New Issue