add autoReadIncomming, add sound volume, convert volume to 0.0 - 1.0 factor for unification

This commit is contained in:
chrys
2016-08-08 09:34:57 +02:00
parent 152453c232
commit 0e973b6f1d
10 changed files with 27 additions and 12 deletions

View File

@ -15,6 +15,7 @@ class sound:
self._initialized = False
self._source = None
self._sink = None
self.volume = 1
if not _gstreamerAvailable:
return
self.init()
@ -89,7 +90,8 @@ class sound:
return
self._player.set_state(Gst.State.NULL)
self._pipeline.set_state(Gst.State.NULL)
def setVolume(self, volume):
self.volume = volume
def shutdown(self):
global _gstreamerAvailable
if not _gstreamerAvailable:

View File

@ -3,14 +3,16 @@ import subprocess
class sound():
def __init__(self):
pass
self.volume = 1.0;
def playFrequence(self, frequence, duration, adjustVolume):
pass
def playSoundFile(self, filePath, interrupt = True):
self.proc = subprocess.Popen("play -q " + filePath, shell=True)
self.proc = subprocess.Popen("play -q -v " + str(self.volume ) + ' ' + filePath, shell=True)
def cancel(self):
pass
def setCallback(self, callback):
pass
def setVolume(self, volume):
self.volume = volume
def shutdown(self):
pass