Update dummyDriver.py

This commit is contained in:
chrys87 2017-01-30 16:22:12 +01:00 committed by GitHub
parent 6cde98f50e
commit e13824f64f

View File

@ -10,29 +10,46 @@ class driver():
def __init__(self): def __init__(self):
self.volume = None self.volume = None
self._initialized = False self._initialized = False
def initialize(self, environment): def initialize(self, environment):
self.env = environment self.env = environment
self._initialized = True
pirnt('SoundDummyDriver: Initialize')
def shutdown(self): def shutdown(self):
if not self._initialized: if not self._initialized:
return return
self.cancel() self.cancel()
pirnt('SoundDummyDriver: Shutdown')
def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0): def playFrequence(self, frequence = 1000, duration = 0.3, adjustVolume = 0):
if not self._initialized: if not self._initialized:
return return
if interrupt: if interrupt:
self.cancel() self.cancel()
pirnt('SoundDummyDriver: playFrequence:' + ' freq:' + str(frequence) + ' duration:' + str(duration) + ' adjustVolume:' + str(adjustVolume) )
pirnt('SoundDummyDriver: -----------------------------------')')
def playSoundFile(self, filePath, interrupt = True): def playSoundFile(self, filePath, interrupt = True):
if not self._initialized: if not self._initialized:
return return
if interrupt: if interrupt:
self.cancel() self.cancel()
pirnt('SoundDummyDriver: playSoundFile:' + str(filePath))
pirnt('SoundDummyDriver: -----------------------------------')
def cancel(self): def cancel(self):
if not self._initialized: if not self._initialized:
return return
pirnt('SoundDummyDriver: Cancel')
def setCallback(self, callback): def setCallback(self, callback):
if not self._initialized: if not self._initialized:
return return
pirnt('SoundDummyDriver: setCallback')
def setVolume(self, volume): def setVolume(self, volume):
if not self._initialized: if not self._initialized:
return return
self.volume = volume self.volume = volume
pirnt('SoundDummyDriver: setVolume:' + str(self.volume))