make sox driver mor generic because we want to make the command configurable
This commit is contained in:
parent
62630a06ac
commit
631ee17ea6
@ -6,6 +6,7 @@ class driver():
|
|||||||
self.proc = None
|
self.proc = None
|
||||||
self.volume = 1.0
|
self.volume = 1.0
|
||||||
self.soundType = ''
|
self.soundType = ''
|
||||||
|
self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile'
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
return environment
|
return environment
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
@ -15,7 +16,9 @@ class driver():
|
|||||||
def playSoundFile(self, filePath, interrupt = True):
|
def playSoundFile(self, filePath, interrupt = True):
|
||||||
if interrupt:
|
if interrupt:
|
||||||
self.cancel()
|
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'
|
self.soundType = 'file'
|
||||||
def cancel(self):
|
def cancel(self):
|
||||||
if self.soundType == 'file':
|
if self.soundType == 'file':
|
||||||
|
Loading…
Reference in New Issue
Block a user