Skip to content

Commit

Permalink
fix double speak bug
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Loftus committed Jan 18, 2024
1 parent 3396bf9 commit 39ac02a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
6 changes: 4 additions & 2 deletions core/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ def on_update_contexts():
ANNOUNCE = settings.get("user.announce_mode_updates")

if last_mode == "sleep" and not SLEEP:
# ALways announce wake up
actions.user.tts(f"Talon now listening")
# Always announce wake up
# Cancel any current speaker, weird edge case where it will speak twice otherwise
actions.user.cancel_current_speaker()
actions.user.tts(f"Talon now listening")

elif last_mode != "sleep" and SLEEP:
# Always announce sleep
Expand Down
15 changes: 11 additions & 4 deletions core/core-agnostic.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,24 @@ def cancel_current_speaker():
speaker_cancel_callback = None



def braille(text: str):
"""Output braille with the screenreader"""

def echo_dictation_enabled() -> bool:
"""Returns true if echo dictation is enabled"""
return ctx.settings["user.echo_dictation"]
# Catch potential race condition where settings haven't been loaded yet
try:
return ctx.settings["user.echo_dictation"]
except:
return False

def echo_context_enabled() -> bool:
"""Returns true if echo context is enabled"""
return ctx.settings["user.echo_context"]
# Catch potential race condition where settings haven't been loaded yet
try:
return ctx.settings["user.echo_context"]
except:
return False

def toggle_echo():
"""Toggles echo dictation on and off"""
Expand Down Expand Up @@ -94,7 +101,7 @@ def toggle_echo_all():

def tts(text: str):
'''text to speech with robot voice'''
print("Sight-Free-Talon Error: TTS not implemented in this context")
raise NotImplementedError("Sight-Free-Talon Error: TTS not implemented in this context")

def espeak(text: str):
'''text to speech with espeak'''
Expand Down

0 comments on commit 39ac02a

Please sign in to comment.