From 686b1144baaf3ae9fec876a5b8a11a90ab468ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Doyon?= Date: Sat, 24 Nov 2007 14:21:04 +0000 Subject: [PATCH] Have voice_wait wait for the PCM buffer to drain. It can only do this if playback is NOT in progress, but that is indeed the case for the only caller (shutting down message). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15790 a1c6a512-1295-4272-9138-f99709370657 --- apps/voice_thread.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/voice_thread.c b/apps/voice_thread.c index 87702339c8..3782ae8aac 100644 --- a/apps/voice_thread.c +++ b/apps/voice_thread.c @@ -181,6 +181,9 @@ void voice_wait(void) * new clip by the time we wait. This should be resolvable if conditions * ever require knowing the very clip you requested has finished. */ event_wait(&voice_event, STATE_SIGNALED); + /* Wait for PCM buffer to be exhausted. Works only if not playing. */ + while(!playback_is_playing() && pcm_is_playing()) + sleep(1); } /* Initialize voice thread data that must be valid upon starting and the