Update sox.py
This commit is contained in:
parent
91e87009ee
commit
1c6d390bb7
@ -8,17 +8,25 @@ class driver():
|
|||||||
self.soundType = ''
|
self.soundType = ''
|
||||||
self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile'
|
self.soundFileCommand = 'play -q -v fenrirVolume fenrirSoundFile'
|
||||||
def initialize(self, environment):
|
def initialize(self, environment):
|
||||||
|
self.soundFileCommand = environment['runtime']['settingsManager'].getSetting(environment,'sound', 'genericPlayFileCommand')
|
||||||
|
self.frequenceCommand = environment['runtime']['settingsManager'].getSetting(environment,'sound', 'genericFrequencyCommand')
|
||||||
return environment
|
return environment
|
||||||
def shutdown(self, environment):
|
def shutdown(self, environment):
|
||||||
return environment
|
return environment
|
||||||
def playFrequence(self, frequence, duration, adjustVolume):
|
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'
|
self.soundType = 'frequence'
|
||||||
def playSoundFile(self, filePath, interrupt = True):
|
def playSoundFile(self, filePath, interrupt = True):
|
||||||
if interrupt:
|
if interrupt:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
popenSoundFileCommand = self.soundFileCommand.replace('fenrirVolume', str(self.volume ))
|
popenSoundFileCommand = self.soundFileCommand.replace('fenrirVolume', str(self.volume ))
|
||||||
popenSoundFileCommand = popenSoundFileCommand.replace('fenrirSoundFile', filePath)
|
popenSoundFileCommand = popenSoundFileCommand.replace('fenrirSoundFile', filePath)
|
||||||
self.proc = subprocess.Popen(popenSoundFileCommand filePath, shell=True)
|
self.proc = subprocess.Popen(popenSoundFileCommand, 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