normalize gstreamer, make generic work
This commit is contained in:
parent
7a1f93607d
commit
f261583a4b
@ -23,7 +23,7 @@ class fenrirManager():
|
|||||||
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
raise RuntimeError('Cannot Initialize. Maybe the configfile is not available or not parseable')
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
raise
|
raise
|
||||||
self.environment['runtime']['outputManager'].playFrequence(500, 500, interrupt=True)
|
self.environment['runtime']['outputManager'].playFrequence(500, 1, interrupt=True)
|
||||||
#self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
|
#self.environment['runtime']['outputManager'].presentText(_("Start Fenrir"), soundIcon='ScreenReaderOn', interrupt=True)
|
||||||
signal.signal(signal.SIGINT, self.captureSignal)
|
signal.signal(signal.SIGINT, self.captureSignal)
|
||||||
signal.signal(signal.SIGTERM, self.captureSignal)
|
signal.signal(signal.SIGTERM, self.captureSignal)
|
||||||
|
@ -26,17 +26,19 @@ class driver(soundDriver):
|
|||||||
self.frequenceCommand = 'play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence'
|
self.frequenceCommand = 'play -q -v fenrirVolume -n -c1 synth fenrirDuration sine fenrirFrequence'
|
||||||
self._initialized = True
|
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:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
if interrupt:
|
if interrupt:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
popenFrequenceCommand = shlex.split(self.frequenceCommand)
|
popenFrequenceCommand = shlex.split(self.frequenceCommand)
|
||||||
for idx, word in enumerate(popenFrequenceCommand):
|
for idx, word in enumerate(popenFrequenceCommand):
|
||||||
word = word.replace('fenrirVolume', str(self.volume + adjustVolume ))
|
word = word.replace('fenrirVolume', str(self.volume))
|
||||||
word = word.replace('fenrirFreqDuration', str(duration))
|
word = word.replace('fenrirDuration', str(duration))
|
||||||
word = word.replace('fenrirFrequence', str(frequence))
|
word = word.replace('fenrirFrequence', str(frequence))
|
||||||
popenFrequenceCommand[idx] = word
|
popenFrequenceCommand[idx] = word
|
||||||
|
print(popenFrequenceCommand)
|
||||||
self.proc = subprocess.Popen(popenFrequenceCommand, stdin=None, stdout=None, stderr=None, shell=False)
|
self.proc = subprocess.Popen(popenFrequenceCommand, stdin=None, stdout=None, stderr=None, shell=False)
|
||||||
self.soundType = 'frequence'
|
self.soundType = 'frequence'
|
||||||
def playSoundFile(self, filePath, interrupt = True):
|
def playSoundFile(self, filePath, interrupt = True):
|
||||||
|
@ -92,12 +92,13 @@ class driver(soundDriver):
|
|||||||
self._player.set_property('uri', 'file://%s' % fileName)
|
self._player.set_property('uri', 'file://%s' % fileName)
|
||||||
self._player.set_state(Gst.State.PLAYING)
|
self._player.set_state(Gst.State.PLAYING)
|
||||||
|
|
||||||
def playFrequence(self, frequence, duration, interrupt=True):
|
def playFrequence(self, frequence, duration, adjustVolume = 0, interrupt=True):
|
||||||
if not self._initialized:
|
if not self._initialized:
|
||||||
return
|
return
|
||||||
if interrupt:
|
if interrupt:
|
||||||
self.cancel()
|
self.cancel()
|
||||||
self._source.set_property('volume', self.volume)
|
duration = duration * 1000
|
||||||
|
self._source.set_property('volume', self.volume - adjustVolume)
|
||||||
self._source.set_property('freq', frequence)
|
self._source.set_property('freq', frequence)
|
||||||
self._pipeline.set_state(Gst.State.PLAYING)
|
self._pipeline.set_state(Gst.State.PLAYING)
|
||||||
GLib.timeout_add(duration, self._onTimeout, self._pipeline)
|
GLib.timeout_add(duration, self._onTimeout, self._pipeline)
|
||||||
|
Loading…
Reference in New Issue
Block a user