diff --git a/source/core.py b/source/core.py index e880dc7b653..a61712e9c54 100644 --- a/source/core.py +++ b/source/core.py @@ -274,7 +274,7 @@ def onEndSession(evt): speech.cancelSpeech() if not globalVars.appArgs.minimal and config.conf["general"]["playStartAndExitSounds"]: try: - nvwave.playWaveFile("waves\\exit.wav",async=False) + nvwave.playWaveFile("waves\\exit.wav",asynchronous=False) except: pass log.info("Windows session ending") @@ -557,7 +557,7 @@ def run(self): if not globalVars.appArgs.minimal and config.conf["general"]["playStartAndExitSounds"]: try: - nvwave.playWaveFile("waves\\exit.wav",async=False) + nvwave.playWaveFile("waves\\exit.wav",asynchronous=False) except: pass # #5189: Destroy the message window as late as possible diff --git a/source/nvwave.py b/source/nvwave.py index b288a97be22..7bf011cf0fb 100644 --- a/source/nvwave.py +++ b/source/nvwave.py @@ -383,9 +383,11 @@ def outputDeviceNameToID(name, useDefaultIfInvalid=False): fileWavePlayer = None fileWavePlayerThread=None -def playWaveFile(fileName, async=True): +def playWaveFile(fileName, asynchronous=True): """plays a specified wave file. -""" + @param asynchronous: whether the wave file should be played asynchronously + @type asynchronous: bool + """ global fileWavePlayer, fileWavePlayerThread f = wave.open(fileName,"r") if f is None: raise RuntimeError("can not open file %s"%fileName) @@ -393,7 +395,7 @@ def playWaveFile(fileName, async=True): fileWavePlayer.stop() fileWavePlayer = WavePlayer(channels=f.getnchannels(), samplesPerSec=f.getframerate(),bitsPerSample=f.getsampwidth()*8, outputDevice=config.conf["speech"]["outputDevice"],wantDucking=False) fileWavePlayer.feed(f.readframes(f.getnframes())) - if async: + if asynchronous: if fileWavePlayerThread is not None: fileWavePlayerThread.join() fileWavePlayerThread=threading.Thread(target=fileWavePlayer.idle) diff --git a/source/speech/commands.py b/source/speech/commands.py index 31091a29e77..0578db6bc3c 100644 --- a/source/speech/commands.py +++ b/source/speech/commands.py @@ -287,7 +287,7 @@ def __init__(self, fileName): def run(self): import nvwave - nvwave.playWaveFile(self.fileName, async=True) + nvwave.playWaveFile(self.fileName, asynchronous=True) def __repr__(self): return "WaveFileCommand(%r)" % self.fileName