diff --git a/src/fenrir-package/soundDriver/sox.py b/src/fenrir-package/soundDriver/sox.py index 746c9ba1..b24d78fb 100644 --- a/src/fenrir-package/soundDriver/sox.py +++ b/src/fenrir-package/soundDriver/sox.py @@ -8,17 +8,25 @@ class driver(): self.soundType = '' self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile' def initialize(self, environment): + self.soundFileCommand = environment['runtime']['settingsManager'].getSetting(environment,'sound', 'genericPlayFileCommand') + self.frequenceCommand = environment['runtime']['settingsManager'].getSetting(environment,'sound', 'genericFrequencyCommand') return environment def shutdown(self, environment): return environment def playFrequence(self, frequence, duration, adjustVolume): + if interrupt: + self.cancel() + popenFrequenceCommand = self.frequenceCommand.replace('fenrirVolume', str(self.volume + adjustVolume )) + popenFrequenceCommand = popenFrequenceCommand.replace('fenrirFreqDuration', str(duration)) + popenFrequenceCommand = popenFrequenceCommand.replace('fenrirFrequence', str(frequence)) + self.proc = subprocess.Popen(popenFrequenceCommand, shell=True) self.soundType = 'frequence' def playSoundFile(self, filePath, interrupt = True): if interrupt: self.cancel() popenSoundFileCommand = self.soundFileCommand.replace('fenrirVolume', str(self.volume )) popenSoundFileCommand = popenSoundFileCommand.replace('fenrirSoundFile', filePath) - self.proc = subprocess.Popen(popenSoundFileCommand filePath, shell=True) + self.proc = subprocess.Popen(popenSoundFileCommand, shell=True) self.soundType = 'file' def cancel(self): if self.soundType == 'file':