Merge pull request #492 from pipecat-ai/khk/flush-more-audio
add calls to flush_audio for say() and rtvi action
This commit is contained in:
@@ -259,6 +259,10 @@ class AsyncTTSService(TTSService):
|
|||||||
async def flush_audio(self):
|
async def flush_audio(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def say(self, text: str):
|
||||||
|
await super.say(text)
|
||||||
|
await self.flush_audio()
|
||||||
|
|
||||||
async def start(self, frame: StartFrame):
|
async def start(self, frame: StartFrame):
|
||||||
await super().start(frame)
|
await super().start(frame)
|
||||||
if self._push_stop_frames:
|
if self._push_stop_frames:
|
||||||
@@ -278,6 +282,11 @@ class AsyncTTSService(TTSService):
|
|||||||
await self._stop_frame_task
|
await self._stop_frame_task
|
||||||
self._stop_frame_task = None
|
self._stop_frame_task = None
|
||||||
|
|
||||||
|
async def process_frame(self, frame: Frame, direction: FrameDirection):
|
||||||
|
await super().process_frame(frame, direction)
|
||||||
|
if isinstance(frame, TTSSpeakFrame):
|
||||||
|
await self.flush_audio()
|
||||||
|
|
||||||
async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):
|
async def push_frame(self, frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM):
|
||||||
await super().push_frame(frame, direction)
|
await super().push_frame(frame, direction)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user