Add flush_audio() to PlayHTTTSService

This commit is contained in:
Mark Backman
2025-03-07 15:26:47 -05:00
parent 615cbe966a
commit 5ae6229c03
2 changed files with 10 additions and 1 deletions

View File

@@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Added a `flush_audio()` method to `AzureTTSService` and `FishTTSService`.
- Added a `flush_audio()` method to `AzureTTSService`, `FishTTSService`, and
`PlayHTTTSService`.
- Added `set_language()` and `set_model()` to `AzureSTTService` and
`AssemblySTTService`.

View File

@@ -241,6 +241,14 @@ class PlayHTTTSService(InterruptibleTTSService):
await self.stop_all_metrics()
self._request_id = None
async def flush_audio(self):
"""Flush any pending audio in the buffer.
PlayHT's API doesn't provide a mechanism for flushing audio buffers,
so this method is a no-op.
"""
logger.trace(f"{self}: flush_audio is a no-op for PlayHT")
async def _receive_messages(self):
async for message in self._get_websocket():
if isinstance(message, bytes):