normalize gstreamer, make generic work

This commit is contained in:
Chrys
2021-05-19 11:19:11 +02:00
parent 7a1f93607d
commit f261583a4b
4 changed files with 10 additions and 7 deletions

View File

@@ -26,17 +26,19 @@ class driver(soundDriver):
self.frequenceCommand = 'play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence'
self._initialized = True
def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0):
def playFrequence(self, frequence, duration, adjustVolume = 0, interrupt=True):
print('drin')
if not self._initialized:
return
if interrupt:
self.cancel()
popenFrequenceCommand = shlex.split(self.frequenceCommand)
for idx, word in enumerate(popenFrequenceCommand):
word = word.replace('fenrirVolume', str(self.volume + adjustVolume ))
word = word.replace('fenrirFreqDuration', str(duration))
word = word.replace('fenrirVolume', str(self.volume))
word = word.replace('fenrirDuration', str(duration))
word = word.replace('fenrirFrequence', str(frequence))
popenFrequenceCommand[idx] = word
print(popenFrequenceCommand)
self.proc = subprocess.Popen(popenFrequenceCommand, stdin=None, stdout=None, stderr=None, shell=False)
self.soundType = 'frequence'
def playSoundFile(self, filePath, interrupt = True):