Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions source/nvwave.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,17 +383,19 @@ def outputDeviceNameToID(name, useDefaultIfInvalid=False):

fileWavePlayer = None
fileWavePlayerThread=None
def playWaveFile(fileName, async=True):
def playWaveFile(fileName, asynchronous=True):
"""plays a specified wave file.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be add information about parameters to the doc string while at it?

"""
@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)
if fileWavePlayer is not None:
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)
Expand Down
2 changes: 1 addition & 1 deletion source/speech/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down