From 1c6d390bb73350bf80918b07f16da8113e79f24e Mon Sep 17 00:00:00 2001 From: chrys87 Date: Fri, 16 Sep 2016 13:06:20 +0200 Subject: [PATCH] Update sox.py --- src/fenrir-package/soundDriver/sox.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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':