[loop-cycle-1] docs: add docstrings to VoiceTTS public methods (#774) (#1290)
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled

This commit was merged in pull request #1290.
This commit is contained in:
2026-03-24 01:48:46 +00:00
parent cc8ed5b57d
commit bd3e207c0d

View File

@@ -37,6 +37,7 @@ class VoiceTTS:
@property
def available(self) -> bool:
"""Whether the TTS engine initialized successfully and can produce audio."""
return self._available
def speak(self, text: str) -> None:
@@ -68,11 +69,13 @@ class VoiceTTS:
logger.error("VoiceTTS: speech failed — %s", exc)
def set_rate(self, rate: int) -> None:
"""Set speech rate in words per minute (typical range: 100300, default 175)."""
self._rate = rate
if self._engine:
self._engine.setProperty("rate", rate)
def set_volume(self, volume: float) -> None:
"""Set speech volume. Value is clamped to the 0.01.0 range."""
self._volume = max(0.0, min(1.0, volume))
if self._engine:
self._engine.setProperty("volume", self._volume)
@@ -92,6 +95,7 @@ class VoiceTTS:
return []
def set_voice(self, voice_id: str) -> None:
"""Set the active TTS voice by system voice ID (see ``get_voices()``)."""
if self._engine:
self._engine.setProperty("voice", voice_id)