Index: apps/voice_thread.c =================================================================== --- apps/voice_thread.c (revision 29895) +++ apps/voice_thread.c (working copy) @@ -360,10 +360,6 @@ goto voice_decode; } - /* If all clips are done and not playing, force pcm playback. */ - if (!pcm_is_playing()) - pcmbuf_play_start(); - /* Synthesize a stop request */ /* NOTE: We have no way to know when the pcm data placed in the * buffer is actually consumed and playback has reached the end @@ -384,10 +380,10 @@ td.src[0] = (const char *)&voice_output_buf[td.lookahead]; td.src[1] = NULL; td.lookahead -= MIN(VOICE_FRAME_SIZE, td.lookahead); + td.state = TSTATE_BUFFER_INSERT; buffer_insert: /* Process the PCM samples in the DSP and send out for mixing */ - td.state = TSTATE_BUFFER_INSERT; while (td.count > 0) { @@ -427,6 +423,10 @@ td.count -= inp_count; } + /* If all clips are done and not playing, force pcm playback. */ + if (!pcm_is_playing()) + pcmbuf_play_start(); + yield(); } /* end while */ } /* voice_thread */