unify more loops, remove spaces

This commit is contained in:
Chrys
2019-09-05 23:12:05 +02:00
parent 8663ad1ac9
commit 3f85d672a6
12 changed files with 96 additions and 96 deletions

View File

@@ -28,7 +28,7 @@ class driver(soundDriver):
def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0):
if not self._initialized:
return
return
if interrupt:
self.cancel()
popenFrequenceCommand = shlex.split(self.frequenceCommand)
@@ -36,28 +36,28 @@ class driver(soundDriver):
word = word.replace('fenrirVolume', str(self.volume + adjustVolume ))
word = word.replace('fenrirFreqDuration', str(duration))
word = word.replace('fenrirFrequence', str(frequence))
popenFrequenceCommand[idx] = word
popenFrequenceCommand[idx] = word
self.proc = subprocess.Popen(popenFrequenceCommand, stdin=None, stdout=None, stderr=None, shell=False)
self.soundType = 'frequence'
def playSoundFile(self, filePath, interrupt = True):
if not self._initialized:
return
return
if interrupt:
self.cancel()
popenSoundFileCommand = shlex.split(self.soundFileCommand)
for idx, word in enumerate(popenSoundFileCommand):
word = word.replace('fenrirVolume', str(self.volume ))
word = word.replace('fenrirSoundFile', str(filePath))
popenSoundFileCommand[idx] = word
popenSoundFileCommand[idx] = word
self.proc = subprocess.Popen(popenSoundFileCommand, shell=False)
self.soundType = 'file'
def cancel(self):
if not self._initialized:
return
return
if self.soundType == '':
return
if self.soundType == 'file':
self.proc.kill()
if self.soundType == 'frequence':
self.proc.kill()
self.soundType = ''
self.proc.kill()
self.soundType = ''