Update sox.py

This commit is contained in:
chrys87 2016-09-16 13:06:20 +02:00 committed by GitHub
parent 91e87009ee
commit 1c6d390bb7

View File

@ -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':