make sox driver mor generic because we want to make the command configurable

This commit is contained in:
chrys87 2016-09-16 12:57:00 +02:00 committed by GitHub
parent 62630a06ac
commit 631ee17ea6

View File

@ -6,6 +6,7 @@ class driver():
self.proc = None
self.volume = 1.0
self.soundType = ''
self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile'
def initialize(self, environment):
return environment
def shutdown(self, environment):
@ -15,7 +16,9 @@ class driver():
def playSoundFile(self, filePath, interrupt = True):
if interrupt:
self.cancel()
self.proc = subprocess.Popen("play -q -v " + str(self.volume ) + ' ' + filePath, shell=True)
popenSoundFileCommand = self.soundFileCommand.replace('fenrirVolume', str(self.volume ))
popenSoundFileCommand = popenSoundFileCommand.replace('fenrirSoundFile', filePath)
self.proc = subprocess.Popen(popenSoundFileCommand filePath, shell=True)
self.soundType = 'file'
def cancel(self):
if self.soundType == 'file':