Skip to content

Commit

Permalink
version 19.8B4
Browse files Browse the repository at this point in the history
fix index updating. Now NVDA should work properly when index notiffications are required, E.G. when say all command is called.
  • Loading branch information
davidacm committed Aug 27, 2019
1 parent 318e9c1 commit 9e9eab4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 22 deletions.
48 changes: 27 additions & 21 deletions addon/synthDrivers/_ibmeci.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,32 +242,37 @@ def bgPlay(stri):
tries += 1
log.error("Eloq speech failed to feed one buffer.")

curindex=None
indexes = []
def sendIndexes():
global indexes
for i in indexes: _callbackExec(setLast, i)
indexes = []

def playStream():
global audioStream
_callbackExec(bgPlay, audioStream.getvalue())
audioStream.truncate(0)
audioStream.seek(0)
sendIndexes()

endStringReached = False
Callback = WINFUNCTYPE(c_int, c_int, c_int, c_int, c_void_p)
@Callback
def callback (h, ms, lp, dt):
global audioStream, curindex, speaking, END_STRING_MARK, endMarkersCount
global audioStream, speaking, END_STRING_MARK, endMarkersCount, indexes, endStringReached
if speaking and ms == ECIMessage.eciWaveformBuffer:
audioStream.write(string_at(buffer, lp*2))
if audioStream.tell() >= samples*2:
_callbackExec(bgPlay, audioStream.getvalue())
if curindex is not None:
_callbackExec(setLast, curindex)
curindex=None
audioStream.truncate(0)
audioStream.seek(0)
if audioStream.tell() >= samples*2: playStream()
endStringReached = False
elif ms==ECIMessage.eciIndexReply:
if lp != END_STRING_MARK: # not end of string
curindex = lp
else: #We reached the end of string
if audioStream.tell() > 0:
_callbackExec(bgPlay, audioStream.getvalue())
audioStream.seek(0)
audioStream.truncate(0)
if curindex is not None:
_callbackExec(setLast, curindex)
curindex=None
if lp == END_STRING_MARK:
if audioStream.tell() > 0: playStream()
sendIndexes()
_callbackExec(endStringEvent)
endStringReached = True
else:
if endStringReached: _callbackExec(setLast, lp)
else: indexes.append(lp)
return ECICallbackReturn.eciDataProcessed

class CallbackThread(threading.Thread):
Expand Down Expand Up @@ -390,10 +395,11 @@ def endStringEvent():
endMarkersCount -=1
if endMarkersCount == 0:
speaking = False
onDoneSpeaking()
idleTimer = threading.Timer(0.3, idlePlayer)
idleTimer.start()

def idlePlayer():
global player, speaking
if not speaking: player.idle()
if not speaking:
player.idle()
onDoneSpeaking()
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description" : _("""This is the IBMTTS synthesizer driver for NVDA."""),
# version
"addon_version" : "19.8B3",
"addon_version" : "19.8B4",
# Author(s)
"addon_author" : u"David CM <[email protected]> and others",
# URL for the add-on documentation support
Expand Down

0 comments on commit 9e9eab4

Please sign in to comment.