implement sound volume for gstreamer backend

This commit is contained in:
chrys 2020-10-15 13:20:14 +02:00 committed by GitHub
parent 146f133874
commit c59d729748
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -88,6 +88,7 @@ class driver(soundDriver):
return return
if interrupt: if interrupt:
self.cancel() self.cancel()
self._source.set_property('volume', self.volume)
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)
@ -96,11 +97,9 @@ class driver(soundDriver):
return return
if interrupt: if interrupt:
self.cancel() self.cancel()
self._source.set_property('volume', tone.volume) self._source.set_property('volume', self.volume)
self._source.set_property('freq', tone.frequency) self._source.set_property('freq', frequence)
self._source.set_property('wave', tone.wave)
self._pipeline.set_state(Gst.State.PLAYING) self._pipeline.set_state(Gst.State.PLAYING)
duration = int(1000 * tone.duration)
GLib.timeout_add(duration, self._onTimeout, self._pipeline) GLib.timeout_add(duration, self._onTimeout, self._pipeline)
def cancel(self, element=None): def cancel(self, element=None):