Skip to content

Commit

Permalink
Merge pull request #122 from OpenVoiceOS/release-0.1.1a1
Browse files Browse the repository at this point in the history
Release 0.1.1a1
  • Loading branch information
JarbasAl authored Sep 23, 2024
2 parents 893a5b1 + 2b847f4 commit 3abf187
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Changelog

## [0.1.0a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.0a1) (2024-09-17)
## [0.1.1a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/0.1.1a1) (2024-09-23)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.0.10...0.1.0a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/0.1.0...0.1.1a1)

**Merged pull requests:**

- feat:ovos.common\_play.search.populate event [\#118](https://github.com/OpenVoiceOS/ovos-bus-client/pull/118) ([JarbasAl](https://github.com/JarbasAl))
- troubleshoot issues around wait\_while\_speaking [\#121](https://github.com/OpenVoiceOS/ovos-bus-client/pull/121) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
11 changes: 11 additions & 0 deletions ovos_bus_client/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,26 +626,37 @@ def is_speaking(cls, session: Session = None):
@classmethod
def wait_while_speaking(cls, timeout=15, session: Session = None):
""" wait until audio service reports end of audio output """
if isinstance(timeout, bool):
LOG.warning(f"expected timeout in seconds, got boolean '{timeout}', "
f"defaulting to 15 seconds")
timeout = 15

if not cls.bus:
LOG.error("SessionManager not connected to bus, can not monitor speech state")
return

session = session or SessionManager.get()
if not cls.is_speaking(session):
LOG.warning(f"can't 'wait_while_speaking' because "
f"session '{session.session_id}' is not currently speaking")
return

# wait until end of speech
LOG.debug(f"waiting for session '{session.session_id}' audio output to end with timeout: {timeout}")
event = Event()
sessid = session.session_id

def handle_output_end(msg):
nonlocal sessid, event
sess = SessionManager.get(msg)
if sessid == sess.session_id:
LOG.debug(f"session: {sessid} audio output ended")
event.set()

cls.bus.on("recognizer_loop:audio_output_end", handle_output_end)
event.wait(timeout=timeout)
if not event.is_set():
LOG.warning("waiting for audio output end timed out! not waiting anymore")
cls.bus.remove("recognizer_loop:audio_output_end", handle_output_end)

@classmethod
Expand Down
4 changes: 2 additions & 2 deletions ovos_bus_client/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 1
VERSION_BUILD = 0
VERSION_ALPHA = 0
VERSION_BUILD = 1
VERSION_ALPHA = 1
# END_VERSION_BLOCK

0 comments on commit 3abf187

Please sign in to comment.